2

Is there a way to render invisible the vertical space that the frame of a \tcbox takes up for the purposes of spacing bullets inside of the multicols environment?

This MWE

\documentclass{article}
\usepackage{multicol}
\usepackage{tcolorbox}
\begin{document}
\begin{multicols}{2}
\begin{itemize}
  \item{lorem ipsum}
  \item{lorem ipsum}
  \item{lorem ipsum}
  \item{lorem ipsum}
  \item{lorem ipsum}
  \item{\tcbox[size=small,box align=base]{lorem ipsum}}
\end{itemize}
\end{multicols}
\end{document}

produces this result where the second and fifth bullet points are not vertically aligned, and there is more vertical space between the text of the fifth and sixth bullet points than there is between the text of the second and third bullet points

Misaligned bullets inside multicols environment

I'd like the second and fifth bullet points to be vertically aligned, and I'd like an equal amount of space between the text of the fifth and sixth bullet points, ignoring the \tcbox.

Just \smashing the \tcbox doesn't seem to help.

  • You could try to wrap the whole itemize as a tcbitemize with equal heights for all boxes, hidding the drawn box for all but the last one, letting tcolorbox calculate the correct height – user31729 Apr 20 '18 at 3:41
3

One way to do this is to put all the \items without a box in a blank \tcbox. But still using the standard itemize environment. It is easier if you predefine the boxes beforehand like such

\newtcbox{\bbox}{blank,size=small,box align=base,nobeforeafter,left=-1.3mm} % blank box
\newtcbox{\mybox}{size=small,box align=base,nobeforeafter}

This creates a blank box called \bbox and the box you want visible called \mybox. Doing it beforehand ensures you make both boxes the same in terms of size etc. Note that for the blank box I've also added left=-1.3mm. This reduces the spacing on the left hand side so that the text in the blank boxes align horizontally with the leftmost edge of the visible box (this is what you had in your MWE). I got these values from the predefined values of the small box (see section 4.7.5, page 44 of the tcolorbox documentation). In particular, boxsep=1.0mm and boxrule=0.3mm. Hence, -1.3mm is perfect in this case to adjust the horizontal alignment of the text. Alternatively, you can leave this out and the text in the blank boxes will be horizontally aligned to the text in the visible box, which is also quite nice I think.

MWE

Note the addition of skins to \usepackage[skins]{tcolorbox}. This is required to get the blank box.

\documentclass{article}
\usepackage{multicol}
\usepackage[skins]{tcolorbox}
\begin{document}
\newtcbox{\bbox}{blank,size=small,box align=base,nobeforeafter,left=-1.3mm}
\newtcbox{\mybox}{size=small,box align=base,nobeforeafter}
\begin{multicols}{2}
\begin{itemize}
  \item \bbox{lorem ipsum}
  \item \bbox{lorem ipsum}
  \item \bbox{lorem ipsum}
  \item \bbox{lorem ipsum}
  \item \bbox{lorem ipsum}
  \item \mybox{lorem ipsum}
\end{itemize}
\end{multicols}
\end{document}

enter image description here

If you want to reduce the amount of vertical space between the bullet points, then use before skip=⟨glue⟩. For example, here I've used before skip=-2.5mm.

Reducing vertical space between bullet points MWE

    \documentclass[]{article}
\usepackage{multicol}
\usepackage[skins]{tcolorbox}
\begin{document}
\newtcbox{\bbox}{blank,size=small,box align=base,nobeforeafter,left=-1.3mm,before skip=-2.5mm}
\newtcbox{\mybox}{size=small,box align=base,nobeforeafter,before skip=-2.5mm}
\begin{multicols}{2}
\begin{itemize}
  \item \bbox{lorem ipsum}
  \item \bbox{lorem ipsum}
  \item \bbox{lorem ipsum}
  \item \bbox{lorem ipsum}
  \item \bbox{lorem ipsum}
  \item \mybox{lorem ipsum}
\end{itemize}
\end{multicols}
\end{document}

enter image description here

  • \item does not have a mandatory argument, so \item{...} is 'wrong' – user31729 Apr 20 '18 at 15:59
  • Thanks for pointing that out. Had just copied what the OP had written. I will edit the post. – Milo Apr 20 '18 at 21:20
  • +1 Thanks. This works, but it does increase the amount of vertical space that every bullet point takes up, which I'd like to avoid. (This is for a research poster, so space is precious.) So I might wait for other possible solutions before accepting. – Adam Liter Apr 21 '18 at 16:23
  • @adam-liter You can adjust the amount of vertical space that every bullet point takes up by using before skip=⟨glue⟩. I've added this to my answer and shown an example. You can reduce the space as much as you want while still preserving the alignment of the bullet points. – Milo Apr 21 '18 at 19:51

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.