# Using TeX for hyphenation only

I'd like to use TeX to hyphenate paragraphs of text--and only to hyphenate. My goal is to show hyphenated text on a webpage, with &shy; entities where a possible word break could happen.

So I'd like to get contents of an hbox of a paragraph after hyphenation in some machine-parseable format.

I could firstly put my paragraph into a box register, e.g. with \setbox42=\hbox{Hyphenate me please}, then I force the hyphenation algorithm to do its job (how?), then I show the contents of page with \showlists.

I have read the TeXbook, but I don't know how to force hyphenation to happen.

Any ideas?

• I guess LuaTeX might be helpful here. – Caramdir Mar 18 '11 at 21:19
• Have you seen hyphenator.js? It uses the same patterns as TeX to hyphenate. – Sophie Alpert Mar 19 '11 at 5:08

The command

\showhyphens{Hyphenate me please}


will produce

Underfull \hbox (badness 10000) in paragraph at lines 20--20

• not so fast -- if a word contains a discretionary hyphen (equivalent to &shy;), all other possible hyphenation points are ignored by tex. so you don't get both shown the same way with \showhyphens. maybe someone working with german conventions has come up with an alternate method in an extended tex, but not with the original tex program. – barbara beeton Mar 18 '11 at 22:43