[XeTeX] mathspec and polyglossia

Tobias Schoel liesdiedatei at googlemail.com
Sat Mar 10 09:18:29 CET 2012


Hi,

polyglossia documentation states, that babel shorthands ("-shorthands) 
are only implemented for German, Dutch and Catalan. This is wrong or at 
least misleading as gloss-russian.ldf does indeed invoke 
babelshorthands. I'm neither tex-expert nor polyglossia expert, but 
lines 29 to 84 from gloss-russian.ldf damn look like babelshorthands to me:

\define at boolkey{russian}[russian@]{babelshorthands}[false]{}

\setkeys{russian}{spelling,numerals}

\ifsystem at babelshorthands
   \setkeys{russian}{babelshorthands=true}
\else
   \setkeys{russian}{babelshorthands=false}
\fi

\ifcsundef{initiate at active@char}{%
   \input{babelsh.def}%
   \initiate at active@char{"}%
}{}

\def\russian at shorthands{%
   \bbl at activate{"}%
   \def\language at group{russian}%
%  \declare at shorthand{russian}{"`}{„}%
%  \declare at shorthand{russian}{"'}{“}%
%  \declare at shorthand{russian}{"<}{«}%
%  \declare at shorthand{russian}{">}{»}%
   \declare at shorthand{russian}{""}{\hskip\z at skip}%
   \declare at shorthand{russian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}%
   \declare at shorthand{russian}{"=}{\nobreak\-\hskip\z at skip}%
 
\declare at shorthand{russian}{"|}{\textormath{\nobreak\discretionary{-}{}{\kern.03em}\allowhyphens}{}}%
   \declare at shorthand{russian}{"-}{%
     \def\russian at sh@tmp{%
       \if\russian at sh@next-\expandafter\russian at sh@emdash
       \else\expandafter\russian at sh@hyphen\fi
     }%
     \futurelet\russian at sh@next\russian at sh@tmp}%
   \def\russian at sh@hyphen{%
     \nobreak\-\bbl at allowhyphens}%
   \def\russian at sh@emdash##1##2{\cdash-##1##2}%
   \def\cdash##1##2##3{\def\tempx@{##3}%
   \def\tempa@{-}\def\tempb@{~}\def\tempc@{*}%
    \ifx\tempx@\tempa@\@Acdash\else
     \ifx\tempx@\tempb@\@Bcdash\else
      \ifx\tempx@\tempc@\@Ccdash\else
       \errmessage{Wrong usage of cdash}\fi\fi\fi}
   \def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi
     \cyrdash\hskip.2em\ignorespaces}%
   \def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi
    \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z at skip\ignorespaces}%
   \def\@Ccdash{\leavevmode
    \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%
   \ifx\cyrdash\undefined
     \def\cyrdash{\hbox to.8em{--\hss--}}
   \fi
   \declare at shorthand{russian}{",}{\nobreak\hskip.2em\ignorespaces}%
}

\def\norussian at shorthands{%
   \@ifundefined{initiate at active@char}{}{\bbl at deactivate{"}}%
}

The real problem seems to be lines 39 to 42, in which babelsh.def is 
referenced, which does even more babelshorthand stuff. (probably that's 
why it's called babelshORTHANDS.def)

So I commented them out and your minimal example worked with polyglossia 
and mathspec.

Concerning mathspec, the problem is the macro \alpha which expands to 
"α. The double quotes are mathspecs means to overcome the missing math 
metrics in text fonts. It'd probably be better, to implement this 
differently, but they at least document it properly.

bye

Toscho

On 09.03.2012 21:11, Vadim Radionov wrote:
> Hi, Tobias,
>
> I don't need "-shorthands with unicode, but how can I switch them off?
>
> Vadim
>
> On Fri, Mar 9, 2012 at 7:49 PM, Tobias Schoel
> <liesdiedatei at googlemail.com <mailto:liesdiedatei at googlemail.com>> wrote:
>
>     When switching to xetex, I had problems with mathspec and the
>     "-shorthands as well (I write in German). You should work without
>     "-shorthands or without mathspec. It's probably easier to work
>     without mathspec, if you can work with unicode-math instead (saying:
>     you can use a suitable font).
>
>
>     On 08.03.2012 22:43, Vadim Radionov wrote:
>
>         Dear list members,
>
>         I have a problem using mathspec with Greek key together with
>         polyglossia
>         with some languages, probably those using " shorthands. Check the
>         following example (with and without (Greek) or Russian language
>         selection):
>
>         \documentclass{minimal}
>         \usepackage{mathspec}
>         \setmathsfont(Digits,Latin,__Greek){Minion Pro}
>
>         \usepackage[no-sscript]{__xltxtra}
>         \usepackage{polyglossia}
>
>         \setdefaultlanguage{russian}
>         \newfontfamily\russianfont{__Minion Pro}
>
>         \begin{document}
>         Проверка: $a+b=\alpha$
>         \end{document}
>
>         Is there any workaround, or mathspec should not be used?
>
>         Thank you in advance,
>         Vadim
>
>
>
>
>     ------------------------------__--------------------
>     Subscriptions, Archive, and List information, etc.:
>     http://tug.org/mailman/__listinfo/xetex
>     <http://tug.org/mailman/listinfo/xetex>
>
>


More information about the XeTeX mailing list