tabularray icon indicating copy to clipboard operation
tabularray copied to clipboard

longtblr and itemize

Open Aljumaily opened this issue 2 years ago • 9 comments

Related to tabularray and itemize compatibility. This is the solution provided:

\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}{ % Changing this to longtblr generates Something's wrong--perhaps a missing \item
  colspec = {Xl}, hlines, vlines,
}
  text & text \\
  \begin{itemize}
    \item text 1
    \item text 2
  \end{itemize} & text 3 \\
\end{tblr} % longtblr

\end{document}

Changing the second tblr to longtblr generates Something's wrong--perhaps a missing \item. What is the fix?

Aljumaily avatar May 04 '23 17:05 Aljumaily

It is a strange bug: when I pass outer option long to make it a long table, no error occurs:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{varwidth}
\begin{document}
% set "measure=vbox" as default
\SetTblrInner{measure=vbox}
\begin{tblr}[long]{ % Changing this to longtblr generates Something's wrong--perhaps a missing \item
  colspec = {Xl}, hlines, vlines,
}
  text & text \\
  \begin{itemize}
    \item text 1
    \item text 2
  \end{itemize} & text 3 \\\pagebreak
  text & text
\end{tblr} % longtblr
\end{document}

lvjr avatar May 06 '23 01:05 lvjr

By default \SetTblrInner only influence tblr environment. What's needed here is

\SetTblrInner[tblr,longtblr]{measure=vbox}

https://github.com/lvjr/tabularray/blob/690e67ee175ff7601d0144c84f9a7e9c67573e0b/tabularray.sty#L2623-L2629

Also see package doc (2023A (2023-03-01)), sec. 3.3 "Default Specifications": https://github.com/lvjr/tabularray/blob/690e67ee175ff7601d0144c84f9a7e9c67573e0b/manual/manual-3.tex#L312-L337

muzimuzhi avatar May 06 '23 06:05 muzimuzhi

There're more tblr envs predefined in either the base package or one of its libraries (just searching for \NewTblrEnviron in tabularray.sty) hence enumerating full list of them in \SetTblrInner[<list of tblr-envs>]{...} is a bit of a pain.

Perhaps tabularray could add a pair of clists storing (real) default inner and outer styles which is applied before per-tblr-env styles and can be set by starred \SetTblrInner/\SetTblrOuter.

muzimuzhi avatar May 06 '23 06:05 muzimuzhi

By default \SetTblrInner only influence tblr environment. What's needed here is

\SetTblrInner[tblr,longtblr]{measure=vbox}

Also see package doc (2023A (2023-03-01)), sec. 3.3 Default Specifications:

Sorry, obviously I forgot what I have written. ^_^

lvjr avatar May 06 '23 06:05 lvjr

There're more tblr envs predefined in either the base package or one of its libraries (just searching for \NewTblrEnviron in tabularray.sty) hence enumerating full list of them in \SetTblrInner[<list of tblr-envs>]{...} is a bit of a pain.

Perhaps tabularray could add a pair of clists storing (real) default inner and outer styles which is applied before per-tblr-env styles and can be set by starred \SetTblrInner/\SetTblrOuter.

I ever considered this (see #37), but decided not to do it becauae it is a little complicated when users need to apply it only to text tables (but not math tables). The real problem is that I am not satisfied with the interfaces.

lvjr avatar May 06 '23 06:05 lvjr

I ever considered this (see #37), but decided not to do it becauae it is a little complicated when users need to apply it only to text tables (but not math tables).

True. I thought about this too, when editing my previous comment. Adding env families or conditional options like if math={<true options>}{<false options>} are possible choices.

muzimuzhi avatar May 06 '23 07:05 muzimuzhi

I think the interfaces could be the following:

  • \SetAllTblrInner{spec}
  • \SetTextTblrInner{spec}
  • \SetMathTblrInner{spec}
  • \SetAllTblrOuter{spec}
  • \SetTextTblrOuter{spec}
  • \SetMathTblrOuter{spec}

And we need four new clists.

lvjr avatar May 06 '23 07:05 lvjr

Then users should be informed that \SetAllTblrInner actually calls \SetTextTblrInner and \SetMathTblrInner, to understand the combined affect of interchanging use like \SetTextTblrInner{...} \SetAllTblrInner{...} \SetTextTblrInner{...}.

Plus, I'm a bit preferable to stick to prefix \SetTblr....

muzimuzhi avatar May 06 '23 07:05 muzimuzhi

Then users should be informed that \SetAllTblrInner actually calls \SetTextTblrInner and \SetMathTblrInner, to understand the combined affect of interchanging use like \SetTextTblrInner{...} \SetAllTblrInner{...} \SetTextTblrInner{...}.

Yes.

Plus, I'm a bit preferable to stick to prefix \SetTblr....

SetAllTblr is a little easier to understand: "set all tabularray tables".

lvjr avatar May 06 '23 07:05 lvjr