> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/languages/07-french.md).

# French

## Introduction

This article explains how to typeset French text: enabling correct typesetting of accented characters, such as â, ê, î, ô, û etc., and providing support for language-specific features such as hyphenation. If you are looking for instructions on how to use more than one language in a single document, for instance English and French, see the [International language support](/latex/languages/03-international-language-support.md) article.

## French example using pdfLaTeX

We’ll start with the following pdfLaTeX example which you can open in Overleaf using the link below the code.

```latex
\documentclass{article}
% \usepackage[utf8]{inputenc} is no longer required (since 2018)

%Set the font (output) encoding
%--------------------------------------
\usepackage[T1]{fontenc} %Not needed by LuaLaTeX or XeLaTeX

%French-specific commands
%--------------------------------------
\usepackage[french]{babel}
\usepackage[autolanguage]{numprint} % for the \nombre command

%Hyphenation rules
%--------------------------------------
\usepackage{hyphenat}
\hyphenation{mate-mática recu-perar}
%--------------------------------------

\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}
```

[Open this pdfLaTeX example in Overleaf.](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Sample+document+in+French\&snip=%5Cdocumentclass%7Barticle%7D%0A%25+%5Cusepackage%5Butf8%5D%7Binputenc%7D+is+no+longer+required+%28since+2018%29%0A%0A%25Set+the+font+%28output%29+encoding%0A%25--------------------------------------%0A%5Cusepackage%5BT1%5D%7Bfontenc%7D+%25Not+needed+by+LuaLaTeX+or+XeLaTeX%0A%0A%25French-specific+commands%0A%25--------------------------------------%0A%5Cusepackage%5Bfrench%5D%7Bbabel%7D%0A%5Cusepackage%5Bautolanguage%5D%7Bnumprint%7D+%25+for+the+%5Cnombre+command%0A%0A%25Hyphenation+rules%0A%25--------------------------------------%0A%5Cusepackage%7Bhyphenat%7D%0A%5Chyphenation%7Bmate-m%C3%A1tica+recu-perar%7D%0A%25--------------------------------------%0A%0A%5Cbegin%7Bdocument%7D%0A%5Ctableofcontents%0A%0A%5Cvspace%7B2cm%7D+%25Add+a+2cm+space%0A%0A%5Cbegin%7Babstract%7D%0ACeci+est+un+bref+r%C3%A9sum%C3%A9+du+contenu+du+document+%C3%A9crit+en+fran%C3%A7ais.%0A%5Cend%7Babstract%7D%0A%0A%5Csection%7BSection+d%27introduction%7D%0AIl+s%27agit+de+la+premi%C3%A8re+section%2C+nous+ajoutons+des+%C3%A9l%C3%A9ments+suppl%C3%A9mentaires+et+tout+sera+correctement+orthographi%C3%A9s.+En+outre%2C+si+un+mot+est+trop+long+et+doit+%C3%AAtre+tronqu%C3%A9%2C+babel+va+essayer+de+tronquer+correctement+en+fonction+de+la+langue.%0A%0A%5Csection%7BSection+th%C3%A9or%C3%A8mes%7D%0ACette+section+est+de+voir+ce+qui+se+passe+avec+les+commandes+de+texte+qui+d%C3%A9finissent.%0A%0A%5Cbegin%7Bitemize%7D%0A%5Citem+premier+%C3%A9l%C3%A9ment%0A%5Citem+deuxi%C3%A8me+%C3%A9l%C3%A9ment%0A%5Cend%7Bitemize%7D%0A%0A%5C%5B+%5Clim+x+%3D++%5Ctheta+%2B+%5Cnombre%7B152383.52%7D+%5C%5D%0A%5Cend%7Bdocument%7D)

This example produces the following output:

![OL2french1.png](/files/G7OqR5ylLffTqw8hkWsk)

### Text files: integers and characters

