# Check all hyphenations within a document

I have a book project written in LaTeX, and I have found that quite a number of the hyphenations that TeX produced are wrong. It would be quite painful to scan the document for all hyphenation points, so I am looking for a tool that will collect all hyphenations from the document.

I have read about `hyphen-show`, but apparently it reads DVI files. I use LuaTeX to directly produce PDF, and that will probably mean that that tool is of no help to me.

-
Is the book in English or another language? As long you load the correct hyphenation file it should work correctly. –  Martin Scharrer Mar 22 '11 at 20:06
The language of the document does not matter. TeX is always bound to make the occasional mistake, that is why there is a `\hyphenation{}` command to define execptions. Mind you, 95% or more of all hyphenations in the document are indeed correct. –  MPi Mar 22 '11 at 20:10
As an aside, if you are writing in US English, then the 'usenglishmax' set of hyphenation patterns is somewhat better than the 'english' set. In latex you can access it by something like `\usepackage[english=usenglishmax]{hyphsubst}`. –  Lev Bishop Mar 23 '11 at 14:52
@doncherry. From ushyphmax.tex: "These patterns are based on the Hyphenation Exception Log published in TUGboat, Volume 10 (1989), No. 3, pp. 337-341, and a large number of incorrectly hyphenated words not yet published." –  Lev Bishop Apr 19 '11 at 14:40
As another aside, the most recent German hyphenation patterns (for `ngerman`) can be invoked via `\RequirePackage[ngerman=ngerman-x-latest]{hyphsubst}`. (I read somewhere that it's better to load the hyphenation patterns with `\RequirePackage` even before `\documentclass` but don't really remember why. –  doncherry May 1 '11 at 8:58

There is now a tool which might what you're looking for: `lua-check-chyphen`. It writes all used hyphenated words (including the chosen breakpoint) into an extra file. You have the choice to mark these hyphenation points in the document and you can use an external file ("whitelist") to make lua-check-hyphen to ignore these breakpoints for checking. See the documentation or my answer to another question for more details.

-
Just read about it in Die TeXnische Komödie. It’s awesome and exactly what I would have wanted. What a pity I do not write LaTeX anymore (at the moment), now that my academic career has come to a halt. –  MPi Sep 9 '12 at 19:15
@MPi thanks for the nice words! –  topskip Sep 9 '12 at 21:02

Use findhyph. How it works is you set `\tracingparagraphs=1` when processing your TeX, and then run a perl script on the log file to extract all hyphenations.

-
It looks like a great tool, and I even had it installed already! However, it produces no output at all. I did set `\tracingparagraphs=1` and the log file contains lots of stuff that seem to result just from this, but my `findhyph` does not use it. Is LuaTeX’s output format perhaps a bit different, or is findhyph getting confused by funny characters? –  MPi Mar 23 '11 at 20:49
I don't know about LuaTeX, but if you are running on windows it may be a LF vs CRLF line-ending issue. I vaguely remember that I had to convert the log file. –  Lev Bishop Mar 23 '11 at 20:54

I've made a small Python program find-hyphs that collects info about all hyphenations in a text file. For one-column pdf files it works fairly well with the output of `pdftotext -layout`.

-
A nice program, although its quality of course depends on the quality of pdftotext’s output. This fails ever so often (too many funny characters and ligatures, I suppose). However, I can at least use it, as opposed to the theoretically better approach that findhyph uses. –  MPi Mar 24 '11 at 19:43
`pdftotext -layout` is a great tip. Works very well. I combined it with a `grep` and a `less` to check all hyphenations: `pdftotext -layout x.pdf` and `grep -A 2 -e '-\$' x.txt | less ` and then highlight the trailing `-` with keystrokes `/-\$[Enter]`. –  towi Jan 23 '12 at 15:56