Skip to content

Specifying executable code chunk in LaTeX with 'exec' inside lstlisting environment causes compilation error #905

Description

@fkmendes

Currently, executable code chunks in LaTeX are specified like this:

\begin{lstlisting}[language=Python, exec]
# some executable Python code
\end{listing}

this cannot be compiled by LaTeX, however. Here's a possible solution:

% start exec
\begin{lstlisting}[language=Python, exec]
# some executable Python code
\end{listing}
% end exec

Having a start and end string makes parsing easy.
Note that % marks commented for LaTeX (so it doesn't cause compilation errors).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions