3

According to tcolorbox documentation

enter image description here

and I would like to know which lower part options are available to change lower part aspect.

May be I misunderstand this text, but I would like to obtain something like this:

enter image description here

using listing outside text but I only get

enter image description here

even with colbacklower=red!30 option. With listing side text and bicolor skin, colbacklower works as expected: text (lower) part has a colored background

enter image description here

So the question is: is it possible to define a background color and frame for text parts when using listing outside text or text outside listing?

The code used for previous examples was:

\documentclass{article}
\usepackage[most]{tcolorbox}

\begin{document}

\begin{tcbraster}[raster equal height]
\begin{tcblisting}{listing only}
An equation:
\[
  1 + 1 = 2
\]
\end{tcblisting}
\begin{tcblisting}{text only, colback=red!30}
An equation:
\[
  1 + 1 = 2
\]
\end{tcblisting}
\end{tcbraster}

\begin{tcblisting}{bicolor, listing side text, colbacklower=red!30}
An equation:
\[
  1 + 1 = 2
\]
\end{tcblisting}

\begin{tcblisting}{bicolor, listing outside text, colbacklower=red!30}
An equation:
\[
  1 + 1 = 2
\]
\end{tcblisting}

\end{document}
  • Perhaps the documentation text for listings outside text is a copy - and - paste and is meant for listing side text actually only? – user31729 Jul 21 '16 at 16:43
3

Well, formatted with all lower part options should better be written formatted with most lower part options, because the outside text is put into a normal minipage. I think, adapting this for two tcolorboxes side by side is complicated (if possible at all). For this, we would need some not existing option like listing outside boxed text with some additional code.

Nevertheless, the desired output can be generated by setting up some new environment, e.g. myspecial:

\documentclass{article}
\usepackage[most]{tcolorbox}

\newenvironment{myspecial}[1]{%
  \begingroup\tcbwritetemp}%
{\endtcbwritetemp\endgroup%
  \begin{tcbitemize}[raster equal height,#1]%
    \tcbitem[]\tcbusetemplisting%
    \tcbitem[colback=red!30]\tcbusetemp%
  \end{tcbitemize}%
}

\begin{document}

\begin{myspecial}{}
An equation:
\[
  1 + 1 = 2
\]
\end{myspecial}

\end{document}

This gives:

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.