11

Short story: why does LaTeX's default math font manage to align the two v subscripts in columns 3 and 4, while the arev math font, shown in the second line, produce separate vertical positions for each of the three v subscripts, dependening on the existence and size of the superscript?

Ok, my real question probably is: How can I achieve "consistent" vertical positioning of subscripts when using the arev math font? I know of manual \phantom-hackery, but I would prefer an automatic (as in preamble-only) solution because my document is rather big.

arev subscript placement VS default math font

\documentclass{article}
\usepackage{arev} % comment out for default font
\usepackage{amsmath}
\begin{document}
$A$, $A_v$, $A^\text{p}_{v}$, $A^\text{s}_{v}$
\end{document}

Long story: to adher to my institution's styleguide, I use the sans-serif font provided by package helvet as my main text font. The closest "matching" math font I could find is arev. Out-of-the-box answers like "why don't you use $pretty-but-unknown-font-package for your math instead?" might actually help me as well.

  • Wait, your institution requires theses to be typeset in sans-serif font? Oh, dear. – Raphael Sep 19 '15 at 17:18
  • Not "require" as in "they won't accept serif", but the CI highly recommends to use the inhouse font (a slightly modified Helvetica) for documents. In my thesis I want to try to adhere to CI as close as possible (i.e. using sans-serif), while still adhering to most best practices I have stumbled upon. After all, I am a typesetting amateur... – ojdo Sep 20 '15 at 11:03
  • Yea, apparently they are, too. Get a typography book, and a copy for him. FWIW, we have a "corporate" design with a Sans Serif font as well; it is intended for advertising brochures, not reasonable pieces of work. I don't know anybody who'd use that design for their thesis. – Raphael Sep 21 '15 at 7:07
9

Maybe you don't know about the sansmathfonts package.

\documentclass{article}
\usepackage{amsmath}

\usepackage{sansmathfonts}
\usepackage[scaled=0.95]{helvet}
\renewcommand{\rmdefault}{\sfdefault}

\begin{document}

Sans serif text

$A$, $A_{v}$, $A^{}_{v}$, $A^{\text{p}}_{v}$, $A^{\text{s}}_{v}$

B $B$; C $C$; F $F$

\end{document}

enter image description here

Not a perfect match, but it can go, if not much math is involved.

  • That font looks even better for my symbol needs, because the relevant symbols are more distinct than in arev math. I'm unsure about the sequence of includes you use. I had to include them in the following order to get text and math in the font I want: \usepackage{sansmathfonts} \usepackage[scaled=0.86]{helvet} \renewcommand{\rmdefault}{\sfdefault} – ojdo Sep 18 '15 at 7:47
  • @ojdo Probably your order is better, I didn't check really well. I'll fix – egreg Sep 18 '15 at 7:58
7

It would appear that the arev font package stores some incorrect math-mode font metrics. If you're stuck with the arev package, for inline-style math material you will need to write $A^{\smash{\text{p}}}_{v}$ instead of $A^{\text{p}}_{v}$.

Interestingly, the \smash instruction turns out to be unnecessary if display-style math is in use.

In some non-exhaustive testing, I've found that all five characters that contain a descender -- g, j, p, q, and y -- share this problem when placed in the superscript position when TeX is in inline math mode. So far, I've found no other characters that generate this particular problem. This does strengthen my belief that some of the math-mode font metrics of the arev package are messed up.

enter image description here

\documentclass{article}
\usepackage{arev}
\usepackage{amsmath}
\begin{document}

\verb+inline-style math:+

$A$ $A_v$ $A_v^{}$ $A^{\text{p}}_{v}$ $A^{\smash{\text{p}}}_{v}$ $A^{\text{s}}_v$


\bigskip
\everymath{\displaystyle}
\verb+display-style math:+

$A$ $A_v$ $A_v^{}$ $A^{\text{p}}_{v}$ $A^{\smash{\text{p}}}_{v}$ $A^{\text{s}}_v$

\end{document}
  • Thourough analysis, thank you! I will use that as an immediate remedy for my existing documents that don't justify a complete face lift. – ojdo Sep 18 '15 at 7:45
5

You can change the responsable fontdimens -- they are described in chapter 18 of the texbook and in the appendix G. I used exaggerated values in the example, it is up to you to find the ones that suits you best. The difference Mico shows for display math and inline math is due to the fact, that in display math superscripts are normally a bit higher and so push subscripts less. \fontdimen13 and \fontdimen15 are here relevant.

\documentclass{article}
\usepackage{arev} % comment out for default font
\usepackage{amsmath}
\begin{document}

$A$, $A_v$, $A^\text{p}_{v}$, $A^\text{s}_{v}$

\medskip
\fontdimen16\textfont2=6pt
\fontdimen17\textfont2=6pt
\fontdimen14\textfont2=6pt %superscript up
$A$, $A_v$, $A^\text{p}_{v}$, $A^\text{s}_{v}$
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.