examples

Bold, italics and underlining

set of examples

The following example collects the various code fragments contained in this article so that you can open them all together in Overleaf.

First example, bold, italics and underline:

Some of the \textbf{greatest} discoveries in \underline{science} were made by \textbf{\emph{accident}}.

\vspace{1.5cm}

Example of italicized text:

Some of the greatest discoveries in science were made by \emph{accident}.

\vspace{1.5cm}

Example of boldface text:

Some of the \textbf{greatest} discoveries in science were made by accident.

\vspace{1.5cm}

Example of underlined text:

Some of the greatest discoveries in \underline{science} were made by accident.

\vspace{1.5cm}

Example of emphasized text in different contexts:

Some of the greatest \emph{discoveries} in science were made by accident.

\textit{Some of the greatest \emph{discoveries} in science were made by accident.}

\textbf{Some of the greatest \emph{discoveries} in science were made by accident.}

Font sizes, families, and styles

set of examples

\documentclass{article}
\begin{document}
%Example of different font sizes and types
This is a simple example, {\tiny this will show different font sizes} and also \textsc{different font styles}.

\vspace{1cm}

%Example of different font sizes and types
In this example the {\huge huge font size} is set and the {\footnotesize Foot note size also}. There's a fairly large set of font sizes.

\vspace{1cm}

%Example of different font sizes and types
In this example, a command and a switch are used. \texttt{A command is used to change the style of a sentence}.

\sffamily
A switch changes the style from this point to the end of the document unless another switch is used.
\rmfamily

\vspace{1cm}

%Example of different font sizes and types
Part of this text is written \textsl{in different font style} to highlight it.
\end{document}

Font typefaces

set of examples

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tgbonum}

\begin{document}
This document is a sample document to
test font families and font typefaces.

{\fontfamily{qcr}\selectfont
This text uses a different font typeface
}
\end{document}

Paragraph formatting

set of examples

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\setlength{\parindent}{4em}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{2.0}

\begin{document}
This is the first paragraph, contains some text to test the paragraph
interlining, paragraph indentation and some other features. Also, is
easy to see how new paragraphs are defined by simply entering a double
blank space.

Hello,  here  is  some  text  without  a  meaning.   This  text  should
show what a printed text will look like at this...



\end{document}

Line breaks and blank spaces

set of examples

\begin{document}
Something in this document. This paragraph contains no information and
its purposes is to provide an example on how to insert white spaces
and lines breaks.\\
When a line break is inserted, the text is not indented, there are a
couple of extra commands do line breaks. \newline
This paragraph provides no information whatsoever. We are exploring
line breaks. \hfill \break
And combining two commands
...
...

\begin{figure}
\centering
\includegraphics[width=3cm]{overleaf-logo}
\caption{Overleaf logo}
\end{figure}

Text alignment

set of examples

\begin{document}
\setlength{\hsize}{0.9\hsize}% emphasize effects

\subsection*{Left-aligned example with
\texttt{\string\raggedright}\\ (standard \LaTeX{} command)}
\raggedright\blindtext[2]\par

\subsection*{Left-aligned example with \texttt{\string\RaggedRight}\\ (\texttt{ragged2e} command)}
\RaggedRight\blindtext[2]\par
\end{document}

Multiple columns

set of examples

\begin{document}
\maketitle

\begin{multicols}{3}
[
\section{First Section}
All human things are subject to decay. And when fate summons, Monarchs must obey.
]
\blindtext\blindtext
\end{multicols}

fonts

set of examples