2

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.

marked as duplicate by Mico, Ian Thompson, Masroor, Malipivo, user31729 Aug 9 '14 at 15:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Do you have \usepackage[portuguese]{babel} in your preamble? – jubobs Aug 9 '14 at 14:31
  • 4
    And you'll want to be using \usepackage[T1]{fontenc} to allow hyphenation - see here and here. – greyshade Aug 9 '14 at 14:32
  • 2
    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
  • 2
    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
  • 1
    @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} – jubobs Aug 9 '14 at 14:56
2

(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...)

enter image description here

\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
adiabática adiabática
\end{document}
  • thanks. this gives me the error ! Font T1/cmr/m/n/10=ecrm1000 at 10.0pt not loadable: Metric (TFM) file not fou nd. – David Aug 9 '14 at 15:43
  • @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
  • it was strictly your your code in a blank tex file. – David Aug 9 '14 at 15:56
  • @David -- What's your TeX distribution (TeXLive?, MikTeX? something else?) and vintage? Do you use pdfLaTeX or the (by now very old and obsolete) version of LaTeX that can generate only dvi files? – Mico Aug 9 '14 at 16:14
  • I dont know. I installed texmaker in ubuntu with apt-get. and i use pdflatex – David Aug 9 '14 at 16:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.