1

The following code presents a strange error found using polyglossia and soul packages.

\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage[variant=brazilian]{portuguese}
\setotherlanguage[variant=american]{english}
\usepackage{soul}
\begin{document}
\textit{bbb \& \ul{aaaaa}}
\end{document}

The error message is:

! Extra \else.
\portuguese@sh@tmp ...\portuguese@sh@next --\else
                                                  \expandafter \portuguese@@...
l.7 \textit{bbb \& \ul{aaaaa}}

Note that removing one "a" from \ul{aaaaa} does compile without error.

Is it a bug? From polyglossia or soul?

Ingmar
  • 6,690
  • 5
  • 26
  • 47
LEo
  • 772
  • 5
    they are incompatible. soul is fragile anyway and the portuguese language uses with xelatex special code to split hyphens and this breaks. (It breaks for 5 char as the language sets hyphenmin to (2,3) and so with 5 chars hyphenation is tried. Use lualatex and the lua-ul package. – Ulrike Fischer Oct 06 '22 at 17:20
  • I changed by the ulem package, using the \uline command. ("The package should be loaded with the normalem option, otherwise the \emph macro is changed to underline the text.") https://tex.stackexchange.com/questions/9550/why-does-underlined-text-not-get-wrapped-once-it-hits-the-end-of-a-line – LEo Oct 07 '22 at 17:38

1 Answers1

6

The incompatibility will be fixed in polyglossia v. 1.64.

Workaround until then is to disable splithyphens around the soul macros, as in:

    \documentclass{article}
    \usepackage{polyglossia}
    \setmainlanguage[variant=brazilian]{portuguese}
    \setotherlanguage[variant=american]{english}
    \usepackage{soul}
    \begin{document}
    \textit{bbb \& \textportuguese[splithyphens=false]{\ul{aaaaa}}}
    \end{document}
JSpitzm
  • 1,292