7

I have a problem with LuaLaTeX (from TL 2016: Version 0.95.0 (TeX Live 2016) (format=lualatex 2017.1.29)) making inappropriate ligatures. Here goes the MWE:

\documentclass[a4paper, 12pt]{article}
\def\czechSingleQuotes #1{‚#1‘} % UTF-8 chars for single quotes
\begin{document}
\czechSingleQuotes{Ahoj!}

\czechSingleQuotes{Nazdar?}

‚Hi!‘
\end{document}

The result looks like this:

Bug in LuaLaTeX

I hope LuaTeX guys are reading it here and will do something about it. However, would anyone have any suggestion as how to work around this until it gets fixed? Usual (in different situations) tricks do not help, e.g. \def\czechSingleQuotes #1{‚{#1}{}\relax ‘} produces the same result.

Thx in advance.

Later EDIT: This has been fixed in the newest luaotfload (v2.8-fix-1) however the fix seems to be going a little too far — now even the standard ligatures to create reverted Spanish exclamation or question marks do not work any more, so that this:

\documentclass[a4paper, 12pt]{article}
\begin{document}
Hi?` % standard back apostrophe, no UTF-8

Hi!` % ditto
\end{document}

creates different outputs in LuaTeX (standard q./ex. marks followed by a back quote) and in XeTeX or pdfTeX (Spanish reverted q./ex. marks).

6
  • It’s fine in ConTeXt, so it’s fixable. \starttext ‚Hi!‘ \stoptext Commented Jan 31, 2017 at 19:27
  • Note that LuaTeX, unlike pdfLaTeX, discards {}. Insert a zero-width \kern -- it's never discarded.
    – Mico
    Commented Jan 31, 2017 at 19:37
  • @DavidCarlisle: OK, thx, I'll report it probably tomorrow.
    – Marcel S.
    Commented Jan 31, 2017 at 19:49
  • 1
    seems to be a luaotfload issue (although still with the version in today's texlive update) Commented Jan 31, 2017 at 19:57
  • 1
    Raised as github.com/lualatex/luaotfload/issues/397 Commented Jan 31, 2017 at 20:30

2 Answers 2

6

As David Carlisle has pointed out in comment, the "classic" TeX ligatures for inverted question and exclamation marks are being applied even though "typographic" quotes, rather than basic back quotes, are present.

Inserting the instruction \kern0pt before the closing quote is an effective remedy. Note that LuaTeX, unlike pdfLaTEX, discards {} elements. Hence, you can't use {} to create some invisible separation between the punctuation marks and the typographic quotes.

enter image description here

\documentclass{article}
\def\czechSingleQuotes#1{‚#1\kern0pt‘} % UTF8 chars for single quotes
\begin{document}
% "classic" TeX ligatures applied even though "typographic" quotes are in use
? ?` ?‘ --- ! !` !‘ 

\czechSingleQuotes{Ahoj!}

\czechSingleQuotes{Nazdar?}

\czechSingleQuotes{Hi!!}
\end{document}
3
  • 2
    it seems to be using classic tex ligatures for ?` even though typographic quotes have been used. Commented Jan 31, 2017 at 19:39
  • @DavidCarlisle - Excellent point! I'll provide this insight in the body of my answer, if I may.
    – Mico
    Commented Jan 31, 2017 at 19:41
  • 1
    @Mico: Thx, this workaround seems to do the trick. I do not write Spanish much and if so, I just enter those inverted question or exclamation marks directly, therefore I didn't even know those ligatures.
    – Marcel S.
    Commented Jan 31, 2017 at 19:53
7

The TeX ligatures are being mis-applied, you can use fontspec to turn them off, although for example that means that --- would no longer ligature to an mdash.

\documentclass[a4paper, 12pt]{article}
\usepackage{fontspec}
\def\czechSingleQuotes #1{‚#1‘} % UTF-8 chars for single quotes
\defaultfontfeatures[\rmfamily]{}
\setmainfont{Latin Modern Roman}
\begin{document}
\czechSingleQuotes{Ahoj!}

\czechSingleQuotes{Nazdar?}

‚Hi!‘
\end{document}

enter image description here


This is a luaotfload issue as this plain tex test shows, I'll report to the github.

enter image description here

\input{luaotfload.sty}

\font\fa=[lmroman12-regular.otf]
\font\fb=[lmroman12-regular.otf]:+tlig

\fa 

U+2018 no tlig !‘

U+0060 no tlig !`

\fb

U+2018 tlig !‘

U+0060  tlig !`

\bye

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .