PhelypeOleinik / lipsum

150 paragraphs of Lorem ipsum dummy text for LaTeX
12 stars 7 forks source link

lipsum and polyglossia interaction #10

Closed pablgonz closed 3 years ago

pablgonz commented 3 years ago

Hi, this file compiles without problems using XeLaTeX or LuaLaTeX:

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{latin}
\begin{document}
\end{document}

but when adding the lipsum package (no matter the order):

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{latin}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\end{document}

you get:

(./test.aux)
! Missing } inserted.
<inserted text> 
}
l.5 \begin{document}

? 
! Missing } inserted.
<inserted text> 
}
l.5 \begin{document}

? 
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/ts1cmr.fd) [1{/usr/local/tex
live/2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)
! Missing } inserted.
<inserted text> 
}
l.7 \end{document}

? 
! Missing } inserted.
<inserted text> 
}
l.7 \end{document}

? 
)

As a note, if the \lipsum macro is commented the file compiles without errors.

u-fischer commented 3 years ago

hyphenrules is an environment and in the case of polyglossia the end code is highly relevant as polyglossia writes \bgroup and \egroup commands to toc/lof/lot (this will perhaps change again: https://github.com/reutenauer/polyglossia/issues/505). So lipsum shouldn't use \hyphenrules as command.

PhelypeOleinik commented 3 years ago

@u-fischer Oh, that's it. Thanks!

It's a tricky spot, because an environment will add \begingroup..\endgroup and we'll be back to #1, but \hyphenrules..\endhyphenrules doesn't work either because it relies on the grouping to restore the previous language. polyglossia is not making life easier...

With babel I can just do \hyphenrules again with the old language and be good to go...

PhelypeOleinik commented 3 years ago

I wonder how evil would it be if I just override \xpg@set@group@aux and \xpg@set@group@aux before doing \hyphenrules... That'd prevent the \bgroup being written: that grouping doesn't seem to be useful for \lipsum...