16

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").

7
  • Can you please give an example of a case where "defining this macro as well to \, seems to add the small space also on other places where it is not wanted"? Commented Mar 14, 2011 at 15:16
  • @Hendrik: I researched this now and apparently \@@italiccorr is placed before and after every \textXX macro, so redefining it to a fixed space is not good. Commented Mar 14, 2011 at 18:30
  • @Martin: And what about redefining \/? Commented Mar 14, 2011 at 18:39
  • 3
    In pdfTeX you can't change the italic correction after a font is loaded. Probably you need to create a virtual font or switch to LuaTeX.
    – Philipp
    Commented Mar 14, 2011 at 22:09
  • 1
    Further to what Philipp says, I understand that in Luatex you can dynamically change the italic correction of each character in a font using the structure described in chapter 7 of the Luatex manual. @Philipp: maybe you'd like to post your comment as an answer? Maybe with a pointer on how to construct virtual fonts: I have no idea on how to do this. Commented Mar 15, 2011 at 8:11

1 Answer 1

8

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}
6
  • Thanks Hendrik! I will test it as soon I have time (busy week). I'm using lmodern for the tt font at the moment to get bold tt in listings, but this shouldn't be a problem. Commented Mar 15, 2011 at 17:33
  • I tested the code now and for most situation it works. I added a test if #1 is f or g which requires some left italic correction. It's not perfect but a suitable workaround. I'm looking forward till they add real italic correction to this font! Commented Mar 26, 2011 at 14:40
  • 1
    @Martin: I'm glad that it works. Just to let you know, TeXnically speaking there's no such thing as "left italic correction"; this is discussed to some extent in this answer of mine and it's first comments. Commented Mar 26, 2011 at 16:46
  • @Martin: Can you please temporarily "unaccept" this answer? It seems that yesterday they implemented something so that I should be notified - I'd love to test this! Commented Aug 28, 2011 at 9:07
  • 1
    @MartinScharrer Two years later the code of Linux Libertine did not improve yet, as far as I know. Could you please post your amended version for f and g and whatever?
    – Keks Dose
    Commented Jul 24, 2013 at 17:10

You must log in to answer this question.

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