lvjr / tabularray

Typeset tabulars and arrays with LaTeX3
https://ctan.org/pkg/tabularray
253 stars 22 forks source link

StackExchange suggestion for 'remove column' doesn't work in tblr #451

Closed jonhall closed 10 months ago

jonhall commented 10 months ago

https://tex.stackexchange.com/questions/16604/easiest-way-to-delete-a-column suggests the use of the following to remove a column from a table (rewritten to tblr syntax):

\NewColumnType{H}{Q[preto={\setbox0=\hbox\bgroup},appto={\egroup},c]}

This works for ordinary entries, but (apparently) not for entries needing vbox:

\documentclass[10pt]{article}

\usepackage{tabularray}
\UseTblrLibrary{varwidth}%%For itemize in entries

\begin{document}

%%Example of 'H' column from https://tex.stackexchange.com/questions/16604/easiest-way-to-delete-a-column
\NewColumnType{H}{Q[preto={\setbox0=\hbox\bgroup},appto={\egroup},c]}

\begin{tblr}{
    colspec={lHl},
    measure=vbox,
    }

One&Two&Three\\

One
&\begin{itemize}%%comment this Cell out to make MWE work
\item one
\item two
\end{itemize}
&Three\\
\end{tblr}
\end{document}
jonhall commented 10 months ago

Temporary workaround to hide a column is

\NewColumnType{H}{Q[fg={white},wd=0pt,c]}

jonhall commented 10 months ago

The following appears to work (and I should have guessed, apologies)

\newcommand{\zerobox}[1]{\setbox0=\vbox{#1}}
\NewColumnType{H}{Q[cmd=\zerobox]}
muzimuzhi commented 10 months ago

I posted a revised version as a new answer to the TeX-SX question you mentioned.

Please post questions as discussions, and only bug reports and feature requests as issues in the future.

Update: For a follow-up of existing TeX-SX question, asking a new question on the same site might naturally be the first choice. But then, the problem reduces to how to attract potential users/community members to post an answer.