How to Fix Romanian Diacritics in a pdfLaTeX Document
At a glance
- 1. Save as UTF-8
Make sure your .tex file is saved using UTF-8 so pdfLaTeX reads Romanian characters correctly.
- 2. Set the font encoding
Use T1 font encoding and a font that includes Romanian characters, such as Latin Modern.
- 3. Set Romanian language
Load Romanian babel support for language-specific conventions, including hyphenation.
- 4. Check copied text
If the PDF displays correctly but copied text is wrong, load cmap before fontenc.
Romanian diacritics in a pdfLaTeX document involve three separate things: how the source file is read, which characters the chosen font can print, and how the PDF represents text for copying or searching. A fix for one does not necessarily fix the others.
For a typical pdfLaTeX document, save the source as UTF-8, select T1 font encoding, load Romanian language support, and use a font with the required glyphs. If the page looks correct but copied text is wrong, also add a PDF character map.
A working pdfLaTeX example
This example uses Latin Modern, which provides the characters used in standard Romanian text:
\documentclass{article}
\usepackage[utf8]{inputenc} % Explicit for older LaTeX installations
\usepackage{cmap} % Improve PDF text copy-and-paste
\usepackage[T1]{fontenc}
\usepackage[romanian]{babel}
\usepackage{lmodern}
\begin{document}
Știința și tehnologia: ă â î ș ț; Ă Â Î Ș Ț.
Acesta este un scurt text în limba română.
\end{document}
Compile it with pdflatex. On current LaTeX releases, UTF-8 is the default input encoding, so the inputenc line is usually optional. Keeping it is useful when the same source must also work with older installations. The .tex file itself still needs to be saved as UTF-8; declaring UTF-8 in the preamble does not convert a file saved in another encoding.
Load cmap before fontenc. The package can add character mapping information that helps PDF viewers identify text when you select, copy, or search it. It is relevant when the glyphs appear correctly on the page but copied text contains missing or incorrect characters. It does not supply missing font glyphs, and results can depend on the font and PDF viewer.
What each setting does
- UTF-8 input lets pdfLaTeX interpret the Romanian characters typed directly into your source.
- T1 font encoding selects a text-font encoding that supports many accented Latin characters. Without it, accented letters may be assembled in ways that affect hyphenation or text extraction, or may fail to print with some fonts.
- Romanian babel support sets Romanian language conventions, including hyphenation. It does not make an unsuitable font contain Romanian glyphs.
- Latin Modern is a practical font choice for pdfLaTeX documents that need these characters. Other fonts may work, but check their glyph coverage and encoding support.
- cmap can improve the mapping between visible PDF glyphs and the text characters copied from the PDF.
These roles explain why a document can show one symptom but not another. If a character is missing on the page, check the input encoding and font coverage first. If it displays correctly but copies incorrectly, investigate PDF text mapping.
Check which Romanian characters you are using
Romanian uses ă, â, î, ș, and ț, as well as their uppercase forms. In current standard Romanian orthography, ș and ț have a comma below. They are distinct Unicode characters from ş and ţ, which use a cedilla. The two forms can look similar in some fonts, but a document may contain one form while you expect the other.
If the printed letters look wrong, inspect the source characters and confirm that your font supports the intended forms. If the page looks right but copied text differs, paste it into a plain-text editor and inspect the characters there. Do not use appearance alone to determine which Unicode characters are in the PDF.
Common mistakes
Using only inputenc
UTF-8 input tells pdfLaTeX how to read characters in the source. It does not choose a font encoding or guarantee correct PDF text extraction. Pair it with T1 font encoding and an appropriate font.
Using only babel
The Romanian language option sets language behavior; it is not a font installation and cannot add absent glyphs. If the log reports that Romanian language support is unavailable, install the Romanian Babel language files for your TeX distribution.
Loading packages in the wrong order
For this setup, load cmap before fontenc. If you add packages or change fonts, compile again and check both the visible output and copied text.
Treating all problems as copy-and-paste problems
A missing or malformed accent on the page is usually an input, encoding, or font issue. A correct-looking page with corrupted copied text points more directly to PDF character mapping. Diagnose the symptom before changing packages.
If you can change engines
For a new document, XeLaTeX or LuaLaTeX can be convenient because they handle Unicode input directly and let you select system fonts with fontspec. In that workflow, do not use the pdfLaTeX-specific inputenc and fontenc setup shown above; choose a font that supports Romanian characters and compile with the Unicode engine. If you need to keep pdfLaTeX, the example above is a suitable starting point.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.