2

This simple file

\documentclass{standalone}

\usepackage{polyglossia}
   \setdefaultlanguage{portuguese}

\begin{document}
O modelo bond-plus.
\end{document}

generates the error:

! Illegal unit of measure (pt inserted).
<to be read again> 
                   \unskip 
l.8 \end{document}

under xelatex which seems to be a bit cryptic. It works apparently fine with lualatex. Encapsulatig the term "bond-plus" inside \emph{bond-plus} generates an even further cryptic error:

! Missing number, treated as zero.
<to be read again> 
                   \aftergroup 
l.7 O modelo \emph{bond-plus}

Is this something to be expected? I am running TL'22.

3
  • This seems to be an issue with the portuguese language module of polyglossia that only occurs with XeLaTeX. It compiles fine with LuaLaTeX and a couple of other languages I tested compiled without error with both engines.
    – moewe
    Nov 24, 2022 at 7:04
  • I think I could track this down to the XeLaTeX branch in \portuguese@hyphens in gloss-portuguese.ldf, but I don't know what exactly is happening there.
    – moewe
    Nov 24, 2022 at 7:11
  • 1
    You should probably report this as a bug at github.com/reutenauer/polyglossia/issues (even if you get an answer here, this is most likely something the polyglossia developers will want to know about).
    – moewe
    Nov 24, 2022 at 7:11

1 Answer 1

2

polyglossia doesn't correctly terminate an \hskip, and so it takes the plus as a continuation and then complains that a dimension is missing.

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{portuguese}
\makeatletter
\def\portuguese@@@splhyphen#1{%
  \ifnum\hyphenchar \font>0%
    \kern\z@\discretionary{-}{\char\hyphenchar\the\font}{#1}%
    \nobreak\hskip\z@\relax%added relax
  \else%
    #1%
  \fi%
}
\makeatother
\begin{document}

 O modelo bond-plus. 
\end{document}

Side-remark: an example using the standalone class is not a simple file, the class is quite complicated and should only be used if really needed to demonstrate an error.

3
  • Thanks. What would be the best class to use to demonstrate such problem? Nov 24, 2022 at 18:27
  • 1
    as in my example: article. Nov 24, 2022 at 18:44
  • And why would this affect xelatex and not lualatex? Nov 24, 2022 at 23:45

You must log in to answer this question.

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