LaTeX - Text formatting

December 2016


Text Style


The following commands allow you to change the text style:


\textbf{text} write text in bold.

\textit{text} write text in italics.

\textsc{text} set text in small caps.

\textrm{text} use the Roman font

\textsf{text} use the Sans serif font

Font size


LaTeX also has commands to change the size of the characters, that is to say the font size:
  • \tiny
  • \scriptsize
  • \footnotesize
  • \small
  • \normalsize
  • \large
  • \Large
  • \LARGE
  • \huge
  • \Huge

Layout


It is also possible to force the layout of the document using line breaks, page breaks and spacing commands:

Example:

\newpage allows you to start a new page
\hspace{size} add an horizontal space
\vspace{size} add a vertical space

Where size can be expressed in mm or cm.

Note that: The space created can be a compressed by LaTeX to fit in the overall layout. It you don't want LaTex to compress the empty space, add an asterisk to the command:

\vspace*{7mm}

Text presentation


The presentation of the text can also be enhanced through the itemize, enumerate and description environments. The following examples demonstrate their use:

The above code gives the following result:

Text Color


It is possible to assign a color to the text using the color (\usepackage{color}) environment.
  • \textcolor{color}{text} assign a specific color to text.
  • \colorbox{color}{text} displays text on a colored background.
  • \fcolorbox{color of border}{background color}{text} creates a frame around the colored background.
  • \pagecolor{color} assigns a background color to the page.


LaTeX offers eight preset colors:
  • black
  • white
  • red
  • green
  • blue
  • cyan
  • magenta
  • yellow


New colors can be set using the following commands:
  • \definecolor{name of new color}{rgb}{red value, green value, blue value} 
  • \definecolor{cmyk}{cyan, magenta, yellow, black}) :



Examples of colors:

\definecolor{rltred}{rgb}{0.75,0,0}
\definecolor{rltgreen}{rgb}{0,0.5,0}
\definecolor{oneblue}{rgb}{0,0,0.75}
\definecolor{brown}{rgb}{0.64,0.16,0.16}
\definecolor{forestgreen}{rgb}{0.13,0.54,0.13}
\definecolor{purple}{rgb}{0.62,0.12,0.94}
\definecolor{dockerblue}{rgb}{0.11,0.56,0.98}
\definecolor{freeblue}{rgb}{0.25,0.41,0.88}
\definecolor{myblue}{rgb}{0,0.2,0.4}




Original document published on CommentcaMarche.net

Related :

This document entitled « LaTeX - Text formatting » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.