7

Is tabularray package incompatible with itemize environment? Simple MWE is:

\documentclass{article}
\usepackage{tabularray}

\begin{document}

\begin{tblr}{%
colspec={Xl}, hlines, vlines
}
text & text\\
\begin{itemize}
    \item text 1
    \item text 2
\end{itemize} & text 3 \\
\end{tblr}

\end{document}

I get many errors like "Something's wrong--perhaps a missing \item. \end", but the output is produced somehow. Could this be fixed?

Thank you.

3 Answers 3

7

I can offer a workaround:

\documentclass{article}
\usepackage{tabularray,varwidth,enumitem}

\begin{document}

\noindent
\begin{tblr}{
  colspec={Xl}, hlines, vlines
}
text & text\\
\begin{varwidth}[t]{\linewidth}
\begin{itemize}[topsep=0pt,parsep=0pt]
    \item abc def abc def abc def abc def
          abc def abc def abc def abc def
          abc def abc def abc def abc def
    \item abc def abc def abc def abc def
          abc def abc def abc def abc def
          abc def abc def abc def abc def\strut
\end{itemize}
\end{varwidth} & text 3 \\
abc def abc def abc def abc def
abc def abc def abc def abc def
abc def abc def abc def abc def
 & xyz
\end{tblr}

\end{document}

enter image description here

5

From https://github.com/lvjr/tabularray/issues/36

I have added varwidth library and measure option to tabularray package. You can put vertical material inside cells with \UseTblrLibrary{varwidth} and option measure=vbox. You can also set measure=vbox as default option.

\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{varwidth}

\begin{document}

\begin{tblr}{
  colspec = {Xl}, hlines, vlines,
  measure = vbox,
}
  text & text \\
  \begin{itemize}
    \item text 1
    \item text 2
  \end{itemize} & text 3 \\
\end{tblr}

% set "measure=vbox" as default
\SetTblrInner{measure=vbox}

\begin{tblr}{
  colspec = {Xl}, hlines, vlines,
}
  text & text \\
  \begin{itemize}
    \item text 1
    \item text 2
  \end{itemize} & text 3 \\
\end{tblr}

\end{document}

enter image description here

You may download the latest package file from https://github.com/lvjr/tabularray/raw/main/tabularray.sty or wait for version 2021N scheduled on September 1st. I need to update the manual before next release.

But it is better to use @egreg's solution, because there is extra vertical space around itemized cells (the same is true for tabular and tabularx environments).

4
  • thank you! I checked new version, works almost perfect :). Almost, because if I add another string of text (make multi-row) in that cell via {\begin{itemize} ... \end{itemize} \\ Next string of text} it gives errors, but egreg's solution works in this case.
    – Alx
    Aug 25, 2021 at 14:07
  • 1
    Like a normal document, you don't need \\ after \end{itemize}. Just remove it.
    – L.J.R.
    Aug 25, 2021 at 14:51
  • ah I see, thanks.
    – Alx
    Aug 25, 2021 at 14:56
  • To avoid this vertical space, I discovered this workaround: use package enumitem, then \vspace*{-\baselineskip} right before the itemize environment, the last with the option \begin{itemize}[nosep].
    – benjamin
    Dec 13, 2021 at 13:50
4

Enclose the itemize environment within a minipage of width \hsize.

enter image description here

\documentclass{article}
\usepackage{tabularray}
\begin{document}
\noindent
\begin{tblr}{%
colspec={Xl}, hlines, vlines
}
text & text\\
\begin{minipage}{\hsize}
  \begin{itemize}
    \item text 1
    \item text 2
  \end{itemize}
\end{minipage}
& text 3 \\
\end{tblr}

\end{document}

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.