0

I found a conflict between bm an etoolbox because later one redefines \@@end. It happens when it patches \enddocument command. Code from etoolbox:

\patchcmd\enddocument
  {\deadcycles}
  {\let\AfterEndDocument\@firstofone
   \@afterenddocumenthook
   \deadcycles}
  {}
  {\let\etb@@end\@@end
   \def\@@end{%
     \let\AfterEndDocument\@firstofone
     \@afterenddocumenthook
     \etb@@end}}

bm package expects that \@@end will be from latex.ltx Shouldn't etoolbox redefine \@@end only on \enddocument (if \patch\enddocument failed)?

Example with the problem:

\documentclass{article}
\makeatletter
\let\saved@enddocument\enddocument
\def\enddocument{\saved@enddocument}
\makeatother

\usepackage{bm}
\usepackage{etoolbox}
\begin{document}
$\boldsymbol{\sigma}$
\end{document}

Can it be fixed in TL1015?

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Linuxss
  • 957
  • 2
    I'm not quite sure what you are after here. You've deliberately altered \enddocument so that etoolbox can't patch it, leaving the 'fall back' of redefining \@@end as the only way to add a hook. It's not at all clear to me why you'd want to force this. – Joseph Wright Mar 19 '15 at 08:16
  • I've logged this as https://github.com/josephwright/etoolbox/issues/3: will think about it. – Joseph Wright Mar 19 '15 at 09:02
  • I redefined \enddocument just to show the problem. You can find a lot of \def\enddocument definitions in TL distributions latex packages. And one of them raised me that problem. – Linuxss Mar 19 '15 at 09:06
  • OK, I'll think about it. (BTW, you've timed this well as I've just picked up etoolbox from a period of there being no maintainer!) – Joseph Wright Mar 19 '15 at 09:23
  • @JosephWright Wrap the “fail” argument in \AtEndDocument, but this won't work if the class has redefined \enddocument in some fancy way. – egreg Mar 19 '15 at 09:28
  • @egreg Possibly, though I need to check that those customised \enddocument definitions still honour \AtEndDocument. See also David's comments in chat about \@@end. – Joseph Wright Mar 19 '15 at 09:30
  • probably you can define \outer\def\bm@end{\noexpand\noexpand\@@end} after loading bm (inside \makeatletter..) – David Carlisle Mar 19 '15 at 10:06
  • Yes, David, that helped. – Linuxss Mar 19 '15 at 14:16

0 Answers0