Typeface, language and text format

When you need specific features that are not provided natively by XeLaTeX, you can load packages that will make the requested features available to you. A package is loaded with the command \usepackage{}, with the name of th package inside the brackets. The \usepackage command must be put in the preamble (i.e. before \begin{document}).

Two useful packages are fontspec and polyglossia. The first package lets you use any typeface of your choice that is installed in your OS and you can also define different typefaces according to your preferences (like a different font for a different language if you are writing not only in English). The second package, polyglossia, let you set the language of the document. In this tutorial, we will set the typeface Helvetica and English as the language. To do so, copy-paste the following code after \documentclass{article}.

\usepackage{fontspec}
    \setmainfont{Helvetica}
\usepackage{polyglossia}
    \setmainlanguage{english}

packages

 Text format

Now that the typeface and the languages for your document are set, we can play with the format of the text. In XeLaTeX, to change the font of your text, you have to wrap it in the appropriate commands. The commands and their result are shown in the following table.

\textit{italics} italics
\textbf{bold face} bold face
\textsc{small caps} small caps
\texttt{monospace} monospace
\textit{textbf{mixed}} mixed

And here is a text sample that you can add in your document and try to typeset.

\textit{This text} is textbf{very important}. If you set the class to
<code>\texttt{article}, you will \textit{\textbf{not be able}} to use the chapter headings.

And the result will be:

This text is very important. If you set the class to article, you will not be able to use the chapter headings.

Bullet and numbered lists

Bulleted and numbered lists are set with two environments (remember that an environment is a combination of a \begin and \end commands): itemize for bulleted lists and enumerate for numbered lists. Each point in the list is specified with the \item command, like this:

\begin{itemize}
\item First item
\item Second item
\item Third item
\end{itemize}

If you change itemize to enumerate you will obtain an enumerated list instead of a bulleted one. See the picture for examples and how to create sub-items and mixed lists.

format-text

Paragraphs and indentation

To start a new paragraph of text you need to leave one empty line between the previous paragraph and the new one. If you just hit return once, the two consecutive line will be typeset in the same paragraph. Indentation is automatically handled: the first paragraph after a heading is not indented while all the others are. So the following code produces the output shown in the figure below.

This is one line in one paragraph.
This is another line in the same paragraph which is quite short.

This is a new paragraph and it goes and goes and goes for long and long and long and long and long and long and long and long.

This is a third paragraph and it goes and goes and goes for long and long and long and long and long and long and long and long.

paragraphs