10

The "eV" (electronvolt) unit and its variants ("MeV", "GeV", "TeV", ...) are heavily used in nuclear and particle physics. By default Computer Modern and other common TeX fonts do not contain a pre-defined kern to pull the "e" and "V" closer together, presumably because that combination never occurs in "normal" written language.

While the amount of required kern is font-specific, and of course one can define \eV etc. macros for use within a specific font, many physicists don't do so and hence end up with rather ugly units in their documents. Even the siunitx package does not define its "eV" units with a negative kern (because of the font-specificity).

To make the problem less visible, while not solving it perfectly for every font, I wonder if it is possible to define a default e-V-negative-kern in a LaTeX style/class/preamble, so that documents written within a standard template will "automatically" acquire a better-than-default eV kern without the user needing to modify font metrics? Maybe in LuaTeX?

Ruben
  • 13,448
andybuckley
  • 1,168
  • 1
  • 10
  • 15
  • lualatex or xelatex probably, classic tex you'd have to make a vf file with teh extra kern and hence new tfm metric file – David Carlisle Dec 29 '14 at 14:30
  • With XeLaTeX there are \XeTeXintercharclass and family. You can search this site for examples. – Manuel Dec 29 '14 at 14:30
  • 1
    Related: http://tex.stackexchange.com/questions/3602/an-example-of-changing-kerning-of-a-font-in-lualatex?rq=1. (Presumably, you could define it as a default font feature.) – cfr Dec 29 '14 at 14:32
  • 2
    As you've noted in the question, this is font-specific and so a general solution in the preamble simply isn't viable. Even with pdfTeX one could approach is by defining \eV as a macro to expand to e\kern <some amount>V or using siunitx as a unit with the same set up. (Indeed, that's more-or-less what I'd expect people to do with siunitx: as it's a design judgement I'm very wary of providing defaults or trying to pick up even a subset of fonts, though that is doable.) – Joseph Wright Dec 29 '14 at 16:17

1 Answers1

10

This works in text mode

\XeTeXinterchartokenstate=1

\newXeTeXintercharclass \eclass
\newXeTeXintercharclass \Vclass

\XeTeXcharclass `\e \eclass
\XeTeXcharclass `\V \Vclass

\XeTeXinterchartoks \eclass \Vclass = {\kern-.15em}

and this for siunitx \eV unit

\DeclareSIUnit\electronvolt{e\kern-.15em V}

MWE (compile with XeLaTeX)

\documentclass{article}


\usepackage{fontspec}

\XeTeXinterchartokenstate=1

\newXeTeXintercharclass \eclass
\newXeTeXintercharclass \Vclass

\XeTeXcharclass `\e \eclass
\XeTeXcharclass `\V \Vclass

\XeTeXinterchartoks \eclass \Vclass = {\kern-.15em}


\usepackage{siunitx}

\DeclareSIUnit\electronvolt{e\kern-.15em V}

\begin{document}

eV  

\SI{1}{\eV}

\end{document} 

Output

enter image description here

karlkoeller
  • 124,410
  • Do not use absolute glue, use a relative one, eg \kern-0.08em. Then it doesn't depend on the current font size –  Dec 29 '14 at 17:15