2

I am writting my masters thesis. I want to put 2x2 block boxes in some pages. For example:

enter image description here

I can add as image but I do not want to do that. I can draw box using tcolorbox using the following code:

\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My Heading]
This is a \textbf{tcolorbox}.
\tcblower
Here, you see the lower part of the box.
\end{tcolorbox}

But the problem is how can I put box as 2x2 format? Any help or suggestion will be appreciated.

3

By default tcolorbox declares all boxes with width=\linewidth, so if you want more than one box on same line, you'll have to adjust their width. But this is not enough, because, also by default a tcolorbox also starts a new paragraph, so you also need to fix options before and after or use something like nobeforeafter.

If instead of environment tcolorbox you use command \tcbox, box width is automatically adjusted to box contents and they don't start a new paragraph.

Examples for tcbox start at page 13 in tcolorbox documentation. And first example with several tcolorbox environment on same line in page 17.

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

\begin{document}


\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My Heading, width=.45\linewidth, nobeforeafter]
This is a \textbf{tcolorbox}.
\tcblower
Here, you see the lower part of the box.
\end{tcolorbox}
\hfill
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My Heading, width=.45\linewidth, nobeforeafter]
This is a \textbf{tcolorbox}.
\tcblower
Here, you see the lower part of the box.
\end{tcolorbox}

\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My Heading, width=.45\linewidth, nobeforeafter]
This is a \textbf{tcolorbox}.
\tcblower
Here, you see the lower part of the box.
\end{tcolorbox}
\hfill
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=My Heading, width=.45\linewidth, nobeforeafter]
This is a \textbf{tcolorbox}.
\tcblower
Here, you see the lower part of the box.
\end{tcolorbox}
\end{document}

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.