0

I want to create a custom list while using enumitem and polyglossia.

Running latexmk main on this

main.tex:

\documentclass[12pt, a4paper]{report}
\usepackage{polyglossia}
\setmainlanguage{czech}
\usepackage{enumitem}
\newlist{enumfp}{enumerate}{1}
\setlist[enumfp]{label=\textbf{FP-\arabic*},ref=FP-\arabic*}

\begin{document}
\begin{enumfp}
    \item A
    \item B
    \item C
\end{enumfp}
\end{document}

Produces this output

! Missing number, treated as zero.
<to be read again> 
                   \c@- 
l.10     \item A
                
? 
! Missing number, treated as zero.
<to be read again> 
                   \c@- 
l.11     \item B
                
? 
! Missing number, treated as zero.
<to be read again> 
                   \c@- 
l.12     \item C
                
? 
[1] (main.aux) )

But as soon as I remove the polyglossia package and setmainlanguage, the document is produced without any problems.

.latexmkrc:

$pdf_mode = 5;
$xelatex = "xelatex --shell-escape %O %S";
$xdvipdfmx = "xdvipdfmx -z 0 -o %D %O %S";
$dvi_mode = 0;
$postscript_mode = 0;
$hash_calc_ignore_pattern{'timestamp'} = '^';

2 Answers 2

1

The czech language file contains code that looks ahead at hyphens to implement special hyphenation rules. With XeLaTeX this is rather fragile (your code runs with luaLaTeX).

You can protect the hyphen by putting something between it and the following \arabic:

\setlist[enumfp]{label=\textbf{FP-{}\arabic*},ref=FP-\arabic*}

or

\setlist[enumfp]{label=\textbf{FP-\relax\arabic*},ref=FP-\arabic*}
0

The problem is the hyphen - inside the label. Polyglossia replaces it with something else. Using the hyphenat package's \hyp{} solved the problem.

\documentclass[12pt, a4paper]{report}
\usepackage{polyglossia}
\setmainlanguage{czech}
\usepackage{hyphenat}
\usepackage{enumitem}
\newlist{enumfp}{enumerate}{1}
\setlist[enumfp]{label=\textbf{FP\hyp{}\arabic*},ref=FP\hyp{}\arabic*}

\begin{document}
\begin{enumfp}
    \item A
    \item B
    \item C
\end{enumfp}
\end{document}

You must log in to answer this question.

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