As shown in Issues with leipzig and glossaries used together, there is a problem when using the package leipzig
with the glossaries
package since the leipzig
package relies on deprecated commands from glossaries
.
The answer to the question solves the issue, but the answer suggests modifying the .sty
file, which I would rather not do.
I have tried to patch the \SetLeipzigDisplayStyle
command, but I have not been successful. According to egreg's answer to Please tutor the usage of patchcmd and xpatch, one should use xpatch
when trying to patch a command with an optional argument. \SetLeipzigDisplayStyle
is such a command, but trying to patch it with \xpatchcmd
does not work for me. How can I fix the issue without resorting to (copying and) modifying the .sty
file?
MWE
% !TEX TS-program = arara
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: pdflatex
\documentclass{article}
\usepackage{expex}
\usepackage[nomain,nostyles]{glossaries}
\usepackage{glossary-inline}
\usepackage{leipzig}
\makeglossaries
\usepackage{xpatch}
\xpatchcmd{\SetLeipzigDisplayStyle}{%
\defglsdisplay[#1]{\leipzigfont{##1}##4}%
\defglsdisplayfirst[#1]{\firstleipzigfont{##1}##4}%
}{%
\renewcommand*{\glstextformat}[1]{\leipzigfont{#1}}%
}{}{}
\begin{document}
\ex
\begingl
\gla mulle//
\glb \First\Sg:\Dat{}//
\endgl
\xe
go.\Pst{}
\printglossary[style=inline,type=\leipzigtype]
\end{document}
You can see that it still produces the problem noted in Issues with leipzig and glossaries used together.
.log
file for that error and nothing comes up.\SetLeipzigDisplayStyle
. Why not just redefine it then rather than patching it? Also, do you want to redefine it to..##1..
rather than..#1..
?:)
I can't seem to get that to work, either, though.\renewcommand*{\SetLeipzigDisplayStyle}[1]{\renewcommand*{\glstextformat}[1]{\leipzigfont{#1}}}
doesn't work, which is why I ended up trying to patch it. I'm sort of curious why patching doesn't seem to work, but also, at this point, any solution would be fine. As for#1
vs.##1
, I'm honestly not sure what the difference is. Does this have something to do withglossaries
? I was just trying to change it to the accepted solution in the linked question.\renewcommand
.