0

I am trying to use the Kleene's O ($\mathcal{O}$) in some equations to represent a zero matrix. However, I am using Times as my standard math font and do not like the look of the symbol and would like to set it back to the standard font.

How can I set the math font to standard for just a single symbol. I would like to create a command permitting me to do so as such:

\newcommand{\zeromatrix}{\mathcal{O}}

How can I however set the font for the single symbol inside back to standard?

Thanks in advance for your help!

Edit: Here's a minimal working example of my document with the math font set to Times:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\begin{document}
    $\mathcal{O}$
\end{document}
  • 3
    As always on this site, please post a full minimal example. You mention you are using Times as the math font, how? Also, don't use $ inside that definition, it's being used in math more anyway so the $ does more harm than good. – daleif May 03 '18 at 13:28
  • A minimal working sample is needed. – M. Logic May 03 '18 at 13:53
  • This answer is closed, but unicode-math lets you use \setmathfont]range={cal,bfcal}] option to change only \mathcal and \mathbfcal. You’ll also want to set scale=MatchUppercase to make sure the letters are the right size. For example, \setmathfont[range={cal,bfcal}, scale=MatchUppercase]{Latin Modern Math}. Several fonts, incluing XITS Math, Stix Two Math, and Asana Math, have separate \mathcal and \mathscr that you can access with StylisticSet or Alternate. – Davislor May 06 '18 at 21:47

1 Answers1

2

It's the package mathptmx that changes style of \mathcal. So what you should do is back:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\DeclareSymbolFont{xsymbols}{OMS}{cmsy}{m}{n}
\SetSymbolFont{xsymbols}{bold}{OMS}{cmsy}{b}{n}
\DeclareSymbolFontAlphabet{\mathcal}{xsymbols} 

\begin{document}
$\mathcal{O}$
\end{document}

And we have another easier way with the help of the package mathalfa:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage[cal=cm]{mathalfa}

\begin{document}
$\mathcal{O}$
\end{document}

The standard math calligraphic O now is back:

enter image description here

Note that you can't change only the style of \mathcal{O} but also \mathcal{A,B}..., i.e., \mathcal{A,B,C,D}... all get back to be standard.

M. Logic
  • 4,214
  • This is even better than what I was looking for! Great answer, Thank you very much! You nailed it even before I could post the minimum working sample! ;) – budekatude May 03 '18 at 14:06
  • @budekatude: Beware, however, of the remarks made in this answer apropos wasting one math alphabet for a single symbol: you might prefer to use the more refined technique given in that answer. – GuM May 03 '18 at 14:19