Bug#840700: g-brief2: 'Command \c@blockzahl already defined' on multiple inclusions
Package: texlive-latex-extra
Version: 2016.20161008-1
Severity: minor
Tags: patch
Hi,
g-brief2 currently does not support multiple inclusions. This would be helpful
for bulk letters and is trivial to fix.
Reproducing the issue:
> $ cat simple.tex
> \documentclass[ngerman]{g-brief2}
> \Gruss {}{1cm} % this can't be left out due to a potential another bug
> \begin{document}
>
> \begin{g-brief}
> page one
> \end{g-brief}
>
> %\newpage
> %\begin{g-brief}
> %page two
> %\end{g-brief}
>
> \end{document}
> $ pdflatex simple.tex; echo $?
> ...
> 0
> $ sed -i 's/^%//' simple.tex
> $ cat simple.tex
> \documentclass[ngerman]{g-brief2}
> \Gruss {}{1cm} % this can't be left out due to a potential another bug
> \begin{document}
>
> \begin{g-brief}
> page one
> \end{g-brief}
>
> \newpage
> \begin{g-brief}
> page two
> \end{g-brief}
>
> \end{document}
> $ pdflatex simple.tex; echo $?
> ...
>
> ! LaTeX Error: Command \c@blockzahl already defined.
> Or name \end... illegal, see p.192 of the manual.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type H <return> for immediate help.
> ...
>
> l.14 \end{document}
>
> ? ^\Quit
> 131
> $
A trivial patch ensures that the counter is not defined multiple times and
reset if needed:
> --- /usr/share/texlive/texmf-dist/tex/latex/g-brief/g-brief2.cls 2016-10-13 23:10:26.630778157 +0200
> +++ /usr/share/texlive/texmf-dist/tex/latex/g-brief/g-brief2.cls 2016-10-13 23:10:31.726871803 +0200
> @@ -333,7 +333,7 @@
> \unitlength1mm
> \begin{picture}(0,0)
> \put(-9,0){\parbox{180mm}{
> - \tiny \newcounter{blockzahl} \def\@blockbreite{170mm}
> + \tiny \ifdef{\theblockzahl}{\setcounter{blockzahl}{0}}{\newcounter{blockzahl}} \def\@blockbreite{170mm}
> \iftrennlinien \rule{180mm}{0.5pt} \fi
> \ifthenelse{
> \equal{\namezeilea}{\empty} \and \equal{\namezeileb}{\empty} \and
Please include that patch. Thanks!
All the best,
Julius
Reply to: