2

I want create a layout which looks like this (porting a document from Word to LaTeX):

Multi column layout - Word

I tried to use a table to implement this, but the problem is that the text for 'Attr6' can span multiple pages. As far as I understand this is not possible with tables, even with longtable .

Another approach was to use multicols:

\begin{mutlicols}{2}
    Attr6: \columnbreak
    Value6
\end{multicols}

But the problem with this solutions is that a muli-page text looks like:

Attr6:                 Value6
                       ...more text
------ <page break> ------------

...text continued
on the left column...

What else can I use to create this 2 column layout ?

2

1 Answer 1

3

This is a possible solution with an enumitem list inside a breakable tcolorbox. The enumitem list defines a counter like Attr? with a certain labelwidth which is also used to fill the background rectangle in tcolorbox.

\documentclass[a4paper,12pt]{article}
\usepackage{geometry} 
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}

\begin{document}
\lipsum[1]
\begin{tcolorbox}[sharp corners, enhanced, breakable,
    underlay={\begin{tcbclipinterior}\fill[red!30] (frame.north west) rectangle ([xshift=2cm]frame.south west);\end{tcbclipinterior}}]
\begin{enumerate}[label=Attr\arabic*,  labelwidth=2cm, labelindent=0pt, leftmargin=2cm, align=left]
\item \lipsum[1]
\item \lipsum[2]
\item \lipsum[3]
\item \lipsum[4]
\item \lipsum[5]
\end{enumerate}
\end{tcolorbox}
\end{document}

enter image description here

You must log in to answer this question.

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