2

I like $X$ and $Z$ more than $x$ and $z$. The lower case versions are too fancy (too many curves, whereas the $X$ and $X$ have lines that are more "straight"). Is there a font where the lower case $x$ and $z$ are just smaller versions of the straight-line containing $X$ and $Z$? How do I change my LaTeX preamble so that all math mode occurrences of $x$ and $z$ use that font, but the rest of the alphabet remains the same?

For example, \mathrm{x} and \mathrm{z} look fine to me. Is there a way to make all occurrences of x and z in math-mode, to look like \mathrm{x} and \mathrm{z}, while allowing the rest of the alphabet to be unaffected?

user1271772
  • 594
  • 6
  • 26

1 Answers1

5

The default fonts are defined in fontmath.ltx.

The relevant lines for x and z are:

\DeclareSymbolFont{letters}     {OML}{cmm} {m}{it}
\DeclareMathSymbol{x}{\mathalpha}{letters}{`x}
\DeclareMathSymbol{z}{\mathalpha}{letters}{`z}

So x and z will be set in cmmi. We could instead use the slanted variant of cmr just for these characters:

\DeclareSymbolFont{lettersslanted}{OT1}{cmr}{m}{sl}
\DeclareMathSymbol{x}{\mathalpha}{lettersslanted}{`x}
\DeclareMathSymbol{z}{\mathalpha}{lettersslanted}{`z}

MWE

\documentclass{article}
\DeclareSymbolFont{lettersslanted}{OT1}{cmr}{m}{sl}
\DeclareMathSymbol{x}{\mathalpha}{lettersslanted}{`x}
\DeclareMathSymbol{z}{\mathalpha}{lettersslanted}{`z}
\begin{document}
$xyz$

$XYZ$
\end{document}

MWE output

David Purton
  • 25,884
  • What a beautiful (and simple!) solution. I have accepted the answer! How did you know about this easy solution? – user1271772 Sep 24 '19 at 17:52
  • 2
    @user1271772, I didn't actually. But I figured that it must be possible because there are packages that change the maths font. I looked through the style file of one of these to see how it was done. Then used grep to search through my TeX tree to find the defaults and modified to suit. – David Purton Sep 25 '19 at 00:50
  • 1
    I would not have known to even start where you started, so thank you so much!!! – user1271772 Sep 25 '19 at 01:19