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.

There seems to be a incompatibility between the OT4 font encoding and the tgpagella package. When I load either of the packages, the pound sign comes out as $ (a dangarous thing since we are in a financial crisis already =;-). I have these two packages pre-loaded by a journal file. Can I do anything about this?

\documentclass{article}



\usepackage{tgpagella}
%\usepackage[OT4]{fontenc}

\usepackage[utf8]{inputenc}

\usepackage{textcomp}

\begin{document}


15€ + \$17 = 13£?


\end{document}
share|improve this question
    
why can't you use \usepackage[OT4,T1]{fontenc} ? –  Herbert Sep 20 '12 at 8:39
    
OK. This helps. Thanks! I will suggest this to the journal, because it is their style that has to be changed. –  Stefan Müller Sep 20 '12 at 9:00
    
@StefanMüller OT4 is really an outdated encoding; Polish has full support in the T1 encoding. –  egreg Sep 20 '12 at 9:50
add comment

1 Answer 1

up vote 7 down vote accepted

The OT* font encodings have the problem that the they have 128 slot positions only. There is no place in the OT4 encoding for the sterling. The symbol is supported by a crude hack. The symbols sterling and dollar share the same slot. The italics shape it and a special shape for the upright form ui contains the sterling and the other shapes the dollar:

\DeclareTextCommand{\textdollar}{OT4}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \slshape
   \else
      \upshape
   \fi
   \char`\$\egroup}

\DeclareTextCommand{\textsterling}{OT4}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \itshape
   \else
      \fontshape{ui}\selectfont
   \fi
   \char`\$\egroup}

However, TeX Gyre Pagella does not support this and always uses the dollar sign. The font shape ui is not even defined:

LaTeX Font Warning: Font shape `OT4/qpl/m/ui' undefined
(Font)              using `OT4/qpl/m/n' instead on input line 12.

As solution \textsterling can be redefined for the OT4 encoding to use a different encoding without such trouble:

\DeclareTextCommand{\textsterling}{OT4}{% 
  \begingroup\fontencoding{T1}\selectfont\textsterling}\endgroup
} 

A better solution is to use a better encoding like T1 as suggested by Herbert. This can also be done after the class is loaded:

\documentclass{...}
\usepackage[T1]{fontenc}

Package fontenc is the exception in the package management system of LaTeX. It can be loaded several times with different options.

For the case that some text is still using OT4, I would add the redefinition of \textsterling for OT4 and use a better encoding like T1.

share|improve this answer
add 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.