5

How can I emulate e.g. a manually set OpenOffice tabulator in my enumeration?

  • right side has to begin at a uniform point
  • some space has to be between the rightmost point of left side and leftmost point of right side
  • multi-line items have to stay vertically aligned (by first line) between the columns
  • itemize left indentation and vertical spacing
  • (bonus) shall work across section tags

Working for single-line items:

\begin{minipage}{0.28\textwidth}
  \begin{itemize}
    \item Item 1 left side
    \item Item 2 left side
  \end{itemize}
\end{minipage}
\hfill
\begin{minipage}{0.7\textwidth}
  \begin{itemize}
    \item Item 1 right side
    \item Item 2 right side
  \end{itemize}
\end{minipage}

This breaks down really quickly with multi-line items. The vertical alignment will be more and more off as the number of in-item linebreaks grows.

Also, requires a lot of bad code: same-line text is spread across two blocks, itemize structure has to be duplicated, etc.


Not so working attempt inspired by [1]:

\begin{tabular}{ll}
  Item 1 left side & Item 1 right side \\
  Item 2 left side & Item 2 right side \\
\end{tabular}

Vertical spacing is (obviously) normal line spacing instead of proper itemize spacing here. Bullet points, if desired, have to be improvised as shown in [1].


Not so working attempt inspired by [2][3]:

\begin{tabulary}{\textwidth}{PP}
  \begin{itemize}
    \item[] Item 1 left side & Item 1 right side \\
    \item[] Item 2 left side & Item 2 right side \\
  \end{itemize}
\end{tabulary}

Throws a bunch of Package array Errors and Something's wrong errors.


Related stuff that probably will not work:

  • [4] - Same issues as my first example (if admittedly with less code overall).

Also, I am fairly sure that I did not tag this question correctly. Please suggest more fitting tags.

7
  • I've never used it, but the listliketab package claims to do something like that: a tabular that looks like a list environment.
    – Dan
    Aug 30, 2016 at 18:53
  • have you considered simply using multicols over the itemize list?
    – d-cmst
    Aug 30, 2016 at 18:55
  • Must the ‘columns’ have unequal widths?
    – Bernard
    Aug 30, 2016 at 19:08
  • In most cases for a two - column approach of a list, a tabular is the better option, regarding the alignment, if breaking over pages is needed, consider longtable or related packages -- or the tasks package
    – user31729
    Aug 30, 2016 at 19:41
  • @domenicocamasta: multicols does not guarantee that items are always on the same height in both (or say all columns), so the look may be disrupted. If this is no issue, then multicols is a possible way, yes!
    – user31729
    Aug 30, 2016 at 19:42

3 Answers 3

1

Using package listliketab as per suggestion of user @Dan :

\usepackage{listliketab}

\storestyleof{itemize}
\begin{document}
  \begin{listliketab}
  \begin{tabular}{lp{11cm}}
    \textbullet~ Item 1 left side & Item 1 right side \\
    \textbullet~ Item 2 left side & Item 2 right side\newline with manual line break \\
  \end{tabular}
  \end{listliketab}
\end{document}

Flaws:

  1. While listliketab claims to emulate the list style as specified by storestyleof, I have not found a way to emulate enumerators (e.g. text bullets) automatically. They have to be added manually using e.g. \textbullet~. If lines with and without shall be mixed, they need to be placed into an extra column to preserve alignment.
  2. Line breaks are only supported in columns of type p, which requires input of a manual width.

To overcome point 2 I tried to use package tabulary instead of tabular, but I could not get it to work with listliketab: All columns are squashed to a tiny space on the left side of the page; it looks normal as soon as enclosing listliketab-tags are removed.

For completeness the defective example using tabulary:

\usepackage{listliketab}
\usepackage{tabulary}

\storestyleof{itemize}
\begin{document}
  \begin{listliketab}
  \begin{tabulary}{\textwidth}{LL}
    \textbullet~ Item 1 left side & Item 1 right side \\
    \textbullet~ Item 2 left side & Item 2 right side\newline with manual line break \\
  \end{tabulary}
  \end{listliketab}
