French
LaTeX supports many worldwide languages by means of some special packages. In this article is explained how to import and use those packages to create documents in French.
Introduction
French language has some accentuated words and special characters. For this reason the preamble of your file must be modified accordingly to support these characters and some other features.
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\begin{document}
\tableofcontents
\vspace{2cm} %Add a 2cm space
\begin{abstract}
Ceci est un bref résumé du contenu du document écrit en français.
\end{abstract}
\section{Section d'introduction}
Il s'agit de la première section, nous ajoutons des éléments supplémentaires et tout sera correctement orthographiés. En outre, si un mot est trop long et doit être tronqué, babel va essayer de tronquer correctement en fonction de la langue.
\section{Section théorèmes}
Cette section est de voir ce qui se passe avec les commandes de texte qui définissent.
\end{document}
There are two packages in this document related to the encoding and the special characters. These packages will be explained in the next sections.
If your are looking for instructions on how to use more than one language in a sinlge document, for instance English and French, see the International language support article.
Open an example of the babel package in ShareLaTeX
Input encoding
Modern computer systems allow you to input letters of national alphabets directly from the keyboard. In order to handle a variety of input encodings used for different groups of languages and/or on different computer platforms LaTeX employs the inputenc package to set up input encoding. In this case the package properly displays characters in the French alphabet. To use this package add the next line to the preamble of your document:
\usepackage[utf8]{inputenc}
The recommended input encoding is utf-8. You can use other encodings depending on your operating system.
Open an example of the babel package in ShareLaTeX
Font encoding
To proper LaTeX document generation you must also choose a font encoding which has to support specific characters for French language, this is accomplished by the fontenc
package:
\usepackage[T1]{fontenc}
Even though the default encoding works well in French, using this specific encoding will avoid glitches with some specific characters. The default LaTeX encoding is OT1
.
Open an example of the babel package in ShareLaTeX
Language-specific packages and commands
To extended the default LaTeX capabilities, for proper hyphenation and translating the names of the document elements, import the babel package for the French language. The language option should be passed to the \documentclass
command.
\documentclass[french]{article}
\usepackage{babel}
Then french
option is recommended for a generic document, if you need Canadian localization you can use canadien
instead.
\documentclass[french]{article}
%encoding
%--------------------------------------
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%--------------------------------------
%French-specific commands
%--------------------------------------
\usepackage{babel}
\usepackage[autolanguage]{numprint}
%--------------------------------------
%Hyphenation rules
%--------------------------------------
\usepackage{hyphenat}
\hyphenation{mathéma-tiques récu-pérer}
%--------------------------------------
\begin{document}
\tableofcontents
\vspace{2cm} %Add a 2cm space
\begin{abstract}
Ceci est un bref résumé du contenu du document écrit en français.
\end{abstract}
\section{Section d'introduction}
Il s'agit de la première section, nous ajoutons des éléments
supplémentaires et tout sera correctement orthographiés. En
outre, si un mot est trop long et doit être tronqué, babel
va essayer de tronquer correctement en fonction de la langue.
\section{Section théorèmes}
Cette section est de voir ce qui se passe avec les commandes de
texte qui définissent.
\begin{itemize}
\item premier élément
\item deuxième élément
\end{itemize}
\[ \lim x = \theta + \nombre{152383.52} \]
\end{document}
In this document an additional command is used in the section of the preamble for Language-specific features. \usepackage[autolanguage]{numprint}
changes the formatting of the numbers written inside the braces of the \nombre{}
command.
Notice also that the elements in a list have changed, they have a different format.
Open an example of the babel package in ShareLaTeX
Hyphenation
Sometimes for formatting reasons some words have to be broken up in syllables separated by a -
(hyphen) to continue the word in a new line. For example, mathématiques could become mathéma-tiques. The package babel, whose usage was described in the previous section, usually does a good job breaking up the words correctly, but if this is not the case you can use a couple of commands in your preamble.
\usepackage{hyphenat}
\hyphenation{mathéma-tiques récu-pérer}
The first command will import the package hyphenat and the second line is a list of space-separated words with defined hyphenation rules. On the other side, if you want a word not to be broken automatically, use the {\nobreak word}
command within your document.
Open an example of the babel package in ShareLaTeX
Further reading
For more information see
- Supporting modern fonts with XƎLaTeX
- Typesetting quotations and quotation marks
- International language support
- Chinese
- Arabic
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
- The not so short introduction to LaTeX2ε
- LaTeX/Internationalization on WikiBooks
- LaTeX/Special_Characters on WikiBooks
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Debugging Compilation timeout errors
- How-to guides
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Fractions and Binomials
- Aligning Equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management in LaTeX
- Bibliography management with biblatex
- Biblatex bibliography styles
- Biblatex citation styles
- Bibliography management with natbib
- Natbib bibliography styles
- Natbib citation styles
- Bibliography management with bibtex
- Bibtex bibliography styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections and equations
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typing exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class
- Tips