pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

Texinfo Writer: don't map U+2019 to apostrophe

Open lemzwerg opened this issue 1 month ago • 4 comments

[pandoc 3.8.2.1]

Currently, pandoc converts code like ‘foo’ to ‘foo' while writing Texinfo output, i.e., the single-quote character U+2019 is replaced with a plain apostrophe. AFAICS, this is no longer needed: in Texinfo, support for Unicode quotation marks was added in 2007 (i.e., shortly before Pandoc's Texinfo reader was created).

Note that nowadays Texinfo has the possibility to output Texinfo as LaTeX code (I haven't this tested yet, though); this means that finally non-CM fonts can be used. However, a consequence of using non-CM fonts is that glyphs for U+2018 (the other single-quote character) almost never pair optically with the apostrophe glyph (this pairing is a peculiarity of the CM fonts) – this is another reason for not doing this mapping.

I thus suggest to remove this line

escChar '\x2019' = "'"

from Texinfo.hs.

lemzwerg avatar Dec 02 '25 06:12 lemzwerg

Pandoc will convert a SingleQuoted element to

`foo'

in texinfo. Are you suggesting that this should also be changed?

The texinfo manual says:

As explained in the early section on general Texinfo input conventions (see Section 2.1 [Conventions], page 9), Texinfo source files use the ASCII character` (96 decimal) to produce a left quote (‘), and ASCII' (39 decimal) to produce a right quote (’). Doubling these input characters (`` and '') produces double quotes (“ and ”). These are the conventions used by T EX

I'm somewhat leary of departing from the standard approach described in the docs.

jgm avatar Dec 02 '25 08:12 jgm

Pandoc will convert a SingleQuoted element to

`foo'

in texinfo. Are you suggesting that this should also be changed?

No, this should not be changed. Texinfo is prepared to handle ` and ' as a quotation mark pair – it is part of the Texinfo language, so to say. However, it is not prepared to handle and ' as a pair.

lemzwerg avatar Dec 02 '25 09:12 lemzwerg

This will lead to somewhat strange output, then, with curly quotes for apostrophes and straight quotes for quotes.

jgm avatar Dec 02 '25 10:12 jgm

I see. The problem is actually makeinfo creating an 'Info' file: For such output files, the quote characters are not mapped to other characters by default[^*]. In other words, using ‘foo' stays as-is, which is ugly.

Would it be possible to add an option the the Texinfo writer that, if active, maps curly Unicode quotes to ASCII (both single and double quotes), and otherwise doesn't?

[^*]: I.e., if option ASCII_DASHES_AND_QUOTES is set, which is the default.

lemzwerg avatar Dec 02 '25 16:12 lemzwerg