7

I need help understanding what is happening in the below example. I am trying to set the font size to 23pts. But it is only changing the size of the font within the \textbf{}. The text that fills the #2 parameter ends up being very small. See the picture for the example.

\begin{minipage}[l]{.08\textwidth}
\includegraphics[width=\textwidth, height=1.25cm]{./images/green_checkmark}
\end{minipage}
\begin{minipage}[c]{.92\textwidth}
\fontsize{23}{28}
%\LARGE
\textcolor{TitleColor}{\textbf{#1} #2} \\
\large
\textcolor{SubTitleColor}{#3}
\end{minipage}

Using \Large

However if I comment out \Large and uncomment \fontsize:

\begin{minipage}[c]{.92\textwidth}
%\fontsize{23}{28}
\LARGE
\textcolor{TitleColor}{\textbf{#1} #2} \\
\large
\textcolor{SubTitleColor}{#3}
\end{minipage}

I get:

enter image description here

Basically, all I want is to be able to set the font size to be something between \LARGE and \huge.

Also, I tried the below without success:

 \textcolor{TitleColor}{\textbf{#1} \fontsize{23}{28}#2} \
7

There are several commands for changing font attributes; there are the lower level ones

\fontencoding
\fontfamily
\fontseries
\fontshape
\fontsize

that are used by higher level commands. Each of these commands changes one attribute (the last one requires two arguments, font size and baselineskip); however they just instruct LaTeX to change the current value of the attribute, without actually selecting it: it would be inefficient for LaTeX to compute a new current font four times with, say

\fontencoding{T1}\fontfamily{cmss}\fontseries{bx}\fontshape{sl}

so the real way to operate is choosing the various attributes and select the font with \selectfont. For instance, the "middle level" command

\usefont{T1}{cmss}{bx}{sl}

is equivalent to

\fontencoding{T1}\fontfamily{cmss}\fontseries{bx}\fontshape{sl}\selectfont

A \fontXYZ command just changes the attribute, but the change remains suspended until \selectfont acts. The same is for \fontsize.

The higher level commands such as \bfseries do essentially something like

\fontseries{bx}\selectfont

while \textbf{text} does

{\bfseries text}

and this explains the problem you get: it's the implicit \bfseries that does \selectfont, but as soon as the closing brace is scanned, the font goes back to the previously selected one.

In conclusion,

\fontsize{23}{32}\selectfont

will do. Remember either to load the fix-cm package or use a fully scalable font.

  • Thank you for the explanation in addition to the answer! – ajon Jul 8 '13 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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