1

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}
  • \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 Jun 7 '16 at 11:18
4

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}
  • 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? – Sr. Schneider Jun 7 '16 at 11:23
  • @Sr.Schneider: baseline=.... can be used, with specific parameters, see the update please – user31729 Jun 7 '16 at 11:36

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.