Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I know that hyphenating words with accents produces an error in LaTeX. So what can I do in such an occasion? I am facing a problem like that in my text where I use the Linux Libertine O font as the main font. The character is a greek alpha with an accent.

share|improve this question
2  
Please add a minimal working example (MWE) that illustrates your problem. –  Werner Oct 16 '12 at 18:20
    
No minimal example to write here. I am getting a latex error Improper hyphenation will be flushed , when I am trying to use for example things like \hyphenate{μετα-ευριστικός} (words with accents) –  Paramar Oct 16 '12 at 18:27
3  
@Paramar: Does wrapping what you have with \documentclass{article} \begin{document} \hyphenate{μετα-ευριστικός} \end{document} reproduces the problem? If so than that would be a MWE. If not, then it needs to be expanded until it reproduces the problem. –  Peter Grill Oct 16 '12 at 18:46
3  
Please make a complete document starting \documentclass and ending \end{document} showing all packages loaded. The first sentence of your question isn't true LaTeX can hyphenate such words, the packages you use to set up the greek fonts are supposed to set up greek hyphenation, so your document is mis-configured in some way but if you do not show us an example document it is impossible to guess what is wrong. Also are you using pdflatex or xelatex or lualatex? –  David Carlisle Oct 16 '12 at 20:25

1 Answer 1

up vote 3 down vote accepted

Assuming that the only hyphenation point you want in "μεταευριστικός" is after "μετα", then the following (in XeLaTeX) will work:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newfontfamily\greekfont[Script=Greek]{Linux Libertine O}
\usepackage{polyglossia}
\usepackage{xltxtra}
\setmainlanguage{greek}

\begin{otherlanguage*}{greek}
\hyphenation{μετα-ευριστικός}
\end{otherlanguage*}

\begin{document}

\parbox{1pt}{\hspace{0pt}μεταευριστικός}

\end{document}

The \parbox{1pt}{\hspace...} is just in order to force XeTeX to do all possible hyphenations.

Note that the \hyphenation command is language dependent, so you have to state hyphenation exceptions in the proper language environment. If you use only one language or the exceptions are only for the main language, the \hyphenation declaration can be put after \begin{document}.

enter image description here

Without the \hyphenation declaration, the result would have been

enter image description here

share|improve this answer
    
We are near the solution. The code you proposed me correctly separates the word at μέτα but doesn't solve the problem. In my text I had μεταευριστικός that needed to be separated in the middle of a paragraph. With parbox it gets separated but falls over the next word of the text and the second part of the word isn't written in the beggining of the next line. What do you propose to solve this? –  Paramar Oct 17 '12 at 12:01
    
@Paramar The \parbox is only to show the hyphenation points; you mustn't use it in your code. –  egreg Oct 17 '12 at 12:03
    
Hmm, I tried only adding the \hyphenation part. My text compiles with Xelatex but the hyphenation mistakes still exist. Any idea? The packages used are: \usepackage{fontspec} \setmainfont{Linux Libertine O} \newfontfamily\greekfont[Script=Greek]{Linux Libertine O} \newfontfamily\greekfontsf[Script=Greek]{Linux Libertine O} \newfontfamily\greekfonttt[Script=Greek]{Linux Libertine O} \usepackage{polyglossia} \usepackage{xltxtra} \setmainlanguage{greek} \setotherlanguages{english} \begin{otherlanguage*}{greek} \hyphenation {σταθε-ρές} \hyphenation{μεταευ-ριστικές} \end{otherlanguage*} –  Paramar Oct 17 '12 at 12:14
    
@Paramar Not without a real example. If you're using ucharclasses for setting the language, you've been warned. ;-) –  egreg Oct 17 '12 at 12:14
    
Following your advice I erased ucharclasses –  Paramar Oct 17 '12 at 12:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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