1

I have a document with many words of the form AAA+BBB that are not correctly broken apart ("hyphenated" without "hyphen") at the end of a line in a multi-column document. I was hoping for something along the lines of

\babelhyphenation{AAA\babelhyphen{empty}+\babelhyphen{empty}BBB}

Unfortunately, the +-sign is not treated as a letter. While the workaround of defining and using a new command via

\newcommand{\AAAplusBBB}{AAA\babelhyphen{empty}+\babelhyphen{empty}BBB}

works, I would really like to understand how I can fix the babel rule which would work tremendously better in my application with many different terms containing special characters.

Any hint is highly appreciated!

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Feb 9, 2022 at 5:10

1 Answer 1

2

It’s not possible with pdftex or (afaik) xetex, but if switching to luatex is an option, you can define a transform in the following way:

\documentclass{article}

\usepackage[english]{babel}

% 2 alphabetic, either + or ? or /, 2 alphabetic
\babelprehyphenation{english}{ {a}{a}[+?/]{a}{a} }
  { {}, {},
    {insert, penalty=50},
    {},
    {insert, penalty=50},
    {}, {}
  }

\begin{document}

\hsize1pt

XXX AAA+BBB YYY XXX AAA?BBB YYY XXX AAA/BBB YYY

\end{document}

The result will be something like:

XXX
AAA
+
BBB
YYY
XXX
AAA
?
BBB
YYY
XXX
AAA
/
BBB
YYY

This is not the only option, but here is the idea.

1
  • Thank you for the answer. Unfortunately, luatex is not an option for this particular document which requires pdftex from the publisher's side.
    – Aicko
    Feb 14, 2022 at 18:55

You must log in to answer this question.

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