# Hyphenation of words with accents doesn't work [duplicate]

Hyphenation of words with accents doesn't work. I'm writing my document in Portuguese so I have accents like '~^ for some words but these words are not hyphenated. How do I solve this?

THIS WAS SOLVED BY: (1) updating my texlive installation. (2) adding the lines

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}


to my document. Actually the last line is not necessary but the text font would be too ugly without it.

• Do you have \usepackage[portuguese]{babel} in your preamble? – jub0bs Aug 9 '14 at 14:31
• And you'll want to be using \usepackage[T1]{fontenc} to allow hyphenation - see here and here. – greyshade Aug 9 '14 at 14:32
• no, splitting things into files with input should not make any difference. did you read the links and made sure none of the answers there help? if so, can you give a MWE for your specific case so we can test? – greyshade Aug 9 '14 at 14:40
• If you don't post also cenas we can't test many things… Just a lead: add \usepackage{lmodern}, for instance. – Bernard Aug 9 '14 at 14:48
• @David There must be something you're not telling us, because the word "adiabática" gets hyphenated as expected in the following MWE: \documentclass[10pt,a4paper]{book} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[portuguese]{babel} \begin{document} adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática adiabática \end{document} – jub0bs Aug 9 '14 at 14:56

(too long for a comment, hence posted as an answer)

The inability of TeX (and LaTeX, etc) to hyphenate words with accents -- if the accented words were constructed using accenting primitives and if the font encoding is the "original" or "old" TeX encoding -- has been known for a long time.

What to do? You should (a) if at all possible input the accented words directly, e.g., as adiabática, (b) use any font encoding other than OT1 (which, as you can probably guess, is the original font encoding method), and (c) load the babel or polyglossia packages with the appropriate language choices.

The MWE below was compiled using LuaLaTeX; if compiled under pdfLaTeX the first word would not get hyphenated. (That's a different shortcoming...)

\documentclass[a4paper]{article}
\usepackage{ifluatex}
\ifluatex
\usepackage{fontspec}
\else
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\fi
\usepackage[portuguese]{babel}
\setlength\textwidth{1mm} % to force the use of every possible hyphenation point

\begin{document}
\noindent

• @David - What exactly gives rise to the error you report? It can't be either my MWE -- its output is shown above, and it compiles without error -- or the code you've posted (with the instruction \input{cenas} commented out, since I don't have that file, and with a right curly brace, }, inserted after {autor`). I suggest you post a new query with an actual MWE that gives rise to the font-related problem you're encountering. – Mico Aug 9 '14 at 15:50