1
\documentclass{article}
\usepackage[english]{babel}
\usepackage{filecontents}

\begin{filecontents*}{english.yp}
    hom-ony-mous
    gene-ral-ly
\end{filecontents*}{english.yp}

\hyphenation{
    \input english.yp
}

\begin{document}
spinach.
\end{document}

This does not compile, (but does if I move \hyphenation{ and } in the first and last lines of the file.) Why not?

2

The LaTeX implementation of \input is not expandable in order to allow a test for braces. However, \hyphenation requires an argument which fully expands to text. You therefore have to use the underlying primitive

\documentclass{article}
\usepackage[english]{babel}
\usepackage{filecontents}

\begin{filecontents*}{english.yp}
    hom-ony-mous
    gene-ral-ly
\end{filecontents*}
\makeatletter
\hyphenation{
    \@@input english.yp
}
\makeatother
\begin{document}
spinach.
\end{document}
  • Thanks! But this example turned out to be too minimal. Posting another. – Toothrot Apr 1 '16 at 12:02

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.