29

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.

8
  • 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
  • 1
    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
  • 3
    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
  • 1
    @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
  • 2
    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
16

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.

1
  • 1
    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
19

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.

3
  • 1
    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'm experiencing the exact same problem. findhyph works with pdflatex, but not lualatex. Does anyone have an explanation and maybe even a solution for that? – Martin Jul 5 '18 at 15:17
8

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.

2
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.
https://tex.stackexchange.com/questions/14063/check-all-hyphenations-within-a-document
tex.stackexchange.com
crawl=CC-MAIN-2021-31
197015
application/http; msgtype=response
sha1:FZOTROQSJ47N3SPBO6W2C4Z2WVZ4OAYW
<urn:uuid:105f4265-7ac4-48c1-afd3-a5f69879d328>
2021-08-02T16:48:17Z
151.101.1.69
text/html
sha1:TVLRMOL5KHYZWA2UDQFPMU66QBRIERZI
<urn:uuid:d833ccf3-4fec-4f60-b51d-a6ca570fc7d0>
https://tex.stackexchange.com/questions/14063/check-all-hyphenations-within-a-document
response
<urn:uuid:f167a9b4-9d5b-4255-9f9c-e2fd99fb1d59>
isPartOf: CC-MAIN-2021-31
publisher: Common Crawl
description: Wide crawl of the web for July/August 2021
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-191.ec2.internal
software: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/