Use this file to discover all available pages before exploring further.
Beyond the basics of bold and italic, LaTeX offers extensive text formatting capabilities. This guide covers font sizes, families, shapes, colors, and advanced formatting options.
\documentclass{article}\begin{document}{\tiny This is tiny text}\\{\scriptsize This is scriptsize text}\\{\footnotesize This is footnotesize text}\\{\small This is small text}\\{\normalsize This is normalsize text}\\{\large This is large text}\\{\Large This is Large text}\\{\LARGE This is LARGE text}\\{\huge This is huge text}\\{\Huge This is Huge text}\end{document}
% Inline usageThis is {\large important} text.% Block usage{\LargeThis entire paragraph is in Large size.All text here maintains the same size.}% Environment usage\begin{large}Everything in this environment is large.\end{large}
\documentclass{article}\begin{document}% Roman (serif) - default\textrm{This is Roman text (serif)}% Sans serif\textsf{This is Sans Serif text}% Typewriter (monospace)\texttt{This is Typewriter text}% Combining with other formatting\textsf{\textbf{Bold Sans Serif}}\texttt{\textit{Italic Typewriter}}\end{document}
% Make sans serif the default\renewcommand{\familydefault}{\sfdefault}% Make typewriter the default\renewcommand{\familydefault}{\ttdefault}% Return to roman (default)\renewcommand{\familydefault}{\rmdefault}
\documentclass{article}\usepackage{xcolor}\begin{document}% Basic colors\textcolor{red}{Red text}\textcolor{blue}{Blue text}\textcolor{green}{Green text}% Define custom colors\definecolor{myorange}{RGB}{255,96,55}\definecolor{darkblue}{HTML}{003366}\definecolor{lightgray}{gray}{0.8}% Use custom colors\textcolor{myorange}{LaTeX Cloud Studio orange}\textcolor{darkblue}{Dark blue text}\textcolor{lightgray}{Light gray text}% Background colors\colorbox{yellow}{Highlighted text}\colorbox{myorange}{\textcolor{white}{White on orange}}% Colored box with frame\fcolorbox{red}{yellow}{Text in box}\end{document}
\documentclass{article}\begin{document}% Left aligned (default)\begin{flushleft}This text is aligned to the left edge.Multiple lines maintain left alignment.\end{flushleft}% Centered\begin{center}This text is centered.\\Each line is individually centered.\end{center}% Right aligned\begin{flushright}This text is aligned to the right edge.\\All lines align to the right margin.\end{flushright}% Justified (default for normal text)This is justified text, which is the default in LaTeX. The text is aligned to both left and right margins, with spacing adjusted between words.% Ragged right (unjustified)\raggedrightThis text has a ragged right edge. Lines break naturally without justification.\end{document}
\documentclass{article}\usepackage{soul}\begin{document}% Highlighting\hl{Highlighted text}% Letter spacing\so{S p a c e d o u t}% Caps with spacing\caps{SPACED CAPITALS}% Strike out\st{Struck through text}% Underline with soul\ul{Underlined with soul package}\end{document}
\documentclass{article}\usepackage{xcolor}\usepackage{tcolorbox}\begin{document}% Simple box\fbox{Text in a box}% Box with padding\fbox{\parbox{0.8\textwidth}{This is a longer text in a box with controlled width.}}% Colored boxes with tcolorbox\begin{tcolorbox}[colback=blue!5,colframe=blue!75!black]This is text in a fancy colored box.\end{tcolorbox}\begin{tcolorbox}[colback=red!5,colframe=red!75!black,title=Warning]This box has a title and custom colors.\end{tcolorbox}\end{document}
\documentclass{article}\usepackage{rotating}\begin{document}Normal text \rotatebox{90}{Rotated 90°} more text\begin{turn}{45}This entire block is rotated 45 degrees\end{turn}% Sideways text\begin{sideways}This text appears sideways\end{sideways}\end{document}
\documentclass{article}\usepackage{xcolor}% Define custom commands\newcommand{\keyword}[1]{\textbf{\textcolor{blue}{#1}}}\newcommand{\important}[1]{\textcolor{red}{\textbf{#1}}}\newcommand{\code}[1]{\texttt{\colorbox{gray!20}{#1}}}\newcommand{\term}[1]{\textit{#1}}\begin{document}The \keyword{function} keyword declares a new function.\important{Warning:} This action cannot be undone.Use the \code{print()} function to display output.The \term{algorithm} processes data efficiently.\end{document}