# Using silence and authblk together

I am having trouble using silence and authblk together. I have this MWE:

\documentclass{article}
\usepackage{silence}
\usepackage{authblk}

\begin{document}
Hi
\end{document}


Running pdflatex temp_mwe.tex gives me this:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./temp.tex
LaTeX2e <2019-10-01> patch level 3
(/home/zach/.local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/10/25 v1.4k Standard LaTeX document class
(/home/zach/.local/texlive/2019/texmf-dist/tex/latex/base/size10.clo))
(/home/zach/.local/texlive/2019/texmf-dist/tex/latex/silence/silence.sty)
(/home/zach/.local/texlive/2019/texmf-dist/tex/latex/preprint/authblk.sty
! Undefined control sequence.
\sl@StoreMessage ...expand \string \def \sl@Tempa
{#1}\sl@RemoveGobble #1\sl...
l.113 \xdef\AB@author{\noexpand\AB@blk@and\@author
}


So the issue is happening when authblk is processed but seems to involve a line in silence, as evidenced by the macros beginning with \sl@. This is as far as my tex/latex knowledge goes. Any help would be much appreciated.

• On a more basic level, it says that "The control sequence at the end of the top line of your error message was never \def'ed," which I already knew, although I am not sure what counts as the top line here. Is it saying the "\slTempa" or "\author" is not defined? Jan 14, 2020 at 1:13
• Maybe it is "\author," since putting an \author{Me} before I load \authblk removes the error Jan 14, 2020 at 1:14
• How about reversing the load order? That seems to compile without problem.
– Werner
Jan 14, 2020 at 1:25
• the undefined command in the error message is \sl@Tempa but the code it is showing is \def\sl@Tempa{.. so it is trying to define that but has already gone wrong earlier Jan 14, 2020 at 8:11
• I would recommend not using it all, any message that is made by a package doesn't happen by accident or automatically. It is the explicit choice of the package author to catch some anomalous situation and warn about it. Silencing warning messages has, as you see here, a non zero chance of breaking the system with poor patches and an almost certain chance that you miss document errors by not seeing warnings. Jan 14, 2020 at 9:28

You can work around the problem in this way:

\documentclass{article}
\usepackage{etoolbox}
\usepackage{silence}
\makeatletter
\robustify\@latex@warning@no@line
\makeatother
\usepackage{authblk}

\begin{document}
Hi
\end{document}


The error happens during the loading of authblk, where the version of \@latex@warning@noline modified by silence needs to pass through \xdef. Disaster follows. With \robustify the macro isn't expanded by \xdef and the run can proceed well.