Text FormattingIncreased tracking for small letter sizes

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
nvx
Posts: 25
Joined: Mon Dec 17, 2007 7:49 pm

Increased tracking for small letter sizes

Post by nvx »

Readability suffers in case of text typeset in smaller letters (figure captions, headers, etc.). I know how to change leading, but I've been wondering if there is a way to increase letter tracking as well.

Any hints/tips, anyone? :)

TIA,
nvx
Last edited by nvx on Wed Apr 06, 2011 9:23 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

Increased tracking for small letter sizes

Post by 5gon12eder »

The soul package offers you a flexible way to achieve this.
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
nvx
Posts: 25
Joined: Mon Dec 17, 2007 7:49 pm

Increased tracking for small letter sizes

Post by nvx »

Dear 5gon12eder,

Thank you very much for your response. However, although the package works great when used directly in a figure header or in a plain paragraph, it refuses to help me in headers.

I use fancyhdr to define my own page headers. To get them I add the following to the document code:

Code: Select all

% Initial fancyhdr declarations here...
\fancyhead[LE]{\small{\textbf{\thepage}}\quad\small{\textsc{\nouppercase{\leftmark}}}}
\fancyhead[RO]{\small{\nouppercase{\rightmark}}\quad\small{\textbf{\thepage}}}
% The rest of fancyhdr declarations here...
When I try to typeset \leftmark using \caps{} (small capitals with increased letter spacing) provided by the soul package, i.e. by

Code: Select all

\fancyhead[LE]{\small{\textbf{\thepage}}\quad\small{\caps{\nouppercase{\leftmark}}}}
something nasty happens -- I get too many errors and PDFLaTeX compiler gives up. If I leave only the bare minimum in the LE header, i.e.,

Code: Select all

\fancyhead[LE]{\caps{\leftmark}}
I get an incomplete PDF (large parts of text are missing) and in the LE header (which is typeset normally without any additional letter spacing) there is a black square. According to the soul manual, black square denotes a 'Reconstruction failed' error which can be got rid of only by enclosing the input in an \mbox{} (or \hbox{}). Sadly, such an action results in letter spacing NOT being increased. :(

I also tried to use e.g. \so{\leftmark} in the code above (lowercase letters & increased letter spacing), but the result was the same.

Am I missing something obvious? I'd really like the letter spacing to be increased in case of text typeset in smaller letter sizes so that it is easily readable (and also more pleasing to the eye :) ).

nvx
nvx
Posts: 25
Joined: Mon Dec 17, 2007 7:49 pm

Increased tracking for small letter sizes

Post by nvx »

It seems that the problem is sorted out (package called microtype did the trick -- in fact a lot of other tricks as well).

However, another problem popped up: even though the resulting PDF looks fine, I now get lots of babel errors saying

Code: Select all

! Package babel Error: You haven't defined the language ENGLISH yet.
I suspect this is related to the fact that microtype tries to set some parameters according to the currently selected language. Nevertheless, the language is set at the very top of the preamble (third line of the code). :?

What am I missing now? :(

Any help would be much appreciated.

nvx
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: Increased tracking for small letter sizes

Post by meho_r »

This happens often if you change language for the document. Just try deleting aux files and compile the document again.
nvx
Posts: 25
Joined: Mon Dec 17, 2007 7:49 pm

Re: Increased tracking for small letter sizes

Post by nvx »

Dear meho_r,

Thank you for the tip, but unfortunately deleting AUX files does not help. Careful inspection of the log file revealed that the error occurs when a figure or a longtable is inserted. I am not sure what this fact really means but maybe it will mean something to someone else... ;)

Best regards,
nvx
nvx
Posts: 25
Joined: Mon Dec 17, 2007 7:49 pm

Increased tracking for small letter sizes

Post by nvx »

Well, I've been digging around to see what may be wrong with my LaTeX code and this is what I came up with: the problem is caused by \MakeUppercase in the header definition. The explanation can be found at http://www.michaelshell.org/tex/ieeetran/ in the section called Q: I am trying to use the babel package with IEEEtran.cls, but I am getting an error like "! Package babel Error: You haven't defined the language ENGLISH yet." What is wrong?:
... it [also] happens with other classes that need to set the header text to uppercase. This causes babel to think that the language settings the header text requires is "ENGLISH", which is not the same thing as "english", only the latter of which is properly recognized. There are two ways to get around this problem.
Nevertheless, the first proposed workaround, i.e,

Code: Select all

\makeatletter
\def\markboth#1#2{\def\leftmark{\@IEEEcompsoconly{\sffamily}\MakeUppercase{\protect#1}}%
\def\rightmark{\@IEEEcompsoconly{\sffamily}\MakeUppercase{\protect#2}}}
\makeatother
doesn't work with the IEEE specific stuff (duh!) and messes up my headers (right mark is missing) when I remove it and end up with the following code:

Code: Select all

\makeatletter
\def\markboth#1#2{\def\leftmark{\protect#1}%
\def\rightmark{\protect#2}}
\makeatother
(Frankly, I do not understand TeX code too well yet so I don't know exactly what it is supposed to do.) The second proposed workaround (i.e., renewing \leftmark and \rightmark instead of using \markboth) isn't much better either, because when I defined a new command

Code: Select all

\newcommand{\changerunningheads}[2]{
  \renewcommand{\leftmark}{#1}
  \renewcommand{\rightmark}{#2}
}
to be used instead of \markboth, it caused an equivalent havoc (mixed running heads etc.). I have no idea why.

Adding "\protect" to the relevant part of my definition of running head, i.e.,

Code: Select all

\fancyhead[LE]{\small{\textbf{\thepage}}\quad%
\textls*[50]{\MakeUppercase{\small{\leftmark}}}}
makes no sense since it would not get converted to uppercase. (Note: "\textls*[50]" is a command from the microtype package defining custom tracking.)

This is driving me nuts. :-/ Just out of curiosity, would it be possible to define an alias for a language? I mean, tell LaTeX that language "ENGLISH" is the same as "english". I guess it might solve the problem.

nvx
Post Reply