1

I am trying to do reproduce a two column list:

1- the left column shows a traditional list (thus a bullet symbol) and each item is separated by a blank space (I'm guessing \bigskip)

2- the right column shows a "sublist" of the first items list. No bullet points for this column. Both columns are separated with a line (but not the lines with the \bigskip).

I guess an image is really worth 1000 words...

I've tried the listliketab package without much success.

enter image description here

  • Maybe try with a tabular or a longtable. – leandriis Jun 30 at 6:49
  • The space separating the item label from the item body is labelsep.\bigskip is a vertical spacing. – Bernard Jun 30 at 9:41
1

Here is a possible solution using xltabular that combines the features of longtable and tabularx.

enter image description here

\documentclass{article}
\usepackage{xltabular}
\begin{document}

\begin{xltabular}{\textwidth}{l|>{\itshape}X}
-- Classification A & some text \\
                    & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{}\\
-- Method B         & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{}\\
-- Method C         & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{} \\
-- Classification A & some text some text some text some text some text some text some text some text some text some text some text some text  \\
                    & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{}\\
-- Method B         & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{}\\
-- Method C         & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{} \\
-- Classification A & some text \\
                    & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{}\\
-- Method B         & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{}\\
-- Method C         & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{} \\
-- Classification A & some text \\
                    & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{}\\
-- Method B         & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{}\\
-- Method C         & some text \\
                    & some text \\
                    & some text \\
\multicolumn{2}{l}{} \\
\end{xltabular}

\end{document}

The first column is left aligned and automatically as wide as its widest entry. The second column is justified and all entries in this column are italic (done with >{\itshape}). As you might notice, the table is a little bit smaller than the surrounding text. If you want to remove this indentation, use \begin{xltabular}{\textwidth}{@{}l|>{\itshape}X@{}} instead.

The vertical line is introduced automatically. To add the gaps in the line and the vertical white space between the blocks, I have used \multicolumn{2}{l}{}\\. Pagebreaks can occur between every row of the table. If you want to prevent a pagebreak use \\* instead of \\.

  • Works great! Thank you! – sb_guido Jul 2 at 2:21
3

Welcome to TeX.SX!!

I used a very similar format some time ago. Using the technique employed by leandriis to separate the rows of the tabular, the following is possible:

\documentclass{article}

\usepackage{array}
\usepackage{enumitem}

\newenvironment{mynewlist}{%
\sffamily %% Used this to match your sample -- change at will
\setlist[itemize]{nosep,
    topsep=0pt,
    label={},
    left=0pt,
    leftmargin=0pt,
    partopsep=0pt,
    before=\vspace{-6pt},
    after=\vspace{-\baselineskip}
}
    \begin{tabular}{>{--\ }l|>{\itshape\begin{itemize}}p{2in}<{\end{itemize}}}
}{%
    \end{tabular}
}

\newcommand{\mysep}{\multicolumn{2}{l}{}\\}%% Inserts empty tabular row

\begin{document}

\begin{mynewlist}
Classification A&\item some text \item some text \item some text \item some text\\
\mysep
Méthode B&\item some text \item some text \item some text \item some text\\
\mysep
Method C&\item some text \item some text \item some text \item some text\\
\end{mynewlist}

\end{document}

The formatting of the table makes straightforward use of the itemize environment (with the help of enumitem which gives easy access to formatting lists) in the second column. The array package allows for adding formatting to the columns of a tabular environment -- in this case it allows for the automatic adding of the en-dash to the first column, and makes possible the use of the itemize environment and italic type in the second column of the tabular. Changes are easily made to suit your formatting requirements.

Update

Made a small addition to \setlist of leftmargin=0pt to improve the spacing of the itemize environment in the second column. Updated graphic of output.

itemize in tabular

Second update

For two reasons, I could not leave this alone. I wanted significantly to simplify the entry of the data, while at the same time making multi-page tables possible through the use of xltabular.sty (following the lead of leandriis). This required putting the entire body of the table into \itembody by using \gappto from etoolbox -- a similar trick is needed for tabularx as well. As a simplification of sorts, I made | stand in place of \item to simplify typing, the use of which is strictly optional. I added a bit of color for fun. Also created a macro that handles the input neatly. I also used hanging indentation in the second column to indicate a very long line of text.

\documentclass[11pt]{article}

\usepackage[papersize={5.5in,8.5in},margin=0.5in]{geometry}
\usepackage{array}
\usepackage{xltabular} %% multipage tabularx-style tables
\usepackage{enumitem}
\usepackage{colortbl}
\usepackage{etoolbox}

\begingroup
    \catcode`|=\active
    \gdef\changebar{\def|{\item}}
\endgroup

\newenvironment{mynewlist}{%
    \sffamily %% Used this to match your sample -- change at will
    \setlength{\arrayrulewidth}{1pt}
    \arrayrulecolor{red}
    \catcode`|=\active
    \changebar
    \setlist[itemize]{nosep,
        topsep=0pt,
        label={},
        left=0em,
        partopsep=0pt,
        leftmargin=1em,
        itemindent=-1em,
        before=\vspace{-1.25em},
        after=\vspace{-\baselineskip}
    }%
}{%
    \begin{xltabular}{\textwidth}{@{}>{\bfseries--\ }l|
        >{\itshape\begin{itemize}}X<{\end{itemize}}}
            \itembody
    \end{xltabular}
    \vspace{-\baselineskip}
    \gdef\itembody{}%
}

\newcommand{\myentry}[2]{% gather the rows of the table into \itembody
    \gappto{\itembody}{%
        #1&#2\\
        \multicolumn{2}{l}{}\\[-8pt]%% Change '-8pt' to adjust space between rows
    }%
}

\begin{document}

\begin{mynewlist}

\myentry{Classification A}{%
    |some text
    |some text
    |some text
    |some text
}

%% The use of `|' for \item is purely voluntary.
\myentry{Méthode B}{%
    \item some text
    \item text that might be terribly long and go on and on and on\dots
}

\myentry{Method C}{%
    |some text
    |some text
    |some text
    |some text
}

\end{mynewlist}

\end{document}

output from later version

  • Output is actually pretty neat! Thanks for taking time to share this with me! – sb_guido Jul 2 at 2:23

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.