fc7/polyglossia — Issue #32: Issue with greek numerals
Author: foucault
Created: 2011-11-06 12:13:52+00:00
State: open

I have encountered a problem regarding the use of greek numerals. This problem appears when you try to reference a figure of a subfloat that should be labeled with a greek letter. MWE

```tex
\documentclass{article}

\usepackage{subfig}
\usepackage{fontspec}
\usepackage{xkeyval}
\usepackage{polyglossia}
\setdefaultlanguage{greek}
\setotherlanguage{english}
\setmainfont[Mapping=tex-text]{GFS Didot}
\newfontfamily\greekfont[Mapping=tex-text]{GFS Didot}

\begin{document}
\begin{figure}
\centering
\subfloat[\label{fig1a}one]{}
\hskip5em
\subfloat[\label{fig1b}two]{}
\end{figure}
\ref{fig1a}
\end{document}
```

When you try to compile this with the latest polyglossia, xelatex will complain about a missing number. So, I checked the AUX file produced after the first run and it looks like this (only the relevant parts).

```tex
\newlabel{fig1a}{{1\greeknumber {\c@subfigure }}{1}}
\newlabel{sub@fig1a}{{(\greeknumber {\c@subfigure })}{\greeknumber {\c@subfigure }}}
\newlabel{fig1b}{{1\greeknumber {\c@subfigure }}{1}}
\newlabel{sub@fig1b}{{(\greeknumber {\c@subfigure })}{\greeknumber {\c@subfigure }}}
\@writefile{lof}{\contentsline {subfigure}{\numberline{(\greeknumber{\c@subfigure })}{\ignorespaces {one}}}{1}}
\@writefile{lof}{\contentsline {subfigure}{\numberline{(\greeknumber{\c@subfigure })}{\ignorespaces {two}}}{1}}
```

Even to my non-TeXnical eyes the repeated use of `\c@subfigure` seemed a bit wrong, so I re-run the MWE with xgreek, and the output is the following:

```tex
\newlabel{fig1a}{{1α\anw@true \anw@print \relax }{1}}
\newlabel{sub@fig1a}{{(α\anw@true \anw@print \relax )}{α\anw@true \anw@print \relax }}
\newlabel{fig1b}{{1β\anw@true \anw@print \relax }{1}}
\newlabel{sub@fig1b}{{(β\anw@true \anw@print \relax )}{β\anw@true \anw@print \relax }}
\@writefile{lof}{\contentsline {subfigure}{\numberline{(α\anw@true \anw@print \relax )}{\ignorespaces {one}}}{1}}
\@writefile{lof}{\contentsline {subfigure}{\numberline{(β\anw@true \anw@print \relax )}{\ignorespaces {two}}}{1}}
````

which seems just about right. Searching through the sources I found the definition of `\greek@numbers` in gloss-greek.ldf which differs from the way that it's handled in xgreek. So I've tried to replace lines 333-334 from current gloss-greek.ldf with the corresponding part from xgreek.sty. Specifically, turning this

```tex
\def\greek@alph##1{\protect\greeknumber{##1}}%
\def\greek@Alph##1{\protect\Greeknumber{##1}}%
```

to this

```tex
\def\greek@alph##1{\expandafter\greeknumeral\expandafter{\the##1}}%
\def\greek@Alph##1{\expandafter\Greeknumeral\expandafter{\the##1}}%
```
seems to solve all my problems with the greek numbers in subfloats.

I know that this is just an ugly copy-paste hack and may not be the correct way to address this problem so I'm opening this issue in hope that it will be helpful to addressing it properly.