if i used \afterpage outside the my custom environment, it works fine:
\documentclass{article}
\usepackage{lipsum, afterpage}
\newenvironment{myenv}{
some macros that manipulate page numbering
} {
another macros here
}
\begin{document}
\lipsum[1-10]
\afterpage{
\begin{myenv}
\lipsum[3]
\end{myenv}
}
\lipsum[2]
\end{document}
i want to put the macro \afterpage inside the definition of the environment. i understand that this is necessary to use the macro \NewEnviron from the package environ:
\documentclass{article}
\usepackage{lipsum, afterpage, environ}
\NewEnviron{myenv}{
\afterpage{
some macros that manipulate page numbering
\BODY
another macros here
}
}
\begin{document}
\lipsum[1-10]
\begin{myenv}
\lipsum[3]
\end{myenv}
\lipsum[2]
\end{document}
but i get the error:
$ pdflatex my.latex ... ! Undefined control sequence. \AP@ ...that manipulate page numbering \par \BODY \par another macros here \... l.20 \lipsum[2]
! Undefined control sequence. \arterpageare you sure this is not a typo? – cgnieder Oct 20 '16 at 12:12/usr/share/texlive/texmf-dist/tex/latex/environ/environ.styis from debian packagetexlive-latex-extra-2012.20120611-2, and contains text:2008/06/18 v0.2. 2. the same error when using file fromtexlive-latex-extra-2014.20141024-1, that contains text:2014/05/04 v0.3– aleksandr barakin Oct 20 '16 at 13:12