# Can I declare a new automatic kern for "eV" without modifying font metrics?

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?

• lualatex or xelatex probably, classic tex you'd have to make a vf file with teh extra kern and hence new tfm metric file Dec 29, 2014 at 14:30
• With XeLaTeX there are \XeTeXintercharclass and family. You can search this site for examples. Dec 29, 2014 at 14:30
• Related: tex.stackexchange.com/questions/3602/…. (Presumably, you could define it as a default font feature.)
– cfr
Dec 29, 2014 at 14:32
• 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.) Dec 29, 2014 at 16:17

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

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