For a pandoc application, I want to use a custom environment.
The environment's definition varies depending on a pandoc variable I defined (btw awesome feature!).
To manipulate the environment's content, I used the environ package as suggested here: Capture the content within an environment
To use markdown inside begin-end inside my source file, I used the trick suggested here: https://stackoverflow.com/a/41005796/1406122
MWE
\documentclass{article}
% some example environment
\usepackage{environ}
\NewEnviron{MyEnvironment}{%
% Depends... :) %
% \textsl{\BODY}
This content is hidden.
}
% some example environment
\newenvironment{myenvironment}%
{\bgroup\slshape}%
{\egroup}
% hide stuff from PANDOC
\let\Begin\begin
\let\End\end
\begin{document}
Some text.
\Begin{MyEnvironment}
\begin{itemize}
\item Some itemized content
\end{itemize}
\End{MyEnvironment}
\end{document}
However, these two tips don't mix well!
LaTeX Error: \begin{MyEnvironment} on input line 24 ended by \end{document}.
If the standard environment myenvironment is used instead, the above example compiles as expected. Yet with normal environments I can't modify its body content.
P.S.: To give some context, this was translated from a source MD-file:
Some text.
\Begin{MyEnvironment}
- Some itemized content
\End{MyEnvironment}
\end{env}, so why exactly are you using\Beginand\End? – daleif Jun 22 '18 at 10:15\beginand\endare treated differently by pandoc (markdown inside begin-end is not parsed, ref. https://stackoverflow.com/questions/40982836/latex-multicolumn-block-in-pandoc-markdown – LDericher Jun 22 '18 at 11:09environ, not something I can help with at the moment. But you should adjust your question so others can better understand the need for\Begin/End– daleif Jun 22 '18 at 11:20