Clique aqui e veja a página ShareLaTeX em Inglês

[edit] ShareLaTeX guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

Even though LaTeX provides an extensive set of fonts, you may want to use an an external font you really like and you have already installed system-wide, this is possible with XƎTeX. XeTeX is a TeX typesetting engine using Unicode and supporting modern font technologies such as OpenType (OTF), TrueType (TTF), Graphite, and Apple Advanced Typography (AAT). The corresponding compilers are xetex and xelatex.


[edit] Introduction

Times New Roman is one of the most used fonts, if you have this font installed in your system you can use it in your LaTeX document.

\setmainfont{Times New Roman}
 \title{Sample font document}
 \author{Hubert Farnsworth}
 \date{this month, 2014}
 This an \textit{example} of document compiled 
 with \textbf{xelatex} compiler. LuaLaTeX should 
 work fine also.


In this example the document uses the popular Times New Roman font, this font is set by \usemainfont{Times New Roman}. The package fontsec must be imported for this to work.

  Open an example in ShareLaTeX

[edit] Setting fonts for different LaTeX elements

Different elements in a LaTeX document are formatted with different fonts, for example in a verbatim environment the text is displayed using a typewriter style. Different font styles can be set for each context:

  %This would work on a standard latex installation, (your local computer) 
  \setromanfont{Times New Roman}
  \setmonofont[Color={0019D4}]{Courier New}
   \title{Sample font ocument}
   \author{Hubert Farnsworth}
   \date{this month, 2014}
     This an \textit{example} of document compiled with 
     \textbf{xelatex} compiler. If you have to write 
     some code
     usually this environment is used to display code
     <head> </head>
     <h1> Hello World</h1>
      {\sffamily This is a sample text in \textbf{Sans Serif Font Typeface}}


In the previous example three different fonts are used, the next lines determine the elements that will use this fonts:

\setromanfont{Times New Roman}
This is the normal font used in most of the document, Times New Roman in the example.
The elements that require a sans font, explicitly declared by the \ssfamily in the example, will be typeset with Arial font.
\setmonofont{Courier New}
Everithing that must be formatted with a Typewritter font in your document will use the Courier New font. This command has an extra optional parameter inside braces:
This sets the colour of the text in hex html format. Especially useful when making a presentation.

You can use the fonts installed in your system, see the reference guidefor a list of font-directories for different operating systems.

  Open an example in ShareLaTeX

[edit] Fonts in ShareLaTeX

If you want to use your own fonts on ShareLaTeX you must upload them first, and then configure your document to be compiled with XƎLaTeX. To render the example of the previous section add the next to the preamble:

% Times New Roman
% Arial
% Courier New


The file names end with a .tff extension because they are True Type fonts, other fonts are also supported. Check also the Google WebFonts collection for many free fonts.

  Open an example in ShareLaTeX

[edit] Reference guide

Fonts directories

Depending on your operating system you can find font files (.otf/.ttf) in the following directory:

  • Mac OS X: /Library/Fonts
  • Windows: Windows/Fonts
  • Linux: /usr/share/fonts/ (some user-installed fonts can be in /usr/local/share/fonts/ or ~/.fonts/)

If you want to find your fonts by name, open Fonts module in your Control Panel / System Settings application or see fonts list in your Word or Libre/Open Office suite.

[edit] Further reading

For more information see: