[Tex/LaTex] Italic Correction for Linux Libertine Font

fontsitalic-correctionlibertinespacing

I was looking for a new font for the manuals of my LaTeX packages and found the Linux Libertine most pleasing. However it seems that it doesn't support italic correction (yet).

I assume that a font normally defines the correct italic correction for every character, but I would settle if any extra amount would be added after italic text. At the moment a text used in \meta{...} hits the closing angle symbol because of the missing italic correction:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\begin{document}
(\textit{X})

\def\metastyle{\textit}
\def\meta#1{{\metastyle {\ensuremath \langle #1\/\ensuremath \rangle }}}
\meta{X}
\end{document}

I had the idea of the very quick and very dirty trick \let\/\, which works in this case, but not for general \textit{...} uses. (\/ is for explicit italic correction and \, adds a small space, IIRC half a normal space)

Checking the definition of \textit revealed that it finally uses \@@italiccorr which is let to the original \/ primitive.
Defining this macro as well to \, seems to add the small space also on other places where it is not wanted.

Is there a better way to get some decent italic correction for this font? It doesn't have to be perfect, just better then the current one (i.e. literally "better than nothing").

Best Answer

You can try it with hacking into LaTeX's \check@nocorr@. Remove the left correction and \let the italic correction to \, (or another suitable amount). This may have issues, but for your code it works. I have assumed that you use Linux Libertine throughout your document; otherwise you'll have to make the hack local.

Before:        After: 

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\makeatletter
\def \check@nocorr@ #1#2\nocorr#3\@nil {%
  \let \check@icl \@empty                    %%% removed left correction
  \def \check@icr {\ifvmode \else \aftergroup \maybe@ic \fi}%
  \def \reserved@a {\nocorr}%
  \def \reserved@b {#1}%
  \def \reserved@c {#3}%
  \ifx \reserved@a \reserved@b
    \ifx \reserved@c \@empty
      \let \check@icl \@empty
    \else
      \let \check@icl \@empty
      \let \check@icr \@empty
    \fi
  \else
    \ifx \reserved@c \@empty
    \else
      \let \check@icr \@empty
    \fi
  \fi
}
\let\/\,
\let\@@italiccorr\/
\makeatother
\begin{document}
(\textit{X})

\def\metastyle{\textit}
\def\meta#1{{\metastyle {\ensuremath \langle #1\/\ensuremath \rangle }}}
\meta{X}
\end{document}
Related Question