3

I'm aware this may be related to that question I asked before:

Space too small before word-starting subscripted symbol (LuaLaTeX only)

But since things have been moving lately, such as the recent introduction of mathitalicsmode=2, I thought I got nothing to lose asking.

Is there any way to automatically adjust the horizontal space after an italicized string, for example here?

% !TEX TS-program = lualatex


\documentclass{article}

\begin{document}
    
X\textsubscript{2}

\textit{X}\textsubscript{2}

\end{document}

enter image description here

2
  • Math mode has nothing to do with this. It's \textit that adds the italic correction. Use \textit{X\nocorr}\textsubscript{2}
    – egreg
    Feb 24 at 22:19
  • 1
    @egreg sigh I should have remembered \nocorr, I guess you could add \textsuperscript to \nocorrlist if you have a lot of these Feb 24 at 22:57

1 Answer 1

2

LuaLaTeX has nothing to do with this. It's \textit that adds the italic correction based on a simple heuristic: if what follows appears in \nocorrlist, then the italic correction is not added.

One can also manually add \nocorr as the trailing token:

\documentclass{article}

\begin{document}

X\textsubscript{2}

\textit{X}\textsubscript{2}

\textit{X\nocorr}\textsubscript{2}

\end{document}

enter image description here

You can add \textsubscript to the list, if you have several instances.

\documentclass{article}

\makeatletter
\g@addto@macro\nocorrlist{\textsubscript}
\makeatother

\begin{document}

X\textsubscript{2}

\textit{X}\textsubscript{2}

\textit{X\nocorr}\textsubscript{2}

\end{document}

enter image description here

I left \nocorr, just for comparison.

0

You must log in to answer this question.

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