Any text file, such as a LaTeX input `.tex` file, is nothing more than a stream of numeric (integer) values which are being used as a mechanism to *represent* characters of text; consequently, processing a text file involves scanning (reading/processing) a series of integer values. However, an important question arises: *which set of characters* is actually represented by the integer values contained in a particular text file? In other words, how have those integer values been *encoded*: what is the correct (intended) "mapping" (encoding) from integers in the text file to the corresponding characters they are supposed to *represent*?

Text files can be generated within innumerable computing environments: across different countries/continents, using a multitude of different devices, operating systems and editing tools. Originators of text files could, potentially, use or apply different text encodings according to local requirements, such as language, when generating and storing the sequence of integer values chosen to represent the individual characters contained in a text file. This may work well if the generated text files stayed within compatible technical ecosystems, which use the same encoding, but what would happen when those files are transferred to completely different environments—because many text files do not contain any information which indicates the encoding used to generate them.

Clearly, the producer (originator) and consumer (user) of textual data must, somehow, agree on the encoding (mapping) being used, otherwise *encoding errors* are likely to arise due to mismatches between the integer data in the file and the set of characters it is assumed to represent. In addition to correctly mapping text file integer values to characters, any subsequent visual display of those characters requires some form of font that is capable of providing the data (shapes, or even bitmaps) to output a visual representation of the desired characters.

### Input encoding: inputenc, UTF-8 and a change to LaTeX in 2018

Historically, a variety of 8-bit encodings were used to generate/process text files, including LaTeX inputs. To cut short a very long story, the developers of LaTeX created the `inputenc` package to address encoding issues—allowing text files, created using various encodings, to be transferred between disparate LaTeX installations.

However, over time, users/software developers moved away from multiple 8-bit encodings to using Unicode and its UTF-8 encoding scheme, which became the de facto option for encoding text files. Prior to 2018, to process UTF-8 encoded files LaTeX document preambles included the line

```latex
\usepackage[utf8]{inputenc}
```

