12

I'm trying to figure out how to best typeset primed values. It seems that, e.g.

$f'$ and $f\prime$ give off a slightly different result:

I like the right ($a\prime$) version better, but I'm not sure if that's correct.

EDIT after going over my preamble, I found the "culprit" - it was the package unicode-math, which I added to be able to use \Colon. After removing it, my primes rendered exactly like in Mico's answer.

  • Unicode-math changes the math font to Latin Modern Math. You can select any other math font whose primes you like better, or even \setmathfont[range=\prime]. – Davislor Jan 28 '19 at 05:15

1 Answers1

22

It seems that, e.g. $f'$ and $f\prime$ give off a slightly different result

First off, the item on the left-hand side of the screenshot you posted does not appear to have been created by either $f'$ and $f\prime$ -- at least not by either TeX or LaTeX. See also the screenshot below and the associated LaTeX code.

The item on the right-hand side could have been created by either $f'$ or $f^{\prime}$, since the two methods are entirely equivalent.

In math mode, x' and x^{\prime} are equivalent. The former is a lot easier to type, though. This becomes especially evident for higher-order derivatives: Speaking for myself, I'd much rather type $f'''$ than $f^{\prime\prime\prime}$.

enter image description here

\documentclass{article}
\begin{document}    
$f' \quad f^{\prime} \quad f\prime$ 
\end{document}
Mico
  • 506,678
  • Bit of context: I'm converting Bartosz Milewski's blogpost series on category theory to a PDF in LaTeX, which I based on the work (mainly, preamble.tex) from another book. Unfortunately, I'm very new to LaTeX, so I'm learning it as I go :)) – Igal Tabachnik Oct 10 '17 at 07:32
  • Perhaps it's the combination of packages in preamble.tex which cause this? Here's the one I'm using now, but I'll try to make a small repro with minimal preamble. – Igal Tabachnik Oct 10 '17 at 07:34
  • And oh yeah, it certainly looks much better in your example. I'm going to try and experimenting with removing packages from my preamble.tex, until it looks ok :) I'll accept your answer, thanks! – Igal Tabachnik Oct 10 '17 at 07:35
  • 1
    @IgalTabachnik - That's a rather complex and complicated preamble, by the way. I harbor some doubts that it has to be so complex... – Mico Oct 10 '17 at 07:58
  • 1
    You may be right :) I'm trimming it a bit as I go. It was originally a preamble used for a Texinfo/LaTeX version of SICP I found https://github.com/sarabander/sicp-pdf – Igal Tabachnik Oct 10 '17 at 07:59
  • 3
    @IgalTabachnik I would recommend starting with an empty preamble and building it up as you go. – Teepeemm Oct 10 '17 at 14:28
  • I figured out what it was -- the package unicode-math, I used it to be able to use \Colon. I'm looking for workarounds. Will add this info to the original question. – Igal Tabachnik Oct 10 '17 at 19:06
  • @IgalTabachnik - Wow, in my view, the fact that the unicode-math package doesn't define (or possibly undefines) \prime is serious trouble. Happily, $f'$ does work if unicode-math is loaded. – Mico Oct 10 '17 at 19:22
  • @Mico I've been reading about it a bit more, seems that I'm not the only one who ran into these issues. In either case, I'll leave it be for now, and deal with it once the book is fully converted :) Thanks again for the help! – Igal Tabachnik Oct 10 '17 at 19:32
  • 2
    @IgalTabachnik - Great news: After you provided the comment that unicode-math was the likely source of the issue, some four hours ago, I contacted the maintainer of the unicode-math package, and he's already provided a bug fix and pushed it out to TeXLive! (Not sure when the fix will show up on MikTeX, in case that's what you're using.) If you update your TeX distribution to version 0.8h of unicode-math, the \prime directive should once again work. Isn't this a great community or what?! (Of course, I still think that writing $y'$ is more convenient than $y^{\prime}$...) – Mico Oct 10 '17 at 23:10
  • 2
    @Mico that is incredible! Even a better resolution I could have hoped for! I'm using MacTeX, if that matters. Again, thanks so much, this is indeed a great community, and will go to the acknowledgments section :) – Igal Tabachnik Oct 11 '17 at 04:39
  • @IgalTabachnik - I'm also a MacTeX user. :-) – Mico Oct 11 '17 at 08:20