TeX - LaTeX Asked by Brent.Longborough on September 26, 2021
I’ve just come across this curiosity. Can anyone tell me what’s going on? Here’s the mwe:
documentclass[12pt]{article}
usepackage{fontspec}
setmonofont{Consolas}
begin{document}
texttt{
begin{description}
item[--help] Help
item[-{}-help] Help
end{description}}
end{document}
And here are the results:
LuaLaTeX:
XeLaTeX:
I get similar results with Source Code Pro in place of Consolas.
Now, I have two issues with this:
-()-
is, I believe, the canonical way to ‘break’ an automatic ligature. Why is LuaLaTeX producing incorrect output?texttt{}
, the description list [item]s are being set in Latin Modern Roman, rather than Consolas. Why?(BTW, I appreciate I may be able to fix #2 with the enumitem
package, but I shouldn’t have to, IMO.)
You don't need to break the ligatures if you set the mono font for the labels, because the monospaced font is loaded without the Ligatures=TeX
option.
documentclass[12pt]{article}
usepackage{fontspec}
usepackage{enumitem}
setmonofont{Consolas}
newlist{ttdescriptioninner}{description}{1}
setlist[ttdescriptioninner]{font=ttfamily}
newenvironment{ttdescription}
{ttfamilyttdescriptioninner}
{endttdescriptioninner}
begin{document}
begin{ttdescription}
item[--help] Help
item[--help] Help
end{ttdescription}
end{document}
Correct answer by egreg on September 26, 2021
My thanks to Henri Menke and Ulrike Fischer for their observations.
-{}-
is not the canonical way to break a ligature; rather, the correct way is -kern0pt-
.-{}-
enumitem
package provides features to adjust the typesetting of the item label.Answered by Brent.Longborough on September 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP