Fonts & Character Sets ⇒ Issue with \input and French accents
Issue with \input and French accents
I'm using inputenc so that I can type accents like é, è, à directly. I have no problem with all the characters that I type inside my main file. I separate all my chapters in different files and use \input to put everything together. However, the accented characters from my separate files don't work when I output my LaTeX into dvi or pdf (é will turn into é, etc).
As of now I gave up on using \input and am forced to type everything inside the same file but the report is rather large and I'd prefer if I could split it.
Thank you in advance
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Re: Issue with \input and French accents
that is a very common beginners problem.
Your main file is (i guess) latin1 encoded, the other files you input are utf8 encoded.
- Make a backup copy of your files.
- Open the main file with your favourite text editor (notepad, mousepad, gedit, ...)
- Open your LaTeX-editor, go to the settings and switch to utf8 encoding.
- create a new file, copy/paste the contents of the main file, save.
- change the option of package inputenc to utf8.
- Try it out. Works? Perfect. Something went wrong? Good thing you made the backup.
Re: Issue with \input and French accents
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Issue with \input and French accents

Windows is more than capable of using utf8 (it uses utf16 internally at a very low level).
But be aware, that the syntax is
Code: Select all
\usepackage[utf8]{inputenc}
Code: Select all
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
á è œ â ü
\end{document}
Re: Issue with \input and French accents
Is there any reason as to why tutorials everywhere tell me to use latin1 with inputenc instead of utf8?
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Issue with \input and French accents
For example, the greeks have the latin base alphabet (the first 128 are the same), but they don't need accented letters, they need greek letters. The russians need cyrillic letters.
This made transferring information a bit compllicated, so a new standard was born: Unicode (and a subset utf8). utf8 can not only map latin letters, it also includes greek, cyrillic, cjk, mathematical symbols ... even klingon.
Modern engines like XeLaTeX and LuaLaTeX are designed to use unicode and expect utf8 input. No need to use package inputenc anymore. You can do this.
Code: Select all
\documentclass{article}
\usepackage[english,russian,greek,ngerman,french]{babel}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\begin{document}
UTF-8 est un codage de caractères informatiques conçu pour coder
l’ensemble des caractères du «répertoire universel de caractères
codés», initialement développé par l’ISO dans la norme
internationale ISO/CEI 10646, aujourd’hui totalement compatible
avec le standard Unicode, en restant compatible avec la norme
ASCII limitée à l’anglais de base (et quelques autres langues
beaucoup moins fréquentes), mais très largement répandue depuis
des décennies.
\selectlanguage{ngerman}
UTF-8 ist die am weitesten verbreitete Kodierung für
Unicode-Zeichen (Unicode und UCS sind praktisch identisch). Die
Kodierung wurde im September 1992 von Ken Thompson und Rob Pike
bei Arbeiten am Plan-9-Betriebssystem festgelegt. Die Kodierung
wurde zunächst im Rahmen von X/Open als FSS-UTF (filesystem safe
UTF in Abgrenzung zu UTF-1, das diese Eigenschaft nicht hat)
bezeichnet, in den Folgejahren erfolgte im Rahmen der
Standardisierung die Umbenennung auf die heute übliche
Bezeichnung UTF-8.
\selectlanguage{greek}
Το UTF-8 είναι ένα μη-απωλεστικό σχήμα κωδικοποίησης χαρακτήρων
μεταβλητού μήκους για το πρότυπο Unicode που δημιουργήθηκε από
τους Ken Thompson και Rob Pike. Χρησιμοποιεί ομάδες από byte για
να αναπαραστήσει τα κωδικά σημεία του Unicode. Είναι ιδιαίτερα
χρήσιμο για μετάδοση δεδομένων σε 8bit συστήματα ηλεκτρονικού
ταχυδρομείου.
\selectlanguage{russian}
UTF-8 — одна из общепринятых и стандартизированных кодировок
текста, которая позволяет хранить символы Unicode.
\selectlanguage{english}
\[ ⑴ a√∂b ∓ ∑m → ℏ/∞² \]
Equation ⑴ is complete and utter nonsense.
\end{document}
- Attachments
-
- melethAccentsExt.pdf
- (35.18 KiB) Downloaded 432 times
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Issue with \input and French accents

Best regards, and welcome to the forum, mèlèth!
Stefan
Re: Issue with \input and French accents
