5

I'm typesetting text within tcolorbox-boxes, which works quite fine. For doing so, I've defined a couple of commands and just call them for each paragraph. But when I include an enumerate- or itemize-List in such a tcolorbox, the first item of the first is set much more left than the following items, this is really weird. Even more weird, when I include another list before my desired list in the tcolorbox, it works quite well for the second list:

enter image description here

So it's only the first list that's set wrongly. How can this be? Here's a MWE for my problem.

\documentclass[oneside,12pt]{scrreprt}
\usepackage[ngerman]{babel} %Deutsche Sprachunterstützung
\usepackage{scrpage2} %Kopf- und Fußzeilen
\usepackage[utf8]{inputenc} %Umlaute
\usepackage{dramatist}
\usepackage[x11names]{xcolor}
\usepackage{tcolorbox}
%\pagestyle{scrheadings}

\begin{document}

\setlength{\parskip}{3mm}
\setlength{\parindent}{0pt} %Dummes Absatz-Eingerücke abstellen

\newcommand{\sep}{\\[3mm]}

\newcommand{\ex}[1]{\item\begin{tcolorbox}[title=Lorem Ipsum,colframe=Orange1]#1\end{tcolorbox}}
\newcommand{\blindtext}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.}
%SteelBlue1, Aquamarine2, DarkOliveGreen2

First list in tcolorbox does not work:
\begin{drama}
  \ex{\blindtext
  \begin{enumerate}
    \item foo
    \item bar
  \end{enumerate}
  \blindtext}
\end{drama}

Second list works well:
\begin{drama}
  \ex{\blindtext
  \begin{enumerate}
    \item foo
    \item bar
  \end{enumerate}
  \blindtext
  \begin{enumerate}
    \item foo
    \item bar
  \end{enumerate}
  \blindtext}
\end{drama}
\end{document}

The dramatist-package used here is found here.

7

The \item from the dramatist package confuses the tcolorbox settings as well as the following enumerate environment. A \leavevmode just before \begin{tcolorbox}...\end{tcolorbox} cures this.

I strongly suggest to use enumitem package to adjust the spacings of the enumerate and as well as using a special \newtcolorbox definition which is easier to maintain than to edit the \ex macro over and over again.

\documentclass[oneside,12pt]{scrreprt}
\usepackage[ngerman]{babel} %Deutsche Sprachunterstützung
\usepackage{scrpage2} %Kopf- und Fußzeilen
\usepackage[utf8]{inputenc} %Umlaute
\usepackage{dramatist}
\usepackage[x11names]{xcolor}
\usepackage{enumitem}
\usepackage{tcolorbox}
%\pagestyle{scrheadings}

\begin{document}

\setlength{\parskip}{3mm}
\setlength{\parindent}{0pt} %Dummes Absatz-Eingerücke abstellen

\newcommand{\sep}{\\[3mm]}

\newcommand{\ex}[1]{\item \leavevmode\begin{tcolorbox}[title=Lorem Ipsum,colframe=Orange1]#1\end{tcolorbox}}
\newcommand{\blindtext}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi.}
%SteelBlue1, Aquamarine2, DarkOliveGreen2

First list in tcolorbox does not work:
\begin{drama}
  \ex{\blindtext
  \begin{enumerate}
    \item foo
    \item bar
  \end{enumerate}
  \blindtext}
\end{drama}

Second list works well:
\begin{drama}
  \ex{\blindtext
  \begin{enumerate}
    \item foo
    \item bar
  \end{enumerate}
  \blindtext
  \begin{enumerate}
    \item foo
    \item bar
  \end{enumerate}
  \blindtext}
\end{drama}
\end{document}

enter image description here

  • Thank you, this works! I am so grateful that you found the time to answer my question, even so fast ;) I was afraid that the question was too specific because of the dramatist-package, but well, thank you! ;) – LukeLR Jan 26 '16 at 21:41
  • @LukeLR: Actually I never heard of the dramatist package before (or at least did not use it.) Happy TeXing! – user31729 Jan 26 '16 at 21:45

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.