# Is there a font where lower-case $x$ and $z$ look more like $X$ and $Z$, and how do I switch all my equations to have that font?

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?

• Is MathJax not working? – user1271772 Sep 21 at 0:33
• \usepackage{pxfonts} may be an improvement. However, maybe you are looking for a sans serif math font. Also try \usepackage{eulervm} – Steven B. Segletes Sep 21 at 0:59
• @StevenB.Segletes: What if I only want the x and z to be non-Italics in mathmode, but the rest of the letters I don't want to make any changes to? – user1271772 Sep 21 at 2:01
• Search the site for "import" and "font". Answers will follow the lines of tex.stackexchange.com/questions/217986/… – Steven B. Segletes Sep 21 at 11:42
• ...though I would add that it is generally not visually compatible to mix letters of different fonts in the same context. – Steven B. Segletes Sep 21 at 11:51

## 1 Answer

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}


• What a beautiful (and simple!) solution. I have accepted the answer! How did you know about this easy solution? – user1271772 Sep 24 at 17:52
• @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 at 0:50
• I would not have known to even start where you started, so thank you so much!!! – user1271772 Sep 25 at 1:19