Contents

Writing in LaTeX

LaTeX\LaTeX gives you a lot of control over how text appears in a document: font family, weight, shape, size, color, boxed text, and even rotated text. These features are useful when you want cleaner and more expressive document formatting.

Text in LaTeX\LaTeX is usually described through five main attributes:

  1. Encoding: how characters are represented.
  2. Family: roman, sans serif, or typewriter.
  3. Series: weight such as normal or bold.
  4. Shape: upright, italic, slanted, or small caps.
  5. Size: from \tiny up to \Huge.

Most text styles in LaTeX\LaTeX can be written in two forms:

  • command form, for example \textbf{text},
  • declaration form, for example {\bfseries text}.

Common examples:

StyleCommandDeclaration
roman\textrm{roman}{\rmfamily roman}
sans serif\textsf{sans serif}{\sffamily sans serif}
typewriter\texttt{typewriter}{\ttfamily typewriter}
medium\textmd{medium}{\mdseries medium}
boldface\textbf{boldface}{\bfseries boldface}
upright\textup{upright}{\upshape upright}
italic\textit{italic}{\itshape italic}
slanted\textsl{slanted}{\slshape slanted}
small caps\textsc{small caps}{\scshape small caps}

Example output for font family and shape settings:

[

Example of font settings in LaTeX
Example of font settings in LaTeX
](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmxLwOWwNQ1HOzz9bI8ODjUda3YM_ecRCXxtU5J9VaLDMiXcv7mQ0YVu-YWi9pq8HbW_Sm0SMrlQWnP8NBMVE6oap_WPbp8eELI2xajxZqLI0bX4fWsmi_Th3F98rG_zS8WNof9x6BW60/s994/font1.png)

By default, a basic TeX\TeX document often uses 10pt text. You can change the size with these commands:

\tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge, \Huge

Example of size variations:

[

Example of font sizes in LaTeX
Example of font sizes in LaTeX
](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVVjUY21nRJIHFyi0ykvG32IlAcwyiEsUgQpscKgJ2AvLOfuPOkivm2M_YDwOqoczIbe5l03dqyHSETB7ZDeqahh8xE2W1gxzUvCPwlFmhuVPDMiK6G2VKPWqE1tYxUeMjN_xN4JMnOkA/s1126/font2.png)

To color text, you can use either of these forms:

{\color{blue} Colored text}

or

\textcolor{blue}{Colored text}

This usually requires the xcolor package in the preamble.

To place text on a colored background, use \colorbox.

\colorbox{yellow}{Text with colored background}

If you also want to change the text color:

\colorbox{yellow}{\color{red}Colored text on a background}

To put text inside a simple box:

\fbox{Text inside a box}

To create a colored box:

\fcolorbox{black}{yellow}{Text inside a colored box}

This also relies on the xcolor package.

To rotate text, use \rotatebox from the graphicx package.

\rotatebox{45}{Rotated text}

Example output for colored text, boxed text, and rotated text:

[

Example of color and rotated text in LaTeX
Example of color and rotated text in LaTeX
](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4oKHBloZSD_wKQ0NBvzV040o2kpUHnPNQV6NNcJSGYOA7OJgS2DBNcosF_ZGkkjZpb83EmL2xIgQrv2cvwCP0fgT6RRxCpq-IW3d5_NISBv_RRkXQUqKcrp-ONBJxWX7vPePorXiM1Ug/s1214/font3.png)

Typography control in LaTeX\LaTeX is rich enough for both standard documents and more styled layouts. Once you understand font family, size, color, boxed text, and rotation, it becomes much easier to produce documents that look clear and polished.

Related Content