0

I would like to create documents that include markdown within environments that can be hidden. Currently, I am using pandoc with a custom template and following the instructions for hiding environments here and this workaround for masking environments from the pandoc markdown interpreter.

Sample markdown file:

---
instructor: true
---

This is text that should always appear

\Begin{inst}

This is some **markdown formatted** text that can be hidden/shown

\End{inst}

This is some *markdown formatted* text that will always be shown.

Template being used:

\let\Begin\begin
\let\End\end
\documentclass[12pt]{article}
\usepackage{comment}

\newif\ifshow
$if(instructor)$
\showtrue
$else$
\showfalse
$endif$
\ifshow
  \newenvironment{inst}{}{}
\else
  \excludecomment{inst}
\fi

\begin{document}

$body$

\end{document}

If I adjust the template to use just one of the features (environment hiding or markdown within environments) the setup works as desired. The current template works correctly if instructor: true is set in YAML and fails if instructor: false is set.

If I manually modify the .tex file produced, replacing \End{inst} with \end{inst}, I get proper rendering of the file. It appears as if excludecomment isn't recognizing that \End has been letted. Any ideas on how to make this process work?

  • I assume that I'm running into the problem mentioned here where the comment environment is looking for \end{inst} exactly. I'd like to find a workaround. – bobthechemist Jan 11 at 18:27

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.