Change font size#
By default, LaTeX provides several command to change the font size to
predefined size. Those command include \scriptsize
, \large
, \Huge
etc.
However, even the font size provided by the \Huge
command may not be large
enough.
In this case, we can use the \fontsize
command to change the font size to
what we want. The signature of \fontsize
command is:
\fontsize{<font_size>}{<baseline_skip>}
The first parameter is the font size and the second parameter is baseline skip. The default font used by LaTeX does not support arbitrary font size, and we have to use another font such as Latin Modern. A minimal example is the follows:
\documentclass{article}
% use the Latin Modern font
\usepackage{lmodern}
\begin{document}
% turn off page numbering
\pagenumbering{gobble}
{\flushleft \fontsize{50}{10}\selectfont 50pt}
{\flushleft \fontsize{100}{10}\selectfont 100pt}
{\flushleft \fontsize{150}{10}\selectfont 150pt}
{\flushleft \fontsize{200}{10}\selectfont 200pt}
\end{document}
In the above code, \selectfont
is used to make the font change take effect.
References#
- Font size not available in LaTex?
- Change font size to arbitrary size in LaTeX.
- Change font size in LaTeX.
- Artitrary font size.
- Font larger than Huge in LaTeX?
- Parameters of \fontsize command.
Produce vertical text#
Sometimes, we want to produce a vertical text line. This can be achieved by
using the \rotatebox
box command provided by the
graphicx package. A small runnable
script is provided below:
% !TEX TS-program = xelatex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
% turn off page numbering
\pagenumbering{gobble}
\rotatebox[origin=c]{90}{\fontsize{50}{5}\selectfont \textbf{Test text.}}
\end{document}
Another way to rotate texts is to use the rotating
package, which provides a
turn
environment to rotate texts to certain angles:
% !TEX TS-program = xelatex
\documentclass{article}
\usepackage{lmodern}
\usepackage{rotating}
\begin{document}
% turn off page numbering
\pagenumbering{gobble}
% rotate the text to 90 degrees counterclockwise
\begin{turn}{90}
\fontsize{50}{5}\selectfont \textbf{Test text.}
\end{turn}
\end{document}