Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
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"? –  Hendrik Vogt Mar 14 '11 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. –  Martin Scharrer Mar 14 '11 at 18:30
    
@Martin: And what about redefining \/? –  Hendrik Vogt Mar 14 '11 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 Mar 14 '11 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. –  Charles Stewart Mar 15 '11 at 8:11
show 2 more comments

1 Answer 1

up vote 7 down vote accepted

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}
share|improve this answer
    
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. –  Martin Scharrer Mar 15 '11 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! –  Martin Scharrer Mar 26 '11 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. –  Hendrik Vogt Mar 26 '11 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! –  Hendrik Vogt Aug 28 '11 at 9:07
    
@Martin: Thanks - the test failed miserably; if I hadn't asked you to unaccept, I'd have no idea from the dropdown menu that the unaccept was for this answer here. I left comments on that meta.SO post. –  Hendrik Vogt Aug 28 '11 at 9:25
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.