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?


% !TEX TS-program = arara
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: pdflatex






\gla mulle//
\glb \First\Sg:\Dat{}//




You can see that it still produces the problem noted in Issues with leipzig and glossaries used together.

enter image description here

  • @GonzaloMedina I'm not getting that error I don't think? I just tried searching the .log file for that error and nothing comes up.
    – Adam Liter
    Commented Mar 2, 2015 at 3:27
  • @AdamLiter: Your patch merely seems to attempt to redefine \SetLeipzigDisplayStyle. Why not just redefine it then rather than patching it? Also, do you want to redefine it to ..##1.. rather than ..#1..?
    – Werner
    Commented Mar 2, 2015 at 4:53
  • @Werner That's a good point ... and probably the more sensible thing to do ... :) 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 with glossaries? I was just trying to change it to the accepted solution in the linked question.
    – Adam Liter
    Commented Mar 2, 2015 at 5:07
  • @AdamLiter You're not trying a patch, as the text you want to substitute is the whole replacement text of the macro. So, if this patch were successful, it wouldn't be different from doing \renewcommand.
    – egreg
    Commented Mar 2, 2015 at 7:39
  • @AdamLiter Sorry about that. Most probably some leftover auxiliary file I had on my machine. Commented Mar 2, 2015 at 13:58

1 Answer 1


I don't think it's possible to do patches with etoolbox when the search text contains ## (note that xpatch is built upon etoolbox).

Also, the requested patch is just equivalent to


so it's not clear why you're looking for a patch.

By the way, xpatch is not strictly needed for the particular purpose, as \SetLeipzigDisplayStyle is not defined with an optional argument.

If you insist in doing a patch,


does the job.

But if I subsequently add



I find EQUAL in the log file, so patching is indeed not necessary and a redefinition should be used.


  • Whether this will do the job connected with the interaction between leipzig and glossaries is beyond the scope of the question. The proposed patch doesn't seem to solve the problem to begin with.
    – egreg
    Commented Mar 2, 2015 at 8:39
  • Shouldn't it be \renewcommand*{\SetLeipzigDisplayStyle}[1]{%, not \renewcommand*{\SetLeipzigDisplayStyle}{%? But anyway, you're right about the patch not seeming to solve the problem. What I really don't understand though, is why patching/\renewcommandinging \SetLipzigDisplayStyle in the preamable doesn't solve the problem, but copying and modifying the definition in the .sty file does. Shouldn't they have the same behavior? I guess that's a new question, but I'm really puzzled.
    – Adam Liter
    Commented Mar 2, 2015 at 15:55
  • Using your test in a .tex file that is using a modified version of leipzig also returns EQUAL in the .log file, but the behavior is different. I'm so confused.
    – Adam Liter
    Commented Mar 2, 2015 at 16:01
  • @AdamLiter I fixed the source; but I don't find differences between the behaviors with \regexpatchcmd and \renewcommand
    – egreg
    Commented Mar 2, 2015 at 16:31
  • I also don't see any differences in behavior with \regexpatchcmd and \renewcommand, either, but if you copy and modify the .sty file itself so that \SetLeipsigDisplayStyle is defined as \renewcommand*{\glstextformat}[1]{\leipzigfont{#1}}% inside the .sty file then the undesired behavior goes away, even though your conditional test returns EQUAL in the .log file in all three cases.
    – Adam Liter
    Commented Mar 2, 2015 at 16:37

You must log in to answer this question.

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