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



% some example environment
%  Depends... :) %
%  \textsl{\BODY}
  This content is hidden.

% some example environment

% hide stuff from PANDOC


Some text.

\item Some itemized content


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.


- Some itemized content

  • 3
    And environ construction will look for an explicit string \end{env}, so why exactly are you using \Begin and \End? – daleif Jun 22 '18 at 10:15
  • \begin and \end are treated differently by pandoc (markdown inside begin-end is not parsed, ref. stackoverflow.com/questions/40982836/… – LDericher Jun 22 '18 at 11:09
  • Then you'll probably need a personally readjusted version of environ, 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.