# LaTeX does not print words correctly: inputenc/fontenc problem

I'm using a MacBook Pro and TeXShop. I am writing a philosophy thesis and fairly new to LaTeX.

In my preamble I have put

\documentclass[a4paper,12pt]{article}
\linespread{1.5}
\usepackage[francais,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[round]{natbib}
\usepackage{epigraph}
\usepackage{makeidx}
\usepackage{url}
\usepackage{color}
\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref}
\usepackage[nottoc]{tocbibind}
\setcounter{tocdepth}{12}
\usepackage{eurosym}
\usepackage{ragged2e}
\begin{document}

These earlier ﬁrms, were far more powerful; they commanded armies and ﬂeets

\bibliographystyle{plainnat}
\bibliography{biblio.bib}
\printindex
\end{document}


However, in the pdf I get: "These earlier rms, were far more powerful; they commanded armies and eets"

Also, I want to use french characters (i.e. é è ç ô ê, etc), but I still have to type e and so on.

I have googled, and played a bit with [latin1] but don't find an answer; please help.

-
Welcome to TeX.SX! I've removed the second question because here it's best to have only one question per topic, in order to keep the site more easily informative. Feel free to add a new question. Can you add more to that code bit? A minimal part of your code that exhibits the problem. –  egreg May 7 '12 at 13:41
Could you post a Minimal Working Example? –  mbork May 7 '12 at 13:42
I hope this can be seen as a MWE. Sorry, but I'm very new to this. –  pieter May 7 '12 at 13:53
You need to check the settings in your editor. Give applemac a go, that is usually the default in TeXShop, though I'd recommend reconfiguring it to use 'utf8, might be better when exchanging documents with others. –  daleif May 7 '12 at 13:59
I tried applemac as a package, but didn't work. In my editor preferences, I put encoding to utf8', but to no avail. –  pieter May 7 '12 at 14:03
add comment

## 1 Answer

Don't use the ﬁ and ﬂ characters in the input, but write firms and fleets.

Also add the following "magic" line at the beginning of your file

% !TEX encoding = UTF-8 Unicode


This will ensure that TeXShop interprets your file as UTF-8.

If your text has already many instances of ﬁ and ﬂ, you can consider adding the following to your preamble:

\usepackage{newunicodechar}
\newunicodechar{ﬁ}{fi}
\newunicodechar{ﬂ}{fl}


but it's best to stick with normal input.

Accented characters will be treated correctly.

Here's an example:

% !TEX encoding = UTF-8 Unicode
\documentclass[a4paper,12pt]{article}
\linespread{1.5}
\usepackage[francais,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[round]{natbib}
\usepackage{epigraph}
\usepackage{makeidx}
\usepackage{url}
\usepackage{color}
\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref}
\usepackage[nottoc]{tocbibind}
\setcounter{tocdepth}{12}
\usepackage{eurosym}

\usepackage{newunicodechar}
\newunicodechar{ﬁ}{fi}
\newunicodechar{ﬂ}{fl}

\usepackage{ragged2e}

\begin{document}

These earlier firms, were far more powerful; they commanded armies and fleets

These earlier ﬁrms, were far more powerful; they commanded armies and ﬂeets

Garçon, été, l'Hôpital, Génève

\bibliographystyle{plainnat}
\bibliography{biblio.bib}
\printindex
\end{document}


-
Tried the "% !TEX line", but won't work. Also, I do write firms and fleets. So where does it go wrong? –  pieter May 7 '12 at 13:58
@pieter Your code above shows that the ligatures are used. Perhaps you copy-pasted the code. Close and reopen the file. –  egreg May 7 '12 at 14:02
Thanks, that code did work. So I guess that's because of the \newunicodechar ? Anything I can do to avoid this in a next document? –  pieter May 7 '12 at 14:08
@pieter The normal behavior of TeXShop is not to use the special ligatures in the .tex document. As I said before, you probably pasted that text from some source. A PDF file? Just do a "search and replace" to change the special characters into fi and fl`. –  egreg May 7 '12 at 14:11
Indeed, that was a quote from a pdf file. Makes sense now :-). Thanks a lot! –  pieter May 7 '12 at 14:13
add comment