Is there any way to escape the scope of an environment, e.g. to get the \pgfplotsset command in the MWE below have an effect on the subsequent plot?
(I know that \newcommand doesn't have this problem but that isn't the question.)
Thanks!
\documentclass{article}
\usepackage{pgfplots}
\newenvironment{foo}{}{\pgfplotsset{axis x line=bottom};} % how can I make this pgfplotsset count?
\begin{document}
\begin{tikzpicture}
\begin{foo}
\end{foo}
\begin{axis}
\addplot[domain=-3e-3:3e-3,samples=201]{exp(-x^2 / (2e-3^2)) / (1e-3 * sqrt(2*pi))};
\end{axis}
\end{tikzpicture}
\end{document}

\pgfplotssetis in theend-environment section? – Aug 05 '14 at 22:46\pgfplotssetcommand. Obviously, that wouldn't be a MWE, so sticking the\pgfplotssetin the end environment section is the closest thing. In particular, I really don't want it as part of the environment itself. – JPi Aug 05 '14 at 22:51grouped? – Aug 05 '14 at 22:52\aftergroupcommand, but I am unsure, if it works in this context – Aug 05 '14 at 23:00\global\pgfplotsset, but I am unsure about this too – Aug 05 '14 at 23:02\global\pgfplotssetwon't work. Definition from pgfplotscore.code.tex:\def\pgfplotsset#{\pgfqkeys{/pgfplots}}. The answers to http://tex.stackexchange.com/questions/15204/is-there-a-way-to-set-a-global-key-value-using-pgfkeys can probably be used to solve your problem. – jub0bs Aug 05 '14 at 23:17