When creating a custom glossary (nomenclature) with a longtable, the system only uses automatic word braking for cells with more than one word. The column is a p{...}-column and it works flawlessly in cells with more than one word. When I do manual word hyphenation via \- the correct line break is being created. For cells with more than one word the hyphenation is placed automatically.

Update: As suggested here compiling with LuaLaTeX solves the problem although I'm not happy with it. I also don't understand why the solution given by @DavidCarlisle didn't work.

Update 2: Problem is solved. The word being the first word in the paragraph was indeed the problem. Because I was defining a glossary style I had to add \hspace*{0pt}to the template of the column instead of the column definition. In my case this means that

\renewcommand*{\glossentry}[2]{%  Change the displayed items
    & \glstarget{##1}{\hspace*{0pt}\glossentryname{##1}} %
    & \glossentrydesc{##1}
    & \glsentryunit{##1}\tabularnewline

works, while

\setglossarystyle{long4col}% base this style on the list style
 \renewcommand{\glsgroupskip}{}%avoids grouping the elements by alphabetical order
 \renewenvironment{theglossary}{% Change the table type --> 4 columns
  \begin{longtable*}{>{\centering}p{.1\textwidth} >{\arraybackslash\hspace*{0pt}}p{.225\textwidth} p{.475\textwidth}>{\centering\arraybackslash}p{.1\textwidth}}}%

did not work.

  • 1
    tex never hyphenates the first word of a paragraph: load array package then use >{\hspace{0pt}}p{..} so there is a zero width space before the word Commented Apr 12, 2021 at 8:05
  • @DavidCarlisle I have just tried your suggestion. Unfortunately it does not work as it should.
    – Pauluuus
    Commented Apr 12, 2021 at 8:17
  • @Pauluuus - A quick follow-up on David Carlisle's comment. Formally, each cell in a tabular structure consists of one or more paragraphs; even a cell with a single word constitutes a paragraph. pdfTeX and XeTeX never hyphenate the first "object" (usually a word) in a paragraph. (Hence the advice to insert \hspace{0pt}, to ensure that the first word in the cell isn't the first object.) If you're free to use Lua(La)TeX, a nice side benefit of making the switch is that even the first word of a paragraph can get hyphenated withouth having to go through various contortions.
    – Mico
    Commented Apr 12, 2021 at 8:17
  • @Pauluuus - Please edit your posting to provide more detail on what exactly you're doing.
    – Mico
    Commented Apr 12, 2021 at 8:18
  • 1
    @Pauluuus - What about LuaLaTeX aren't you happy with? (LuaLaTeX is, with few exceptions, pretty much a superset of pdfLaTeX. If a document compiles without errors under pdfLaTeX, it should compile -- subject, possibly, to some minor adjustments -- under LuaLaTeX as well.) Regarding David Carlisle's suggestion to change p{...} to >{\hspace{0pt}}p{...} -- what exactly isn't working? Are you receiving error and/or warning messages? If so, what do they say? Incidentally, did you make sure to load the array package?
    – Mico
    Commented Apr 12, 2021 at 8:37


You must log in to answer this question.