1

I would like to change the font associated specifically with \mathcal to cambria rather than the default font without changing the rest of the document.

How may I do that? I don't mind setting up a newcommand which calls both the font and mathcal in order to do so but I don't want the text around it to change font from whatever mathmatical font is set by default.

Thanks

Edit: As requested I simply want to produce what is discussed in this thread: how to represent these symbols from Word in LaTeX? Without changing the font of the entire document, i.e. the cambria font should only be in effect for the \mathcal command.

My thought is there must be a way which incorporates \newcommand in order to set a new command which is able to act like \mathcal but also changes the font to cambria.

Edit 2: For those of you who may be using pdflatex you will need to switch to XeLaTeX or LuaLaTeX and add the following lines in your preamble so that the mathfonts are pretty much the same as in pdflatex with cambria \mathcal:

%In Texmaker change the options for quickbuild to XeLaTeX + View PDF or LuaLaTeX + View PDF 
\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont{Cambria Math}[range=\mathcal]
\renewcommand{\boldsymbol}[1]{\symbfit{#1}} %You can continue to use \boldsymbol.
\let\mathbb\relax
\DeclareMathAlphabet{\mathbb}{U}{msb}{m}{n}
\begin{document}
%Document info
\end{document}
3
  • 1
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – Aradnix
    Sep 1, 2020 at 2:55
  • In particular, do please tell us whether you use pdfLTeX, XeLaTeX, or LuaLaTeX (or something else entirely) and whether your document loads the fontspec and/or unicode-math packages.
    – Mico
    Sep 1, 2020 at 5:25
  • I am not certain, I am using a very simple and default version of Texmaker to produce my TeX files, I am able to load any of the packages that you've suggested.
    – user165295
    Sep 1, 2020 at 6:00

1 Answer 1

3

I don't think that Cambria is available for pdflatex. Here's a simple setup for XeLaTeX or LuaLaTeX.

\documentclass{article}
\usepackage{unicode-math}

\setmathfont{Latin Modern Math}% or whatever
\setmathfont{Cambria Math}[range=\mathcal]

\begin{document}

$a+b\in\mathcal{C}$

$
\mathcal{A}
\mathcal{B}
\mathcal{C}
\mathcal{D}
\mathcal{E}
\mathcal{F}
\mathcal{G}
$

\end{document}

enter image description here

3
  • Thanks for your assistance, I am facing a couple of issues when I try to switch to XeLaTeX or LuaLaTeX, for some reason \mathbb appears differently than in pdflatex and as well the \boldsymbol command which I sometimes use in math equations doesn't work as it would in pdflatex. Do you have any advice for this?
    – user165295
    Sep 2, 2020 at 5:11
  • I was able to configure \mathbb through the following: \let\mathbb\relax \DeclareMathAlphabet{\mathbb}{U}{msb}{m}{n} but \boldsymbol seemingly doesn't work in the math environment.
    – user165295
    Sep 2, 2020 at 5:37
  • Disregard my previous statements \renewcommand{\boldsymbol}[1]{\symbfit{#1}} was able to fix boldsymbol.
    – user165295
    Sep 2, 2020 at 5:47

You must log in to answer this question.