Readers might observe that the example above does not include the line `\usepackage[utf8]{inputenc}` in the document preamble: why is that? This is due to an important change to LaTeX introduced in 2018: a switch to UTF-8 as the default *input* encoding. Documents typeset with pdfLaTeX, and using UTF-8 encoded text, including those created and typeset on Overleaf, no longer *need* to include `\usepackage[utf8]{inputenc}` but is [does no harm to do so](https://www.latex-project.org/news/2018/04/10/issue28-of-latex2e-news-released/). For further information see the [April 2018 issue of LaTeX News](https://www.latex-project.org/news/2018/04/10/issue28-of-latex2e-news-released/) and the Overleaf blog post [*TeX Live upgrade—September 2019*](https://www.overleaf.com/blog/tex-live-upgrade-september-2019). All text files created on Overleaf are encoded using UTF-8.

### Output encoding: the fontenc package

To correctly typeset characters contained within input files, those characters need to be mapped to the appropriate *output shapes* (glyphs) contained in fonts used to typeset the document. This “output encoding” is handled by another package called `fontenc`.

To use `fontenc` include the following line in your document preamble, using an encoding, such as the [T1 encoding](http://mirrors.ctan.org/macros/latex/base/encguide.pdf), which supports accented characters contained in Latin-based languages:

```latex
\usepackage[T1]{fontenc}
```

Using the `T1` font encoding, via `\usepackage[T1]{fontenc}`, has other benefits:

* The default OT1 LaTeX font (“output”) encoding is 7-bit, meaning it can only encode 128 characters and does not include (enable) access to genuine accented character shapes (glyphs) contained in fonts. The `OT1` encoding causes TeX engines to “fake” accented characters by typesetting (combining) a base character with an overlaid, and shifted, accent character.
* If the TeX engine has to resort to *construction* of accented characters, this has implications for copy/paste of text from PDFs: copying text containing constructed accented characters will result in *two separate characters* being pasted: the base character and the accent character. Using the `T1` encoding avoids this.
* Using the `T1` encoding, to access genuine accented characters, improves hyphenation.

### LaTeX T1 font encoding

The following chart lists the `T1` font encoding. It is reproduced from page 22 of the document *LaTeX font encodings* which is [available on CTAN](http://mirrors.ctan.org/macros/latex/base/encguide.pdf).

![](/files/sK9HVhSps8YV8wxbFlRZ)

### Example of copy and paste

The following minimal example, which does not use `fontenc`, demonstrates issues with copy/paste of text containing accented characters.

```latex
\documentclass{article}
\begin{document}
Section théorèmes (OT1 encoding)

{
\fontencoding{T1}\selectfont Section théorèmes (T1 encoding)
}
\end{document}
```

[Open this example in Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Demonstrating+copy+and+paste+with+font+encodings\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0ASection+th%C3%A9or%C3%A8mes+%28OT1+encoding%29%0A%0A%7B%0A%5Cfontencoding%7BT1%7D%5Cselectfont+Section+th%C3%A9or%C3%A8mes+%28T1+encoding%29%0A%7D%0A%5Cend%7Bdocument%7D)

The first piece of text is typeset using LaTeX’s default `OT1` encoding, resulting in “fake” accented characters. The following piece of LaTeX code:

```latex
\fontencoding{T1}\selectfont
```

switches to using the `T1` encoding, which results in LaTeX typesetting accented character glyphs. If you copy the text from the PDF produced by the example above you should see something like this:

Section th´eor\`emes (OT1 encoding) Section théorèmes (T1 encoding)

Observe how the `OT1` encoded text does not contain actual accented characters, whereas the text encoded with `T1` does contain them. The result of copy/paste can also depend on the application being used to view the PDF from which you are copying/pasting text containing accented characters.

## Language-specific packages and commands

To extend the default capabilities of LaTeX, providing proper hyphenation and translation of the names of document elements, import the `babel` package using the `french` language option.

```latex
\usepackage[french]{babel}
```

As you may see in [example using pdfLaTeX](#french-example-using-pdflatex), instead of “Abstract” and “Contents” the French versions “Résumé” and “Table des matières” are used.

Notice that the preamble also loads the `numprint` package

```latex
\usepackage[autolanguage]{numprint}
```

which changes the formatting of numbers written inside the braces of the `\nombre{}` command.

## Hyphenation

The `babel` package usually does a good job of providing language-specific hyphenation capabilities, but if a particular word does not hyphenate correctly there are packages to assist. For example, you can add the `hyphenat` package in your preamble:

```latex
 \usepackage{hyphenat}
 \hyphenation{mathéma-tiques récu-pérer}
```

The second line is a list of space-separated words with defined hyphenation rules. If you want to prevent hyphenation of a specific *word*, write `{\nobreak word}` within your document, or include it in an `\mbox{word}`.

## Further reading

For more information see

* [Supporting modern fonts with XƎLaTeX](/latex/fonts/03-xelatex.md)
* [Typesetting quotations and quotation marks](/latex/languages/04-typesetting-quotations.md)
* [International language support](/latex/languages/03-international-language-support.md)
* [Chinese](/latex/languages/06-chinese.md)
* [Arabic](/latex/languages/05-arabic.md)
* [German](/latex/languages/08-german.md)
* [Greek](/latex/languages/09-greek.md)
* [Italian](/latex/languages/10-italian.md)
* [Japanese](/latex/languages/11-japanese.md)
* [Korean](/latex/languages/12-korean.md)
* [Portuguese](/latex/languages/13-portuguese.md)
* [Russian](/latex/languages/14-russian.md)
* [Spanish](/latex/languages/15-spanish.md)
* [The not so short introduction to LaTeX2ε](http://www.ctan.org/tex-archive/info/lshort/)
* [LaTeX/Internationalization on WikiBooks](http://en.wikibooks.org/wiki/LaTeX/Internationalization)
* [LaTeX/Special\_Characters on WikiBooks](http://en.wikibooks.org/wiki/LaTeX/Special_Characters)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/languages/07-french.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
