4

I want my characters to copy-paste as Unicode when I copy them from the PDF. I also want them to look like the traditional Latin Modern font. For unrelated reasons, I need to use LuaLaTeX rather than pdflatex. The unicode-math package works fine in most cases, but produces strange sans-serif double-struck characters. How do I fix this?

Example:

\documentclass{article}
\usepackage{amssymb}
\begin{document}
\[\alpha\beta\gamma\pi\sum\prod1+2+3+4+5+6+7+8+9+0/1!\]
\[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\]
\[\mathbb{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}\]
\end{document}

in lualatex gives

without unicode-math

whereas

\documentclass{article}
\usepackage{amssymb}
\usepackage{unicode-math}
\begin{document}
\[\alpha\beta\gamma\pi\sum\prod1+2+3+4+5+6+7+8+9+0/1!\]
\[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\]
\[\mathbb{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}\]
\end{document}

in lualatex gives

with unicode-math

While most of the characters are identical are nearly identical, the capital double-struck characters are clearly not. They don't even have serifs, unlike the rest of the characters. It's cool that I can now get lowercase double-struck characters, but this doesn't make up for the jarring and stylistically very-different uppercase double-struck characters. The answer at https://tex.stackexchange.com/a/360609/2066 gives the correct characters, but then the characters don't copy-paste as double-struck. How do I get the Latin Modern / Computer Modern double-struck characters back without losing the unicode-copy-paste feature of unicode-math?

(I'm also curious about the history here; why are these characters so different? https://tex.stackexchange.com/a/525235/2066 says "Latin Modern Math is a clone of Knuth’s Computer Modern, and unicode-math produces nearly-identical output under the default settings (with a few caveats: the \mathcal alphabet is based on Euler Calligraphic instead of traditional LaTeX).")

3
  • 1
    You say "traditional latin modern" but your first code block doesn't use latin modern at all, the first two rows use computer modern fonts and the last \mathbb uses AMS msbm10 font, the AMS fonts don't really blend that well with computer modern at all, and are based on designs aimed to fit with the in house AMS publishing fonts. Conversely with unicode-math all three rows are set from the same font, latin modern Math. Jan 5, 2021 at 0:43
  • 1
    You might prefer an alternative computer modern based OTF math font \setmathfont{New Computer Modern Math} Jan 5, 2021 at 0:46
  • You can also select any OpenType or TrueType font as \mathbb with \setmathfont[range=bb].
    – Davislor
    Jan 5, 2021 at 4:00

1 Answer 1

8

The classic TeX double struck font you show in the first code block is not derived from Computer Modern at all it is the AMS symbol font msbm10 (and the first two rows are set in Computer Modern, not Latin Modern)

The second block is using a consistent font for all three rows, Latin Modern Math Opentype.

There are other Computer Modern inspired OpenType Math fonts, notably NewComputerModernMath. You may prefer the double struck math in this font:

\documentclass{article}
\usepackage{amssymb}
\usepackage{unicode-math}
\setmathfont{New Computer Modern Math}
\begin{document}
\[\alpha\beta\gamma\pi\sum\prod1+2+3+4+5+6+7+8+9+0/1!\]
\[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\]
\[\mathbb{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}\]
\end{document}

enter image description here

2
  • The uppercase double struck letters do not have serifs on my system (updated TeX Live 2021) for some reason. (with the newcomputermodern fonts) Aug 30, 2021 at 13:59
  • @ApoorvPotnis the above document makes this output in a texlive 2021 updated two minutes ago. If you get something different make a test document and post as a question Aug 30, 2021 at 14:11

You must log in to answer this question.

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