I'm using packages minted
and booktabs
, and would like to put a minted environment within a tabular one. However, the following does not work:
\documentclass[11pt]{article}
\usepackage{minted}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{rp{0.5\textwidth}}
\toprule
A & B\\
\midrule
testing &
\begin{minted}{text}
testing
\end{minted}\\
\bottomrule
\end{tabular}
\end{document}
Any ideas how this can be achieved?
Best Answer
Make sure
\end{minted}
is on a line of its own. In the following example, the line containing \end{minted} contains additional charcaters:and this will trigger an error:
Simply moving the other characters to a new line solves the problem: