Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I opened an issue about this in Unicode-math's github repository. However, I am not so sure it is actually a bug, or I just did something wrong.

Here is a minimal example,

\documentclass{article}

\usepackage{unicode-math}

\setmathfont[version=Asana]      {Asana Math}
\setmathfont[version=Cambria]    {Cambria Math}
\setmathfont[version=LatinModern]{Latin Modern Math}
\setmathfont[version=Minion]     {Minion Math}
\setmathfont[version=XITS]       {XITS Math}

\def\testprime{f'x'f''''x''''\quad f\prime x\prime f\qprime x\qprime}
\setlength{\parindent}{0pt}

\begin{document}
  \fontsize{36}{36}\selectfont
  Asana       \mathversion{Asana}       \[ \testprime \]
  Cambria     \mathversion{Cambria}     \[ \testprime \]
  LatinModern \mathversion{LatinModern} \[ \testprime \]
  Minion      \mathversion{Minion}      \[ \testprime \]
  XITS        \mathversion{XITS}        \[ \testprime \]
\end{document}

enter image description here

It seems that the ASCII input was transformed into supscripts while \prime etc are not.

With Asana Math the ASCII version looks fine while the \prime version looks horrible. It looks like in Asana Math primes are designed as normal glyph, they need to be raised to supscripts to works well.

With Latin Modern Math, it looks horrible for both case. I think it is a font problem for LM case.

For other three fonts, the \prime looks good while using ASCII input they looks terrible. In these fonts, the primes seems to be designed as a supscripts glyph, and raising them even more does not looks good.

Is there anyway to modify the behavior of the ASCII input?

In addition, with Latin Modern Math, neither '''' or \qprime works, they all produce nothing. I thought '''' was supposed to use negative kern to fake the \qprime when it is not available.

Update: Thanks for both @KhaledHosny and @LeoLiu's answers. Now it seems to be more complicated. Using the old TeX way to typeset primes get the position right when both prime and subscripts are presented. However, to conform the Unicode standard, I think the fonts should design the primes as superscript glyphs, which means they will look really bad when raised in superscript position. Right now my temporary solution is to use \prime etc. and add a negative kern between primes and subscripts.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

In traditional TeX fonts, \prime is a big glyph like the one in Latin Modern Math or Asana Math. However, there isn't such a character in Unicode. Symbol U+2032 is used as prime, but it looks like $^\prime$ i.e. $'$ in TeX. That makes the problem.

As a Unicode math font, Cambria/Minion/XITS is correct. And \prime command should be unavailable then. It seems a bug. I don't think the maintainers of unicode-math can do much. Asana Math and Latin Modern Math fonts may be modified to coincide with Unicode standard; then unicode-math can produce consistent result.

Definition in Unicode: http://www.unicode.org/charts/PDF/U2000.pdf


A temporary fix for Cambria Math:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Cambria Math}
\ExplSyntaxOn
\group_begin:
  \char_set_catcode_active:N \'
  \char_set_catcode_active:N \`
  \char_set_catcode_active:n {"2032}
  \char_set_catcode_active:n {"2033}
  \char_set_catcode_active:n {"2034}
  \char_set_catcode_active:n {"2057}
  \char_set_catcode_active:n {"2035}
  \char_set_catcode_active:n {"2036}
  \char_set_catcode_active:n {"2037}
  \cs_gset:Nn \um_define_prime_chars: {
    \cs_set_eq:NN '        \um_scan_prime:
    \cs_set_eq:NN ^^^^2032 \um_scan_prime:
    \cs_set_eq:NN ^^^^2033 \um_scan_dprime:
    \cs_set_eq:NN ^^^^2034 \um_scan_trprime:
    \cs_set_eq:NN ^^^^2057 \um_scan_qprime:
    \cs_set_eq:NN `        \um_scan_backprime:
    \cs_set_eq:NN ^^^^2035 \um_scan_backprime:
    \cs_set_eq:NN ^^^^2036 \um_scan_backdprime:
    \cs_set_eq:NN ^^^^2037 \um_scan_backtrprime:
  }
\group_end:
\ExplSyntaxOff

\begin{document}

$A' A'' A''' A''''$

\end{document}

enter image description here

share|improve this answer
    
Can you do the same "fix" that you did for Cambria Math on a per-font basis (e.g. for use with \mathversion)? It seems to apply to the current math font now. –  Sean Leather Nov 27 '13 at 8:12
add comment

You can either use f' or f^\prime, which is the proper way for inputting prime even if not using unicode-math. The fact that some fonts give superscripted prime with \prime is not something you should rely on. See Why isn't \prime automatically set to be a superscript? for the reason why old TeX fonts have such a big prime glyph (In OpenType math the issue is dealt with a bit differently, but some fonts still following the old practices).

share|improve this answer
3  
Now that I see the image (it was not sown when I wrote this answer), there is clearly a bug with the f' case. –  Khaled Hosny Oct 1 '11 at 3:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.