\end{document}
1

An unusual solution ... see if it is acceptable to you:

enter image description here

Edit: With regard to your comment, I redesign of the MWE. Now are defined two type columns dedicated for itemize lists:

  • the first, named i, is based on p{<width>} type of column. Therefore you can determine its width as at p{<width>} column type
  • the second, named I, is based on X column type. Its width is calculated by tabularx internals and can not be changed manulay

With this change you can use bot columns type together in tabularx tables or o only i type in tabular tables. New, complete MWE (by which is obtained above image of table) is:

\documentclass{article}
\usepackage{calc}
\usepackage{tabularx}
\makeatletter
\newcolumntype{i}[1]{>{\minipage[t]{\linewidth}%
    \arraybackslash%
    \setlength{\leftmargini}%
            {\widthof{\labelitemi}+\labelsep}% less list indent
    \itemize
        \addtolength{\rightskip}{0pt plus 10pt}% for raggedright
        \setlength{\itemsep}{-\parsep}%
        \setlength\labelsep{1ex}%
        \setlength{\listparindent}{3em}}%
    p{#1}<{\@finalstrut\@arstrutbox\enditemize\endminipage}%
                        }
%%--------------------------------------------------------------%
\newcolumntype{I}{>{\minipage[t]{\linewidth}%
    \arraybackslash%
    \setlength{\leftmargini}%
            {\widthof{\labelitemi}+\labelsep}% less list indent
    \itemize%
        \addtolength{\rightskip}{0pt + 10pt}% for raggedright
        \setlength{\itemsep}{-\parsep}%
        \setlength\labelsep{1ex}%
        \setlength{\listparindent}{3em}}%
    X<{\@finalstrut\@arstrutbox\enditemize\endminipage}%
                    }
\makeatother

\renewcommand\arraystretch{1.5}
\usepackage{geometry}
\usepackage{blindtext} 

\begin{document}
\noindent%
\begin{tabularx}{\textwidth}{ i{0.25\textwidth} I}
\item   Item 1 left side
    &   \item   Item 1 right side   \\
\item   Item 2 left side
    &   \item   \blindtext          \\
\item   Item 3 left side
\item   Item 4 left side
\item   Item 5 left side
    &   \item   Item 3 right side (only one in the cell)  \\   
\item   Item 6 left side
    &   \item   Item 6 right side
  \end{tabularx}
\end{document} 

Above solution is partially based on contribution of the Donald Arseneau . I use ite extensively in different project reports and it serve me very well (to my opinion simple and clean use with small overhead), however I would be glad to learn for more elegant solution, if it exist (with the same or better feature: no manual intervention in items formatting).

Edit 2: Added is showframe package for showing page layout and deletedragedright` skip option in both columns:

\documentclass{article}
\usepackage{calc}
\usepackage{tabularx}
\makeatletter
\newcolumntype{i}[1]{>{\minipage[t]{\linewidth}%
    \arraybackslash%
    \setlength{\leftmargini}%
            {\widthof{\labelitemi}+1.5\labelsep}% now changed/increased for 0.5 \labelsep
    \itemize
%       \addtolength{\rightskip}{0pt + 10pt}% <-- now deleted
        \setlength{\itemsep}{-\parsep}%
        \setlength\labelsep{1ex}%
        \setlength{\listparindent}{3em}}%
    p{#1}<{\@finalstrut\@arstrutbox\enditemize\endminipage}%
                        }
%%--------------------------------------------------------------%
\newcolumntype{I}{>{\minipage[t]{\linewidth}%
    \arraybackslash%
    \setlength{\leftmargini}%
            {\widthof{\labelitemi}+1.5\labelsep}% now changed/increased for 0.5 \labelsep
    \itemize%
%        \addtolength{\rightskip}{0pt + 10pt}% <-- now deleted 
        \setlength{\itemsep}{-\parsep}%
        \setlength\labelsep{1ex}%
        \setlength{\listparindent}{3em}}%
    X<{\@finalstrut\@arstrutbox\enditemize\endminipage}%
                    }
\makeatother

\renewcommand\arraystretch{1.5}
\usepackage{geometry}
\usepackage{blindtext}

%--------------------------------------- for show page layout --%
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\noindent%
\begin{tabularx}{\textwidth}{@{} i{0.2\textwidth} I @{}}% <-- changed width of the first column
\item   Item 1 left side
    &   \item   Item 1 right side   \\
\item   Item 2 left side
    &   \item   \blindtext          \\
\item   Item 3 left side
\item   Item 4 left side
\item   Item 5 left side
    &   \item   Item 3 right side (only one item in the cell)  \\
\item   Item 6 left side
    &   \item   Item 4 right side
  \end{tabularx}
\end{document} 

[1]: https://i.stack.imgur.com/LOV2N.png

4
  • This looks pretty much like what I want to have, yes. I'll wait a bit before accepting because it has a rather hackish look to it, but if no more elegant solution comes up, I'll accept it. In any case: upvoted already.
    – Zsar
    Aug 30, 2016 at 20:55
  • A question: In your example there is a lot of empty space between the rightmost (used) point of the left and the leftmost (used) point of the right column, even though there are linebreaks in one of the items. How would one reduce that empty space (without eliminating it completely, setting it to some nice proportion, e.g. (half of the) size of the itemize indent)? (I'll frankly admit that I do not grok this setup.)
    – Zsar
    Aug 30, 2016 at 21:12
  • :-), (i) you can not vote yet, you should wait on enough reputation (ii) I didn't bother with column width. I simple suppose, that they had to have equal with. This can be changed, however it seems to require some redesign of column type definition. I need to rethink this.
    – Zarko
    Aug 30, 2016 at 21:37
  • The site claims to have tracked my upvote, so it should be displayed as soon as I hit 15 rep. If that does not happen, it is probably a bug and should be reported.
    – Zsar
    Aug 30, 2016 at 22:21
1

One could use the tasks package for this. You can't set the width of the columns then, but there is at least a bit of flexibility through choosing the number of columns. We first define a new list type

\NewTasks[style=itemize]{itemlist}[\item]

and then use it like this:

\begin{itemlist}(2)% <<< specify number of columns here
  \item  Item 1 left side
  \item* Item 1 right side
  \item  Item 2 left side
  \item* \blindtext
  \item  Item 3 left side
  \item* Item 3 right side (only one item in the cell)
  \item* Item 4 left side
  \item* Item 5 left side
  \item  Item 6 left side
  \item* Item 6 right side
\end{itemlist}

The starred version of \item means: use the rest of the line. This means the respective items span across the remeining number of columns. The following demonstrates the output depending on the number of columns (2, 3, or 4, resp.):

\documentclass{article}
\usepackage{tasks,blindtext,showframe}

\NewTasks[style=itemize]{itemlist}[\item]

\begin{document}

\begin{itemlist}(2)
  \item  Item 1 left side
  \item* Item 1 right side
  \item  Item 2 left side
  \item* \blindtext
  \item  Item 3 left side
  \item* Item 3 right side (only one item in the cell)
  \item* Item 4 left side
  \item* Item 5 left side
  \item  Item 6 left side
  \item* Item 6 right side
\end{itemlist}

\newpage

\begin{itemlist}(3)
  \item  Item 1 left side
  \item* Item 1 right side
  \item  Item 2 left side
  \item* \blindtext
  \item  Item 3 left side
  \item* Item 3 right side (only one item in the cell)
  \item* Item 4 left side
  \item* Item 5 left side
  \item  Item 6 left side
  \item* Item 6 right side
\end{itemlist}

\newpage

\begin{itemlist}(4)
  \item  Item 1 left side
  \item* Item 1 right side
  \item  Item 2 left side
  \item* \blindtext
  \item  Item 3 left side
  \item* Item 3 right side (only one item in the cell)
  \item* Item 4 left side
  \item* Item 5 left side
  \item  Item 6 left side
  \item* Item 6 right side
\end{itemlist}

\end{document}

enter image description here

enter image description here

enter image description here

You must log in to answer this question.

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