Fonts & Character SetsBack to Basics

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
alanq
Posts: 21
Joined: Mon Dec 28, 2009 3:03 am

Back to Basics

Post by alanq »

There's nothing about LaTeX that confuses me more than fonts...

My system:
Ubuntu 10.04,
pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)

I'm typesetting a book.
Originally I made no font specification except

Code: Select all

\documentclass[11pt,a5paper]{book}
Between drafts I was playing with pdfLatex and installed some new fonts.

Now, when I run

Code: Select all

latex book.tex
the 'standard' font in the book is smaller.

Changing to

Code: Select all

\documentclass[12pt,a5paper]{book}
helps a little, but it's still not correct.

I have tried adding

Code: Select all

\usefont{OT1}{cmr}{m}{n}
\selectfont
to the top of my style file, book.sty, but that doesn't help.

Can anyone help dig me out of my hole?
Thank you.
Last edited by alanq on Sun May 29, 2011 1:00 am, edited 2 times 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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Back to Basics

Post by Stefan Kottwitz »

Hi,

do you use the fontenc package? The encoding (T1, OT1) can determine which font version is used. Perhaps post your complete preamble.

Or you had a situation, where you specified T1 encoding but did not have the T1 font installed, so another font would have been used as replacement. If you then install the T1 supporting font package, the font may slightly seem to change by that.

However, it's hard to say what happened if you don't post your code.

Just

Code: Select all

\usefont{OT1}{cmr}{m}{n}
\selectfont
would not be sufficient. Fonts change within text. Font macros such as \familydefault, \rmdefault can be adjusted.

You said you changed book.sty? Do you mean book.cls? I would never change a class file or an external package, only if it's my own package or style file, respectively. Otherwise it would affect other documents and packages as well. I would make redefinitions in my preamble or in my own inputted files or loaded styles.

Stefan
LaTeX.org admin
alanq
Posts: 21
Joined: Mon Dec 28, 2009 3:03 am

Back to Basics

Post by alanq »

Thank you, Stefan (once again)
do you use the fontenc package?
Not yet :)
Or you had a situation, where you specified T1 encoding but did not have the T1 font installed, so another font would have been used as replacement. If you then install the T1 supporting font package, the font may slightly seem to change by that.
There's nothing specifying fonts within the code, only the usual \textsl, \upshape, \emph, etc.
You said you changed book.sty? Do you mean book.cls? I would never change a class file or an external package...
I have a 'main' document called book.tex, and my own style file called plbook.sty (sorry, mistyped before):

book.tex:

Code: Select all

%book.tex

%\documentclass[11pt,a5paper,draft]{book}
\documentclass[11pt,a5paper]{book}

%\usepackage[a5paper]{geometry}
\usepackage{graphicx} % to include postscript graphics
\usepackage{wrapfig} % to allow wrapping of text around figures
\usepackage{color}
\usepackage{titlesec}
\usepackage[utf8]{inputenc} %for UTF8 characters (see plbook.sty)
\usepackage{textcomp}
\usepackage{threeparttable} % to allow for tables with local footnotes
\usepackage{hanging} % for paragraphs with hanging first line (in tables)
\usepackage{xfrac}  % for very nice fractions
\usepackage{caption}  % just to get rid of the caption colon
\usepackage{sidecap}  % to allow side captions on figures
\usepackage{booktabs} % for publication quality tables

\usepackage[a5paper,inner=0.65in,outer=0.35in,top=0.6in,bottom=0.6in]{geometry}

\usepackage{plbook} %Style file specifically for this book

\let\endtitlepage\relax



\begin{document}

\include{titlepage}

\maketitle

\frontmatter
\nocite{*}  % print bibliography entry for all items in database regardless of citation
\include{pubInfo}
\tableofcontents
\textcolor{capcol}{\listoffigures}
%\include{preface}
\include{foreword}
\include{acknowledgements}
\include{introduction}

\mainmatter

\include{chap01}
\include{chap02}
\include{chap03}
\include{chap04}
\include{chap05}
\include{chap06}
\include{chap07}
\include{chap08}
\include{chap09}
\include{chap10}
\include{chap11}
\include{chap12}

\include{appendix}

\backmatter

\bibliography{Bibliography}{}
\bibliographystyle{unsrt}

%\include{aboutTheAuthor}

\end{document} ********End of book.tex
plbook.sty:

Code: Select all

% Style for PL Book
% plbook.sty
% included as usepackage in book.tex

% Separate paragraphs with a top margin rather than an indent
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}

%\setlength{\topmargin}{-0.8in}
\setlength{\headheight}{0.2in}
\setlength{\headsep}{0.3in}
\setlength{\topskip}{0in}
%\setlength{\textheight}{7in}
\setlength{\footskip}{0.35in}

\setlength{\footnotesep}{0.2in}

\clubpenalty=10000
\widowpenalty=10000


% ============
% To make special coloured captions for images, etc.

\definecolor{capcol}{rgb}{0,0,0.5}

\captionsetup{labelsep=space}

\renewcommand{\figurename}{\textcolor{capcol}{Fig.}}
\renewcommand\thefigure{\textcolor{capcol}{\arabic{chapter}.\arabic{figure}}}

% fancy figure captions
\newcommand{\capf}[2][ ]  % optional argument #1 has null default value
{\vspace{0.6ex}\caption[#1]{\slshape \textcolor{capcol}{#2}}}
% ============

% For quoted speech, etc (to match blockquote below)
\newcommand{\qt}[1]{``{\slshape #1}''}

% Short form for superscript
\newcommand{\tss}[1]{\textsuperscript{#1}}

% slanted block quote (to match qt above)
\newenvironment{blockquote}%
{\begin{quote}\slshape}%
{\upshape\end{quote}}

% blockquote attribution to be included INSIDE the blockquote environment
\newcommand{\attrib}[1]{\vspace{1ex} \hfill \upshape #1}

% bold headings
\newcommand{\bh}[1]{\textbf{\large #1}\\[0.8ex]}

% verse
\newcommand{\vs}[1]{\vspace{1ex}\hspace{3em}\parbox[t]{26em}{\textsl{#1}}}

% From package titlesec
%\titlespacing*{ command }{ left }{ beforesep }{ aftersep }[ right ]
%\titlespacing{\chapter}{0}{-20pt}{0}
%\titleformat{ command }[ shape ]{ format }{ label }{ sep }{ before }[ after ]

\hyphenation{Debian high-falutin}
I do now have, didn't notice it before, a font warning:

Code: Select all

LaTeX Font Warning: Size substitutions with differences
(Font)              up to 0.41675pt have occurred.
alanq
Posts: 21
Joined: Mon Dec 28, 2009 3:03 am

Back to Basics

Post by alanq »

Having installed LaTeX and all other required packages on a fresh install of Ubuntu10.04 running in VirtualBox, and discovered that I was getting the same messed-up result, I started through the .tex files with a fine-toothed comb. It didn't take long...

In the book's title verso page (the one with all the copyright, printed by, etc) I had recently put an 'un-protected' \small, i.e. it wasn't inside grouping braces, with obvious consequences. :oops:

Apologies and thank you to Stefan_K (and anyone else) who wasted his time trying to help me.
Post Reply