10

I have a paper in which I originally used mathit, bold mathit, mathcal and bold mathcal to distinguish various types of entities. Reviewing the paper on-screen it appears that \mathit{C} and \mathcal{C} are very similar in appearance. My first thought was to use sans-serif in place of the default font, but LaTeX doesn't let you combine \mathit and \mathsf.

The pdflatex font tables are close to full, and XeTeX is not an option since I can't control the compilation process of arXiv or other publishers. Is there a way to get italic sans-serif without loading additional fonts, and is there an alternative way to distinguish the entities for which I currently use bold, default, calligraphic and bold calligraphic. Note: I don't load bold fonts; I use \bm.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage[colorlinks,hidelinks]{hyperref}
\usepackage{cleveref}
\usepackage{showlabels}
\showlabels{cite}
\showlabels{cref}
\showlabels{crefrange}

\begin{document}

 $C$ default

 $\mathit C$ mathit

 $\mathcal C$ mathcal

 $\mathsf{C}$ mathsf

 $\bm C$ bm default

 $\bm{\mathcal{C}}$ bm mathcal

 $\bm{\mathit{\mathsf{C}}}$ bm mathit mathsf

\end{document}

I attempted to resolve this based on a suggestion by egreg, but the weight of the italic sans-serif was heavier than the weight of normal sans-serif. After I fixed a typo it worked.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage[colorlinks,hidelinks]{hyperref}
\usepackage{cleveref}
\usepackage{showlabels}
\showlabels{cite}
\showlabels{cref}
\showlabels{crefrange}

\DeclareMathAlphabet{\mathsfbd}{T1}{\sfdefault}{\bfdefault}{\itdefault}
\SetMathAlphabet{\mathsfbd}{bold}{T1}{\sfdefault}{\bfdefault}{\itdefault}

\DeclareMathAlphabet{\mathsfit}{T1}{\sfdefault}{}{\itdefault}
\SetMathAlphabet{\mathsfit}{normal}{T1}{\sfdefault}{}{\itdefault}

\DeclareMathAlphabet{\mathsfbdit}{T1}{\sfdefault}{\bfdefault}{\itdefault}
\SetMathAlphabet{\mathsfbdit}{bold}{T1}{\sfdefault}{\bfdefault}{\itdefault}

\begin{document}

 $C$ default

 $\mathit C$ mathit

 $\mathcal C$ mathcal

 $\mathsf{C}$ mathsf

$\mathsfbd{C}$ mathsfbd

$\mathsfbdit{C}$ mathsfbdit

$\mathsfit{C}$ mathsfit

 $\bm C$ bm default

 $\bm{\mathcal{C}}$ bm mathcal

 $\bm{\mathit{\mathsf{C}}}$ bm mathit mathsf

$\bm{\mathsf{C}}$ bm mathsf

$\bm{\mathsfbd{C}}$ bm mathsfbd

$\bm{\mathsfit{C}}$ bm mathsfit

$\bm{\mathsfbdit{C}}$ bm mathsfbdit

\end{document}
shmuel
  • 1,449

3 Answers3

14

Math alphabets commands such as \mathit and \mathsf are not “cumulative”. You have to allocate a specific math alphabet.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{fix-cm} % not needed if not using Computer Modern

\DeclareMathAlphabet{\mathsfit}{T1}{\sfdefault}{\mddefault}{\sldefault} \SetMathAlphabet{\mathsfit}{bold}{T1}{\sfdefault}{\bfdefault}{\sldefault}

\begin{document}

$C$ default

$\mathit{C}$ mathit

$\mathcal{C}$ mathcal

$\mathsf{C}$ mathsf

$\mathsfit{C}$ mathsfit

$\bm{C}$ bm default

$\bm{\mathcal{C}}$ bm mathcal

$\bm{\mathsf{C}}$ bm mathsf

$\bm{\mathsfit{C}}$ bm mathsfit

\end{document}

enter image description here

egreg
  • 1,121,712
  • Why {bold}? I'm looking for normal weight italic sns-serif unless I apply BM to it. Possibly I should have declarations for mathsift and mathsfitbd and skip the bm. What would that look like? Thanks. – shmuel Jun 01 '18 at 15:22
  • @shmuel Don't you get medium weight sans serif italic with \mathsfit{C} and bold sans serif italic with \bm{\mathsfit{C}}? – egreg Jun 01 '18 at 15:54
  • Yes, I get medium weight sans serif italic with \mathsfit{C}, but I want the same weight as \mathsf(C). I tried \SetMathAlphabet{\mathsfit}{normal}{T1}{\sfdefault}{}{\itdefault}, but that still gave me medium weight. I've updated my MWE to show the failed attempt. – shmuel Jun 04 '18 at 19:00
  • @shmuel I don't understand: with \mathsf{C} and \mathsfit{C} the weight is exactly the same. – egreg Jun 04 '18 at 19:03
  • All I know is that when I compile the MWE with pdflatex, the \mathsf{C} is lighter than the \mathsfit{C}. I can send you, e.g., the PDF file, if that would help. – shmuel Jun 04 '18 at 20:25
  • I just spotted a typo. after correcting it I got normal weight for \mathsfit{C}. Thanks. – shmuel Jun 04 '18 at 22:34
  • This does not work anymore when using TeX Live 2020 (tested on overleaf). Apparently \bfdefault changed from bx to b. \bfdefault can be replaced with bx to make this work again in newer versions of TeX Live. – Mr Tsjolder from codidact Feb 23 '21 at 08:47
  • 1
    @MrTsjolder Add \usepackage{fix-cm}, which is a good thing to do anyway. – egreg Feb 23 '21 at 09:46
1

Depending whether you are only seeking text characters, you could use the math \text command:

  \[ \text{\sffamily\itshape  ABC abc}\]

enter image description here

John
  • 2,400
0

In unicode-math, etc. \symsfit. (You might also be able to use \mathsfit, but that will by default get you a text font.) This requires LuaLaTeX or XeLaTeX.

In PDFTeX, isomath will give you a \mathsfit alphabet when passing the option OMLmathsfit, i.e. \usepackage[OMLmathsfit]{isomath}.

Davislor
  • 44,045