2

How can I align the bullet of the enumeration at the top of the tcolorbox?

enter image description here

MWE

\documentclass[parskip=full]{scrartcl}

\usepackage{lipsum}

\usepackage{tikz}
\usepackage[most]{tcolorbox}

\begin{document}

\lipsum[1]

\begin{itemize}
\item Lorem ipsum
\item
  \begin{tikzpicture}[scale=(\linewidth-\baselineskip)/20cm,baseline={([yshift=-1em] current bounding box.north)}]
  \draw[step=1,help lines,black!20] (-0.95,-0.95) grid (8.95,8.95);
  \draw[thick,->] (-1,0) -- (9,0) node[pos=0.97,below] {$x$};
  \draw[thick,->] (0,-1) -- (0,9) node[pos=0.97,left] {$y$};
  \foreach \x/\xtext in {1,2,...,8}
      \draw[shift={(\x,0)}] (0pt,4pt) -- (0pt,-4pt) node[below] {$\xtext$};
  \foreach \y/\ytext in {1,2,...,8}
      \draw[shift={(0,\y)}] (4pt,0pt) -- (-4pt,0pt) node[left] {$\ytext$};
  \node[below right] at (0,0) {0};
  \end{tikzpicture}
\item
  \tcbsidebyside[sidebyside adapt=left, blanker, sidebyside gap=1cm, 
                 sidebyside align=top seam]{%
  \begin{tikzpicture}[scale=\linewidth/20cm, baseline=(current bounding box.north)]
    \draw[step=1,help lines,black!20] (-4.95,-3.45) grid (4.95,3.45);
    \draw[thick] (-2.5,0) ellipse [x radius=2.25, y radius=3.4];
    \draw[thick] (2.5,0) ellipse [x radius=2.25, y radius=3.4];
  \end{tikzpicture}%
  }{Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
  Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.}
\end{itemize}

\end{document}
1
  • \tcbsidebyside[box align=top,sidebyside adapt=left, blanker, sidebyside gap=1cm, sidebyside align=top seam]{....}, i.e. use box align=top, normally, it's aligned at the bottom initially
    – user31729
    Commented Jun 7, 2016 at 11:18

1 Answer 1

5

Initially tcolorboxes are aligned at the bottom, i.e. box align=bottom is set, but here, it should be aligned at the top, so use box align=top in the options of \tcbsidebyside.

\documentclass[parskip=full]{scrartcl}

\usepackage{lipsum}

\usepackage{tikz}
\usepackage[most]{tcolorbox}

\begin{document}

\lipsum[1]

\begin{itemize}
\item Lorem ipsum
\item
  \begin{tikzpicture}[scale=(\linewidth-\baselineskip)/20cm,baseline={([yshift=-1em] current bounding box.north)}]
  \draw[step=1,help lines,black!20] (-0.95,-0.95) grid (8.95,8.95);
  \draw[thick,->] (-1,0) -- (9,0) node[pos=0.97,below] {$x$};
  \draw[thick,->] (0,-1) -- (0,9) node[pos=0.97,left] {$y$};
  \foreach \x/\xtext in {1,2,...,8}
      \draw[shift={(\x,0)}] (0pt,4pt) -- (0pt,-4pt) node[below] {$\xtext$};
  \foreach \y/\ytext in {1,2,...,8}
      \draw[shift={(0,\y)}] (4pt,0pt) -- (-4pt,0pt) node[left] {$\ytext$};
  \node[below right] at (0,0) {0};
  \end{tikzpicture}
\item
  \tcbsidebyside[box align=top,sidebyside adapt=left, blanker, sidebyside gap=1cm, 
                 sidebyside align=top seam]{%
  \begin{tikzpicture}[scale=\linewidth/20cm, baseline=(current bounding box.north)]
    \draw[step=1,help lines,black!20] (-4.95,-3.45) grid (4.95,3.45);
    \draw[thick] (-2.5,0) ellipse [x radius=2.25, y radius=3.4];
    \draw[thick] (2.5,0) ellipse [x radius=2.25, y radius=3.4];
  \end{tikzpicture}%
  }{Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
  Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.}
\end{itemize}

\end{document}

enter image description here

Update

\documentclass[parskip=full]{scrartcl}

\usepackage{lipsum}

\usepackage{tikz}
\usepackage[most]{tcolorbox}

\begin{document}

\lipsum[1]

\begin{itemize}
\item Lorem ipsum
\item
  \begin{tikzpicture}[scale=(\linewidth-\baselineskip)/20cm,baseline={([yshift=-1em] current bounding box.north)}]
  \draw[step=1,help lines,black!20] (-0.95,-0.95) grid (8.95,8.95);
  \draw[thick,->] (-1,0) -- (9,0) node[pos=0.97,below] {$x$};
  \draw[thick,->] (0,-1) -- (0,9) node[pos=0.97,left] {$y$};
  \foreach \x/\xtext in {1,2,...,8}
      \draw[shift={(\x,0)}] (0pt,4pt) -- (0pt,-4pt) node[below] {$\xtext$};
  \foreach \y/\ytext in {1,2,...,8}
      \draw[shift={(0,\y)}] (4pt,0pt) -- (-4pt,0pt) node[left] {$\ytext$};
  \node[below right] at (0,0) {0};
  \end{tikzpicture}
\item
  \makeatletter
  \tcbsidebyside[baseline={\tcb@height-2\kvtcb@boxsep+\baselineskip-2\lineskip}, sidebyside adapt=left, blanker, sidebyside gap=1cm, 
                 sidebyside align=top seam]{%
  \begin{tikzpicture}[scale=\linewidth/20cm, baseline=(current bounding box.north)]
    \draw[step=1,help lines,black!20] (-4.95,-3.45) grid (4.95,3.45);
    \draw[thick] (-2.5,0) ellipse [x radius=2.25, y radius=3.4];
    \draw[thick] (2.5,0) ellipse [x radius=2.25, y radius=3.4];
  \end{tikzpicture}%
  }{Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
  Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.}
\makeatother
\end{itemize}

\end{document}
2
  • 1
    Now the bullet seems to be a bit too high. I'd like to have the same result as in the tikzpicture above. In tikzpictures I always use baseline={([yshift=-1em] current bounding box.north)} to correct this. Is there something like [yshift=-1em] in tcolorbox? Commented Jun 7, 2016 at 11:23
  • 1
    @Sr.Schneider: baseline=.... can be used, with specific parameters, see the update please
    – user31729
    Commented Jun 7, 2016 at 11:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .