5

I'm new to LaTeX; is there a way to tell the TeX engine to generate the hyphenation of a given list of words as a text output file? For example:

abdomen
abduction
aberrance
...

What I want is something like:

ab-domen
ab-duc-tion
aber-rance
...

possibly as text.

3
  • 1
    Welcome to TeX.SE!
    – JamesT
    Commented May 28, 2023 at 10:47
  • 1
    After poking around a little I noticed that something was off and found this question about \showhyphens using the wrong hyphenation patterns in different languages, so... be aware of this.
    – giofrida
    Commented May 28, 2023 at 12:11
  • 1
    well as I said, \showhyphens shows the patterns in use at that point so you need to select the language first Commented May 28, 2023 at 16:44

2 Answers 2

8

\showhyphens writes this to the terminal and log:

\documentclass{article}

\showhyphens{
abdomen
abduction
aberrance
}

\begin{document}

\end{document}

Produces a log file with

[]  \OT1/cmr/m/n/10 ab-domen ab-duc-tion aber-rance
6
  • 1
    Actually, what if I want to use a different language other than English?
    – giofrida
    Commented May 28, 2023 at 11:50
  • 1
    @giofrida just set the language as you would normally before \showhyphens \usepackage[french]{babel} or whatever you use. You can use \showhyphens multiple times within the document and it will show the hyphenation active at that point Commented May 28, 2023 at 11:52
  • 1
    Sorry, maybe I should ask another question, but both \showhyphens and \begin{checkhyphens} give the wrong hyphenation, meaning that if I select my language, the hyphenation is actually different and "more" correct, but not on all words. In fact, if I remove the corresponding hyph-***.tex file from its folder (hyph-utf8), then the hyphenation still works the same, possibly meaning that the file was never used in the first place?
    – giofrida
    Commented May 28, 2023 at 13:45
  • 1
    hard to say without more information, but say \makeatletter\show\l@italian will show \char... if Italian is loaded in the fomat @giofrida Commented May 28, 2023 at 15:33
  • Well, yes, I get \l@italian=\char"23 in the console output, though it shows even without the file in place. Not that it means anything, but still.
    – giofrida
    Commented May 28, 2023 at 16:05
6

There are a number of ways to do this.

With LuaLaTeX, you can use the showhyphenation package.

\documentclass{article}
\usepackage{showhyphenation}
\begin{document}
%\parbox{0pt}{%
    abdomen
    abduction
    aberrance
%}
\end{document}

enter image description here

You can also place the words in a parbox of zero width. Each word (except the first word in some engines) will automatically line break at each of its hyphenation points.

\documentclass{article}
\begin{document}
\parbox{0pt}{%
    abdomen
    abduction
    aberrance
}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .