6

As explained in answer to this question and several others as well as in various other ressources, \mathrm is for setting upright math symbols (and may thus cause problems when used for text). So if, for whatever reason, I denote something with an upright f and something else with an upright i and want to multiply the two, \mathrm{fi} or \mathrm{f}\mathrm{i} should do the job and especially not employ any ligatures.

While I am rather sure that the above statement was correct not too long ago, my current distribution (TeX Live 2012) as well as this tool renders a ligature:

<code>\mathrm{f}\mathrm{i}</code>

Why? And when did this change? Or am I mistaken about this?

(Note that I am not looking for a way to avoid this.)


Minimal example:

\documentclass{article}
\begin{document}
\[ \mathrm{f}\mathrm{i} \]
\end{document}
9
  • 1
    I don't think the behavior has ever been of splitting the ligature. Since the font used has a nonzero interword space, ligatures are applied when two characters in that font are next to each other.
    – egreg
    Commented Jan 17, 2014 at 13:35
  • 1
    It is like this from the beginning of TeX.
    – egreg
    Commented Jan 18, 2014 at 10:05
  • 1
    While you may not be looking for a way to avoid it, others may. So here it is: \mathrm{f}\,\!\mathrm{i} Commented Mar 31, 2014 at 0:59
  • 1
    @SeanAllred -- no, we have potentially not yet reached the point where "all bugs become features". knuth, on his c&t web page, under "errata", announces that "I intend to check on purported bugs again in the years 2020, 2028, 2037, etc." of course, this depends on his continuing good health, but don't assume it won't continue, please. Commented Apr 1, 2014 at 15:04
  • 1
    @SeanAllred -- actually, two "major" bugs were reported and corrected in the most recent cycle; knuth's report of the "tuneup" will appear in the issue of tugboat now in preparation. as for where this ligaturing mechanism is located, it is in tex itself (not in plain.tex) since it is a function of the font properties, which are handled in the core, not as macros. (david's answer has given the reasons why this particular report would not be considered a bug. but that doesn't mean that there are no bugs left; they just get more and more obscure.) Commented Apr 1, 2014 at 16:03

1 Answer 1

12

This is by design (mostly:-).

\mathrm \mathit and friends are designed to allow multi-letter identifiers so use the same kerning and ligatures as the text fonts (in fact, in most font setups they are the text fonts) . This is in contrast to the math italic font which is not the same as the italic font used in text and does not have ligatures and has much wider sidebearings.

Well that explains why \mathrm{fi} has ligatures.

The justification for \mathrm{f}\mathrm{i} not losing ligatures is a bit harder. It's just the way it is, even if you do {\mathrm{f}}{\mathrm{i}} by the time TeX constructs a horizontal list from the math list, the f and i are adjacent and the font-specified ligature kicks in. The brace groups already implicit in the definition of \mathrm don't form ligature boundaries.

Example 3 below uses a {} empty math atom to break the ligature and the \rmsym command used in 4 makes its argument a single mathord atom but using {} internally to make sure that ligatures do not combine mathords in-appropriately.

enter image description here

\documentclass{article}
\newcommand\rmsym[1]{{{}\mathrm{#1}{}}}
\begin{document}
\showoutput
\[1 \mathrm{f}\mathrm{i} \]
\[2 \mathrm{fi} \]
\[3 \mathrm{f}{}\mathrm{i} \]
\[4 \rmsym{f}\rmsym{i} \]
\end{document}

You must log in to answer this question.

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