0

I'm trying to use typographical conventions to distinguish between several different types of mathematical entities. The C in the default math font looks very close to the C in \mathcal. My first thought was to use sans-serif, but the results look ugly. I tried using \mathscr from mathrsfs, but $\mathscr C$ and $\bm{\mathscr{C}}$ look almost identical. Requiring xelatex is not an option, but I can use euler instead of mathrsfs if that would help, as long a E and C are readily distinguishable from their rendition in the default math font and as long as normal weight script is readily distinguishable from bold script.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{mathrsfs} 

\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{\mathsfbdit}{T1}{\sfdefault}{\bfdefault}{\itdefault}
\SetMathAlphabet{\mathsfbdit}{bold}{T1}{\sfdefault}{\bfdefault}{\itdefault}

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

\DeclareMathAlphabet{\mathsfsl}{T1}{\sfdefault}{}{\sldefault}
\SetMathAlphabet{\mathsfsl}{normal}{T1}{\sfdefault}{}{\sldefault}

\begin{document}

 $C$ default

 $\mathit C$ mathit

 $\mathcal C$ mathcal

 $\mathscr C$ mathscr

 $\mathsf{C}$ mathsf

$\mathsfbd{C}$ mathsfbd

$\mathsfbdit{C}$ mathsfbdit

$\mathsfit{C}$ mathsfit

$\mathsfsl{C}$ mathsfsl

 $\bm C$ bm default

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

 $\bm{\mathscr{C}}$ bm mathscr

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

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

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

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

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

\end{document}
1
  • There is no bold version for \mathscr, so \mathscr{C} and \bm{\mathscr{C}} don't look very close, they are the same.
    – egreg
    Jun 5, 2018 at 20:33

3 Answers 3

4

You could try stix, that has a wide range of alphabets:

enter image description here

\documentclass{article}

\usepackage{stix}

\begin{document}

$
C+
\mathit{C}+
\mathcal{C}+
\mathscr{C}+
\mathrm{C}+
\mathsf{C}+
\mathfrak{C}+
\mathbfscr{C}+
\mathbfit{C}
$

\end{document}
2
  • Doesn't stix require xetex or the equivalent? I have to be able to submit to organizations that compile using pdflatex.
    – shmuel
    Jun 5, 2018 at 21:17
  • @shmuel the above image was generated via pdftex from the posted code Jun 5, 2018 at 21:29
2

There is no need to define several of the fonts you have. For the script font you can use STIX.

By the way, no argument to \DeclareMathAlphabet or \SetMathAlphabet should be empty.

\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}

\DeclareMathAlphabet{\mathsfit}{T1}{\sfdefault}{m}{sl}
\SetMathAlphabet{\mathsfit}{bold}{T1}{\sfdefault}{bx}{sl}

\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareMathAlphabet{\mathscr}{LS1}{stixscr}{m}{n}
\SetMathAlphabet{\mathscr}{bold}{LS1}{stixscr}{b}{n}

\begin{document}

$CE$ default

$\bm{C}\bm{E}$ default bold

$\mathit{C}\mathit{E}$ mathit

$\bm{\mathit{C}}\bm{\mathit{E}}$ mathit bold

$\mathcal{C}\mathcal{E}$ mathcal

$\bm{\mathcal{C}}\bm{\mathcal{E}}$ mathcal bold

$\mathscr{C}\mathscr{E}$ mathscr

$\bm{\mathscr{C}}\bm{\mathscr{E}}$ mathscr bold

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

$\bm{\mathsf{C}}\bm{\mathsf{E}}$ mathsf bold

$\mathsfit{C}\mathsfit{E}$ mathsfit

$\bm{\mathsfit{C}}\bm{\mathsfit{E}}$ mathsfit bold

\end{document}

If you don't want to type \bm each time, just define

\newcommand{\mathsfbdit}[1]{\bm{\mathsfit{#1}}}

enter image description here

5
  • Doesn't stix require xetex or the equivalent? What is the parameter to \DeclareMathAlphabet and \SetMathAlphabet for normal weight?
    – shmuel
    Jun 5, 2018 at 21:19
  • @shmuel No, the STIX fonts are also available for pdflatex, as you can see by testing the example. Normal weight is m (or \mddefault).
    – egreg
    Jun 5, 2018 at 21:44
  • I just tried stix with my main docuent and got "! LaTeX Error: Too many symbol fonts declared.". I removed amssymb but still got "! LaTeX Error: Too many math alphabets used in version normal." Using the [notext] option lso didn't help. Works fine with XeTeX, but I have to send the file to places that use pdfLaTeX.
    – shmuel
    Jun 6, 2018 at 18:45
  • When I use stix in my real document I get error messages from pdfLaTeX, e.g. ! LaTeX Error: Too many math alphabets used in version normal., although I can compile with XeLaTeX. I tried using \usepackage{stix}[notext,not1], but that doesn't change anything. If I move stix before amsmath, as the stix documentation recommends, then I get ! LaTeX Error: Too many symbol fonts declared.even with XeTeX.
    – shmuel
    Jun 6, 2018 at 19:03
  • @shmuel That may happen with all the declarations you seem to be doing.
    – egreg
    Jun 6, 2018 at 20:10
0

It turns out that while stix won't work, stix2 will:

\documentclass{article}
\usepackage{stix2}[notext,not1]
\usepackage{amsmath}
%\usepackage{amssymb}
\usepackage{bm}
%\usepackage{mathrsfs}

\usepackage[colorlinks,hidelinks]{hyperref}
\usepackage{cleveref}
\usepackage{showlabels}
\showlabels{cite}
\showlabels{cref}
\showlabels{crefrange}

\begin{document}

$E C$ default

$\mathbb{E C}$ mathbb

$\mathbf{E C}$ mathbf

$\mathcal{E C}$ mathcal

$\mathfrak{E C}$ mathfrak

$\mathit{E C}$ mathit

$\mathrm{E C}$ mathrm

$\mathscr{E C}$ mathscr

$\bm{E C}$ bm default

$\bm{\mathbb{E C}}$ bm mathbb

$\bm{\mathbf{E C}}$ bm mathbf

$\bm{\mathfrak{E C}}$ bm mathfrak

$\bm{\mathit{E C}}$ bm mathit

$\bm{\mathrm{E C}}$ bm mathrm

$\bm{\mathscr{E C}}$ bm mathscr

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

$\pmb{E C}$ pmb default

$\pmb{\mathbb{E C}}$ pmb mathbb

$\pmb{\mathbf{E C}}$ pmb mathbf

$\pmb{\mathcal{E C}}$ pmb mathcal

$\pmb{\mathfrak{E C}}$ pmb mathfrak

$\pmb{\mathscr{E C}}$ pmb mathscr

$\cdot$ cdot

$\circ$ circ

$\odot$ odot

$\mathbin{\cdot}$ mathbin cdot

$\mathbin{\circ}$ mathbin circ

$\mathbin{\odot}$ mathbin odot

\end{document}

BTW, although the stix documentation says to put stix before amsmath, that generates an error message; with stix2, the documented placement works fine.

You must log in to answer this question.

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