1

I'm having several short parboxes and just recognized, that LaTeX does not hyphen the first word.

\documentclass[a4paper]{article}
\usepackage{german}
\parskip=1ex

\begin{document} \frame{\parbox{2cm}{Jahresabschlussfeier}} \par \frame{\parbox{2cm}{abc Jahresabschlussfeier}} \par \frame{\parbox{2cm}{Jahresabschlussfeier abc}} \end{document}

LaTeX example output

What is the reason for this behaviour and how to let LaTeX hyphen the first word anyway?

Before anybody asks: \frame{\parbox{2cm}{Jahres\-abschluss\-feier}} would work, but since the content is taken from a database (parts of the actual TeX file are generated) I am not able to set \- manually.

Spock
  • 121
  • Is using LuaTeX an option? In that case, the problem should automatically go away, unless there is not hyphenation rule for such word, in that later case you can add to the preamble \hyphenation{Jahres-abschluss-feier} or whatever hyphenation is correct. – AboAmmar Jul 17 '20 at 11:25
  • 2
    \frame{\parbox{2cm}{\hspace{0pt}Jahresabschlussfeier}}should work. – leandriis Jul 17 '20 at 11:33
  • 2
    TeX will not, as a rule hyphenate the first word in a paragraph. Under "normal" situations, this isn't an issue, but in your instance you're in an edge case. As @leandriis notes, putting a 0pt \hspace at the beginning of the paragraph is sufficient to override the idea that the word is the first in a paragraph. – Don Hosek Jul 17 '20 at 16:16
  • \hspace{0pt} works fine. @leandriis or @Donald Hosek make your comment an answer and I will accept it. – Spock Jul 17 '20 at 17:23

0 Answers0