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.

Recently I switched from pdflatex to xelatex to be able to use OpenType fonts. I like to use variables highlighted using \mathcal for specific variables, while I used to use \mathscr-typeset variables for matrices. But when I compile with XeLaTeX they look exaclty the same.

Old code

\documentclass{standalone}
\usepackage{mathrsfs}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

Output

old

New code

\documentclass{standalone}
\usepackage{unicode-math}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

Output

new

Broken code

I tried to get back the glyphs from mathrsfs, but it failed this way.

\documentclass{standalone}
\usepackage{unicode-math}
\usepackage{mathrsfs}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

Output

broken

Question: How can I get back the behaviour? In principle I'd like to have the old \mathcal letters from the pdflatex-version of Computer/Latin Modern.

share|improve this question
1  
Ha-haa! This is something I have wondered as well, as if it doesn't use multiple families, how do you choose the different variants ie +ssalt for cal –  morbusg Jun 19 '13 at 19:47

3 Answers 3

up vote 17 down vote accepted

You have several options

Don’t use unicode-math

Unless you have a specific reason to use it, you don’t have to use it and your old code should work just fine.

\documentclass{standalone}
\usepackage{mathrsfs}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

enter image description here

Use a different math font

Some OpenType math fonts like XITS Math have both math calligraphic and math script alphabets. By default XITS Math has a math script alphabet and the math calligraphic alphabet is available through stylistic set 1. We can use unicode-math

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{XITS Math}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

enter image description here

Use \mathscr from a different font

The default font, Latin Modern Math, has a math calligraphic alphabet only; we can use the math script from XITS Math. Though unicode-math loads Latin Modern Math by default, we have to explicitly use it for some reason or things will not be quite right.

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range={\mathscr,\mathbfscr}]{XITS Math}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

enter image description here

That being said, the root of this complication is because the people who encoded Unicode math symbol could not find any convincing evidence for the use in math of both the calligraphic alphabet and the math script in the same context to mean different things, so they considered it to be just a stylistic not semantic difference so they were unified in encoding.

share|improve this answer
    
In your examples you loaded XITS Math, how can I obtain \mathcal from Computer Modern? –  Henri Menke Jun 19 '13 at 20:14
    
@HenriMenke: You can’t use Computer Modern with unicode-math, the last example you get it from Latin Modern Math which is the closest you can get. –  Khaled Hosny Jun 19 '13 at 20:16
    
Okay, thank you anyway. I normally use TeX Gyre Pagella Math, but I don't like its script alphabet, so I wanted to fall back to CM, but it seems like I have to stick with XITS. –  Henri Menke Jun 19 '13 at 20:18
    
@HenriMenke In the second example you can replace the second XITS Math with Latin Modern Math if it is good for you (and the first one with TeX Gyre Pagella Math of course). –  Khaled Hosny Jun 19 '13 at 20:23

You can use different fonts for different ranges; XITS Math has the calligraphic letters similar to the usual ones.

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{XITS Math}
\setmathfont[range=\mathscr]{XITS Math}
\begin{document}
$\mathcal{ABCDEF} = \mathscr{ABCDEF}$
\end{document}

enter image description here

share|improve this answer

When Unicode added the Math Alphabet block they decided not to treat script and calligraphic as different, I think unicode-math more or less as a design principle follows that.

If you look in the log you see

Missing character: There is no 𝐶 in font rsfs10!

where that C is MATHEMATICAL ITALIC CAPITAL C (U+1D436)

You need to get back to a normal ASCII C for rsfS, this works although there may be more elegant ways

$\mathcal{C} = \mathscr{\char`\C}$

enter image description here

share|improve this answer
4  
Actually the other two answers are better than this, I deleted it but I decided to undelete it as it shows a way of getting rsfs back if you decide you want exactly that font alongside unicode-math. –  David Carlisle Jun 19 '13 at 20:08

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.