Showing first {{hits.length}} results of {{hits_total}} for {{searchQueryText}}{{hits.length}} results for {{searchQueryText}}

Contents

Encoding

Overleaf uses the UTF-8 encoding for all text files. UTF-8 is the most widely used character encoding on the web today. You can use it to represent any unicode character, which includes an enormous variety of letters, numbers and symbols, including Greek letters and letters with accents.

UTF-8 supersedes many older encodings, such as latin1, latin9, which are often found in LaTeX files and templates. TeX and LaTeX predate UTF-8 by several decades, so LaTeX support for UTF-8 is somewhat inconsistent and depends on which TeX engine you are using.

Support with LaTeX and pdfLaTeX

If you are using pdfLaTeX (i.e., running LaTeX using the pdfTeX engine), which is the default on Overleaf, you can typeset most accented letters and some symbols directly if you include this \usepackage command in the preamble of your document:

\usepackage[utf8]{inputenc}

This should be the only inputenc line in your preamble, so it should replace any that use other encodings.

However, tex does not know how to typeset all UTF-8 characters. You may get an error like this, if it does not know how to typeset your character:

Package inputenc Error: Unicode char \u8:��� not set up for use with LaTeX.

You can sometimes work around this by using a different inputenc, utf8x, with an x.

\usepackage[utf8x]{inputenc}

The utf8x input encoding sets up more unicode characters for use with LaTeX. However, it is no longer maintained, and its use is discouraged. You should use utf8 unless you are certain you need utf8x.

If that does not help, you may need to use TeX's built-in support for accents, e.g. by writing {\"e} instead of writing ë directly. You can find out more about special characters and accents in the LaTeX Wikibook. Alternatively, you can use a more modern TeX engine, such as XeLaTeX or LuaTeX.

Support with XeLaTeX or LuaLaTeX

If you are using one of these more modern LaTeX engines, you can use much more of UTF-8 directly. You can choose the engine on Overleaf by clicking on the gear icon in the top right of your project.

Invalid/Unsupported Characters

For technical reasons, Overleaf cannot store files that contain NUL characters or files that contain characters from outside of Unicode's Basic Multilingual Plane(BMP). The BMP contains only the first 65,536 unicode code points. Some unicode mathematical symbols and some symbols from eastern languages are outside of the BMP. Non-BMP mathematical symbols sometimes arise when copying from PDFs for web pages.

If you try to upload a file that contains unsupported characters, Overleaf will respond with a "file contains invalid characters and can't be imported" error. The best workaround is to replace the non-BMP characters with equivalent LaTeX commands. Detexify is a useful tool for finding the LaTeX command that corresponds to a given symbol.

Line Endings

Overleaf uses unix-style newline endings, \n (LF), rather than Microsoft Windows-style line endings \r\n (CRLF).

If you are using the git interface to edit your projects on Overleaf, then you can use your system's local line endings and have git translate them to unix line endings for you by enabling git's autocrlf setting.

Related Help Articles

[edit] Overleaf 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