9

The following code fails:

\documentclass{article}
\usepackage{expex}
\usepackage{unicode-math}% Works without this

\begin{document}
\pex<ex>
\a<foo>\begingl
\gla  foo//
\glb  foo//
\glft foo//
\endgl
\xe
\end{document}

After removing unicode-math it works perfectly though. I need unicode-math only for using an OpenType font in math-mode. I didn't find any package other than unicode-math useful for this purpose. Is there any alternative available which I missed? Can I make unicode-math ignore the problematic command with some trickery? Note that I am using LuaLaTeX with fully updated TeX Live.

1
  • 1
    I have asked this question here too.
    – Niranjan
    Dec 4, 2023 at 15:39

2 Answers 2

5

The basic problem as outlined in egreg's answer is that unicode-math defines a \gla command, and this assignment is done at the beginning of the document. The \gla command in ExPex is defined whenever the glstyle is set, so it is sufficient to simply reset the style using \AtBeginDocument:

\documentclass{article}
\usepackage{expex}
\usepackage{unicode-math}% Works without this
\AtBeginDocument{\lingset{glstyle=wrap}}
\begin{document}

\pex<ex>
\a<foo>\begingl
\gla  foo//
\glb  foo//
\glft foo//
\endgl
\xe
\end{document}

output of code

1
  • Works fantastically. Thanks a lot!
    – Niranjan
    Dec 5, 2023 at 16:15
6

unicode-math defines \gla to give U+2AA5 GREATER-THAN BESIDE LESS-THAN ⪥

If you don't need the glyph you can save its definition and restore it at the appropriate time

\documentclass{article}
\usepackage{expex}

\NewCommandCopy{\expexgla}{\gla}

\usepackage{unicode-math}

\AtBeginDocument{\RenewCommandCopy{\gla}{\expexgla}}

\begin{document}

\pex<ex>
\a<foo>
\begingl
\gla  foo//
\glb  foo//
\glft foo//
\endgl
\xe

\end{document}

The clue was the message

! Missing character: There is no ⪥ (U+2AA5) in font [lmroman10-regular]:mapping=tex-text;.

and the corresponding line in unicode-math-table.tex

\UnicodeMathSymbol{"02AA5}{\gla                      }{\mathrel}{greater-than beside less-than}%

enter image description here

As Alan Munn points out in comments, one can dispense with \NewCommandCopy and do

\documentclass{article}
\usepackage{expex}
\usepackage{unicode-math}

\makeatletter
\AtBeginDocument{\RenewCommandCopy{\gla}{\glw@gla}}
\makeatother

\begin{document}

\pex<ex>
\a<foo>
\begingl
\gla  foo//
\glb  foo//
\glft foo//
\endgl
\xe

\end{document}

One can also dispense With \makeatletter and \makeatother

\AtBeginDocument{\ExpandArgs{cc}\RenewCommandCopy{gla}{glw@gla}}

Note: in no place of expex.tex one finds where \gla is defined as \glw@gla. This is well hidden in

\definelabeltype{alpha}{labelgen=char,pexcnt=`a,labelformat=A.,
   fullrefformat=XA,labelalign=left,labelwidth=.72em}
15
  • 1
    @Niranjan Yes, in source2e you'll find \DeclareRobustCommand\AtBeginDocument{\AddToHook{begindocument}}
    – mbert
    Dec 4, 2023 at 17:54
  • 1
    @mbert It's exactly the same
    – egreg
    Dec 4, 2023 at 17:54
  • 1
    @egreg Yes I know, I was just answering Niranjan's question. The lthooks doc does call \AtBeginDocument a legacy interface (though I'm aware "legacy" here does not mean "deprecated")
    – mbert
    Dec 4, 2023 at 17:56
  • 1
    Alternatively, without using the\NewCommandCopy command: \AtBeginDocument{\RenewCommandCopy{\gla}{\glw@gla}}
    – Alan Munn
    Dec 4, 2023 at 18:58
  • 1
    @AlanMunn Which is well hidden.
    – egreg
    Dec 4, 2023 at 21:52

You must log in to answer this question.

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