Site Tools


wiki:texlive-formatting

Table of Contents

TexLive Formatting

Text styling is done with commands like \textbf{bold}, \textit{italic}, \emph{emphasis}, and \underline{underline}. \emph is context-aware—it produces italics normally but upright text inside italicized sections. Font sizes use \tiny, \small, \normalsize, \large, \Large, \LARGE, \huge, \Huge. These are commands without arguments; they affect everything after them until the grouping ends or a new command overrides.

\documentclass{article}
\usepackage{xcolor}
\begin{document}
 
\textbf{Bold text} and \textit{italic text} and \emph{emphasized}.
 
\tiny Tiny text \normalsize back to normal.
 
\textcolor{red}{Red text} and \textcolor{blue}{blue text}.
 
\colorbox{yellow}{Yellow background}
 
\end{document}

Colors require the xcolor package (\usepackage{xcolor}). Use \textcolor{colorname}{text} for colored text or \colorbox{colorname}{text} for background color. Common color names: red, blue, green, orange, purple, black, white, gray, yellow. Define custom colors with \definecolor{mycolor}{rgb}{0.5,0.2,0.8} using RGB values (0-1).

Boxes group text or create visual containers. \fbox{text} draws a box around text. \parbox{width}{text} or \minipage{width}...\end{minipage} constrains text to a width. \framebox{text} is similar to \fbox but with more control.

\fbox{Boxed text}
 
\begin{minipage}{5cm}
This text is constrained to 5cm width and will wrap.
\end{minipage}

Spacing controls whitespace. \\ forces a line break. \vspace{1cm} adds vertical space (10mm, 1in, etc.). \hspace{1cm} adds horizontal space. \vfill fills remaining vertical space on a page; \hfill fills horizontal space. Paragraph spacing is set with \parskip length in the preamble.

First line\\
Second line
 
Some text \hfill Right-aligned text
 
\vspace{2cm}
 
Text after vertical space

Alignment uses environments: \begin{center}...\end{center} centers, \begin{flushleft}...\end{flushleft} left-aligns, \begin{flushright}...\end{flushright} right-aligns. These affect entire paragraphs, not inline text.

wiki/texlive-formatting.md · Last modified: by 127.0.0.1