Get unicode output for quotation marks

Guenter Milde milde at users.sf.net
Mon Mar 16 10:36:17 UTC 2020


On 2020-03-14, Daniel wrote:
> On 2020-03-14 13:25, Guenter Milde wrote:

>>>> Is there a way to get LyX to use unicode for quotation marks?

>>>> In particular, I am using quotation marks in a section title which
>>>> generates the following LaTeX code:

>>>> \section{``Test''}

>>>> However, I would like it to generate

>>>> \section{“Test”}

>>>> The problem is that otherwise the bookmarks in PDFs also show ``Test''
>>>> instead of “Test”.

>>> I just learned about the LaTeX command \texorpdfstring. Basically, one
>>> gives it two arguments where the first is the tex and the second is the
>>> one to be used in the bookmarks (pdf). Doesn't look nice in LyX but gets
>>> the job done. However, I had to manually switch to unicode encoding to
>>> get it to work with the "fancy" quotation marks (Document > Settings >
>>> Language). See the attached file.

>> With Unicode (utf8) encoding, there should be no need for
>> \texorpdfstring, as the typographical quotes are used in the latex
>> source:

>>   >> \section{“Test”}

>> (This is one of the reasons why utf8 is the new default encoding in LyX 2.4.)

> No, even with utf8, \section{``Test''} is produced in the latex source.

I see: 

* The Unicode literals are used in the LaTeX source when
  
  - input uses Unicode literals (with either system key-combinations or
    custom LyX keybindings) and
    
  - Document>Settings>Language>input encoding is set to one of the Unicode
    encodings or "pass-through".
    
  or with "non-TeX" fonts.    
    
* the "quote inset" still uses the LaTeX ligatures instead of Unicode with
  8-bit TeX fonts. 
  
  This was sensible with "input encoding" defaulting to latin1 (or some
  other language dependent 8-bit encoding) where the literal charater "“"
  would have become "\textdblquote" in the LaTeX source.
  As the new default "input encoding" is utf8, this reason no longer holds.

Could you file an enhancement request ticket at bugs.lyx.org?

Günter



More information about the lyx-users mailing list