[Tex/LaTex] Custom font sizes inside section titles

errorsfontsizesectioning

I need to change the size of some text within a section title:

\documentclass{article}
\begin{document}
    \section{This text is normal {\Large This text is large}}
\end{document}

This works, however, in some situations, I am using an extra-small font. For example:

\def\Tiny{ \font\Tinyfont = cmr10 at 5pt \relax  \Tinyfont}

When \Tiny is used within the section title, it produces:

Undefined control sequence

  • How can I get the \Tiny letters to appear in the section titles
  • As the section title text is normally larger than regular text, but \Tiny letters also appear throughout the document, how can I ensure that the Tiny text within the section title is proportionally small (i.e. slightly larger than the \Tiny text within the rest of the document).

Best Answer

You may define a very tiny font just like the standard font commands:

\makeatletter
\newcommand*{\Tiny}{\@setfontsize\Tiny{3pt}{4pt}}
\makeatother

This may be used like \Large or \large. I've used 3pt here, because \tiny is already 5pt at article without size option. So:

\documentclass{article}
\makeatletter
\newcommand*{\Tiny}{\@setfontsize\Tiny{5pt}{6pt}}
\makeatother

\begin{document}
\section{This text is normal {\Tiny This text is very tiny}}
\section{This text is normal {\tiny This text is tiny}}
\end{document}

Would show same font sizes.

BTW: Maybe package relsize would also be interesting for you:

\documentclass{article}
\usepackage{relsize}
\begin{document}
\section{This text is normal {\relsize{-4} This text is very tiny}}
\end{document}

This allows to set sizes not absolute but relative.