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?

5
  • Is MathJax not working? Sep 21, 2019 at 0:33
  • 1
    \usepackage{pxfonts} may be an improvement. However, maybe you are looking for a sans serif math font. Also try \usepackage{eulervm} Sep 21, 2019 at 0:59
  • 1
    @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? Sep 21, 2019 at 2:01
  • 1
    Search the site for "import" and "font". Answers will follow the lines of tex.stackexchange.com/questions/217986/… Sep 21, 2019 at 11:42
  • ...though I would add that it is generally not visually compatible to mix letters of different fonts in the same context. Sep 21, 2019 at 11:51

1 Answer 1

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

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

You must log in to answer this question.

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