1

Is it possible to change the default font in the equation environment and also in math mode globally to mathcal or mathscr?

By this I mean that if I typeset $...$, or $$...$$ or

\begin{equation}
...
\end{equation}

or

\begin{theorem}
my description here
    \begin{equation}
    ...
    \end{equation}
\end{theorem}

The default font used in the equations will be either mathcal or mathscr?

I am compiling using pdflatex.

I read the following post

How to change default font style in math mode?

however I wansn't able to use it to solve this issue (possibly due to conflicts with the existing packages in the custom template I have to use).

Here is an example:

If I type

\begin{equation}
    p(x) = (2\pi \sigma^2)^{-1/2} \exp \bigg\{ \frac{-1\frac{1}{2} \frac{(x - \mu)^2}{\sigma^2} \bigg\}
\begin{equation}

I would like the result to appear like this:

enter image description here

(Image taken from a pdf document I have. I don't know the original author of it so I can not contact them).

4
  • 1
    \mathcal and \mathscr only work for capital letters, so this would give bad results if you have any lower case letters in your math expressions. To solve this you would need to check automatically which parts of your math are upper case and which are not, that would be very complicated. So it's probably easier to just type the calligraphic or script letters manually. You could consider defining some macro's to save on typing, for example \def\clA{\mathcal{A}} so you can type \clA every time you need a calligraphic A.
    – Marijn
    Jun 3, 2020 at 18:31
  • @Marijn thank you for the response. Perhaps I wasn't clear about the requirement. I have added an example to illustrate what I mean. I have a pdf document where the author someone has managed to do it but I don't know how they did it and I also don't know the author so I can not contact them to inquire.
    – NM_
    Jun 3, 2020 at 19:09
  • That might be a custom math font with XeLaTeX, you could check the pdf properties (one of the menu items in your pdf viewer) to see which compiler was used and which fonts are in the document. You can get something similar (although not entirely the same) in pdfLaTeX with \usepackage{mathpazo}.
    – Marijn
    Jun 3, 2020 at 19:44
  • I think this is an XY problem, since the symbols from your desired output are not actually from \mathcal or \mathscr, but the range= option of \setmathfont from unicode-math does have a syntax to remap math alphabets such as \mathit and \mathcal. Furthermore, it has lowercase \mathcal Latin letters. There is no Greek \mathcal alphabet, however.
    – Davislor
    Jun 4, 2020 at 2:30

1 Answer 1

3

You get the output with something like

\documentclass{article}
\usepackage{amsmath}
\usepackage[garamond]{mathdesign}
\usepackage{garamondx}

\begin{document}

\begin{equation}
p(x) = (2\pi \sigma^2)^{-1/2} \exp \biggl\{ -\frac{1}{2} \frac{(x - \mu)^2}{\sigma^2} \biggr\}
\end{equation}

\end{document}

I'd prefer garamondx for the text fonts, so I loaded it after mathdesign to override its selection of the text font.

enter image description here

This has of course nothing to do with \mathcal, that denotes a specific math alphabet for special symbols.

You must log in to answer this question.

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