# How to get hyphenation output?

I'm writing a thesis in Icelandic and LaTeX doesn't know how to break the words correct. I'm trying to create a list of words it breaks and correct them. I have over 100 pages of text and I want to be able to get an list of all the words which is hyphenated.

\documentclass[a4paper,12pt,icelandic]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{palatino,babel,setspace}
\hyphenation{Eyja-fjalla-jökull}
\hyphenation{Hall-orms-staðar-skógur}
\hyphenation{norður-ljós}

\begin{document}
\end{document}


There are hundreds of words broken incorrectly. I would like to get a list of the words it breaks to define a new hyphenation for them. The words mentioned in the code is just some examples. I'm not really using those in the thesis and the babel package may break them correctly.

I have a thesis with approx. 40.000 words. I just wanted a list of the words that LaTeX breaks. - So I can put them inside:

"\babelhyphenation[icelandic]{ Word list here }

where I define myself the proper hyphenations. I could just scroll down every page and write the word manually. But I'm just trying to save me some time. If it would be possible.

I have no interest in taking a look at how each word is currently defined to break.

• You can use \showhyphens set hyphenation explicitly using \hyphenation{sea-gull} and also need to use the correct font encoding. Right now, i don't really know what you are after? Can you elaborate? – Johannes_B Dec 1 '14 at 14:56
• Can you show a small example? Are you using \usepackage[icelandic]{babel} and \usepackage[T1]{fontenc}? – egreg Dec 1 '14 at 14:57
• egreg: I added some information. Thought it wouldn't matter cause it would be same for every language. Johannes_B: I wan't to get a list of all words LaTeX breaks so I can show LaTeX to break them by using: \hyphenation{sea-gull} – Bjartmar Dec 1 '14 at 15:23
• You are missing \usepackage[icelandic]{babel} – egreg Dec 1 '14 at 15:27
• egreg: I have Icelandic in the document class. - But I forgot to input the babel package. :) – Bjartmar Dec 1 '14 at 15:31

If I add \usepackage[icelandic]{babel}, I get the following hyphenation points for those three words:

Eyja-fjalla-jök-ull
Hall-orms-stað-ar-skóg-ur
norð-ur-ljós


If you feel that the additional hyphenation points for those words are bad, you can add exceptions to the dictionary:

\documentclass[a4paper,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[icelandic]{babel}

\babelhyphenation[icelandic]{
Eyja-fjalla-jökull
Hall-orms-staðar-skógur
norður-ljós
}

\begin{document}
\parbox{0pt}{\hspace{0pt}Eyjafjallajökull
Hallormsstaðarskógur
norðurljós}
\end{document}


The \parbox is just to force TeX to hyphenate at every possible break. The output is

Note that adding a hyphenation exception for norðurljós doesn't affect norðurljósin, but only the exact word.

If you think that many words are broken incorrectly, you should file a bug report to the maintainers of the hyphenation patterns (Mojca Miklavec is in charge of them).

• Thanks for the answer. But it's not really what I'm trying to achieve. I have a thesis with approx. 40.000 words. I just wanted a list of the words that LaTeX breaks. - So I can put them inside '\babelhyphenation[icelandic]{ Word list here }' where I define myself the proper hyphenations. There are hundreds of words I wan't to – Bjartmar Dec 1 '14 at 18:02
• @bjartmar The hyphenation algorithm doesn't have a list of words; it works with patterns. – egreg Dec 1 '14 at 18:21
• Okay, thank you for the answer. I thought maybe it would be logged in some file or could be written in some file with some kind of code. – Bjartmar Dec 1 '14 at 18:45
• @bjartmar If you are certain that TeX hyphenates wrongly Icelandic, then the only way is to make it known to the maintainers of the hyphenation pattern set. – egreg Dec 1 '14 at 18:47
• @Sverre Exactly in the same way: \parbox{0pt}{\hspace{0pt}...}, commenting the \babelhyphen command. – egreg Dec 1 '14 at 21:07

If using LuaLaTeX is an option for you, you could use the showhyphens package (which requires LuaLaTeX) to show -- with a thin vertical red line -- every single hyphenation point that LaTeX thinks is valid. You won't need to go through all 100+ pages of your document; in general, checking the hyphenation points on just the first few pages will suffice.

% !TEX TS-program = lualatex
\documentclass[a4paper,12pt]{article}
\usepackage{polyglossia}
\setdefaultlanguage{icelandic}
\usepackage{fontspec,showhyphens}
\setmainfont{TeX Gyre Pagella} % choose a font that has all characters of Icelandic alphabet
\begin{document}
Eyjafjallajökull

Hallormsstaðarskógur

norðurljósin

%% now provide an explicit hyphenation exception list
\hyphenation{Eyja-fjalla-jökull Hall-orms-staðar-skógur norður-ljósin}

\bigskip  % repeat the same words
Eyjafjallajökull

Hallormsstaðarskógur

norðurljósin
\end{document}


As pointed out by @egreg in the comments, \usepackage[icelandic]{babel} should give the correct hyphenation patterns. You can check this with the testhyphens package.

\documentclass[a4paper,12pt]{report}
\usepackage[icelandic]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{testhyphens}

\begin{document}
\begin{checkhyphens}
Eyjafjallajökull
Hallormsstaðarskógur
norðurljósin
\end{checkhyphens}
\end{document}