[Tex/LaTex] tcblisting: two listings side by side

listingstcolorbox

can anybody tell me, how to place two source doe listings side by side within a tcblisting?

Something like:

  \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,sidebyside, listing only,mathescape=true]
  Listing A some code

  \tcblower

  Listing B more code
  \end{tcolorbox}

But with real listings…

Best Answer

You cannot use two source listings within a tcblisting, but you can put two listings side by side into a tcolorbox:

\documentclass{article}
\usepackage[skins,listings]{tcolorbox}

\begin{document}

\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,sidebyside]
\begin{lstlisting}[style=tcblatex]
Listing A some code
\end{lstlisting}
\tcblower%-----------------------------------------
\begin{lstlisting}[style=tcblatex]
Listing B more code
\end{lstlisting}
\end{tcolorbox}

\end{document}

enter image description here

Related Question