pgf-tikz/pgfplots

`\usepgfplotslibrary{colorbrewer}` breaks `\@`

Closed this issue · 2 comments

Normally, when used after a period \@ marks it as a non-end-of-sentence period. But once you load the colorbrewer library, it seems to redefine \@ such that it simply gobble the space after it. Even stranger, if you manually load the TikZ colorbrewer before the PGFPlots one, the effect goes away.

MWE:

\documentclass{article}

\usepackage{pgfplots}
% \usetikzlibrary{colorbrewer}
\usepgfplotslibrary{colorbrewer}

\begin{document}%
\noindent%
Test. Test. Test. Test.\\%
Test. Test\@. Test.\@ Test.\\%

\noindent%
x\meaning\@ x\\
x\the\csname @m\endcsname x\\

\end{document}

image

and with the manually loaded TikZ library

image

Somehow \usepgfplotslibrary{colorbrewer} leaves category code of @ altered (from 12 to 11). Then \@ ignores spaces right after it, hence Test.\@ Test. becomes Test.\@{}Test.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\pgferror{\the\catcode`\@} % ! Package pgf Error: 12.
\usepgfplotslibrary{colorbrewer}
\pgferror{\the\catcode`\@} % ! Package pgf Error: 11.

\begin{document}
\noindent
Test. Test.   Test.     Test.\\
Test. Test\@. Test.\@   Test.\\
Test. Test\@. Test.\@{} Test.\\
\end{document}

Duplicate of #216, which has been fixed by #354, but unfortunately the fix is not released.

You can add a \makeatother right after \usepgfplotslibrary{colorbrewer} as a workaround.