É possível redirecionar chaves não balanceadas (`{` e `}`) para uma coluna tabular?

É possível redirecionar chaves não balanceadas (`{` e `}`) para uma coluna tabular?

Esta pergunta é uma continuação da minhapergunta anterior:

É possível usar >e <canalizar chaves de abertura e fechamento em cada lado do conteúdo de uma célula? Para ser mais específico, o que quero é definir a seguinte coluna:

\newcolumntype{P}{>{\leavevmode\kern-\tabcolsep\bfseries\parbox[t]{\hsize}{}X<{}}}

Quero um tipo de coluna que abranja automaticamente o conteúdo da célula em um arquivo \parbox.

Anexo um breve MNWE:

\documentclass[table]{article}
\usepackage{lmodern, microtype, xcolor, tabularx, tabulary}

\begin{document}

\begin{tabularx}{0.5\columnwidth}{>{\raggedright\arraybackslash\leavevmode\kern-\tabcolsep\parbox[t]{\hsize}{ }X<{}}XX<{\leavevmode\kern-\tabcolsep\raggedleft\arraybackslash}}

\rowcolor{lightgray}All this testing is not so funny&test&test\\\hline
testing, testing and even more testing &test&test\\
\rowcolor{lightgray}I want to write a noce table in a simple way&test&test\\
\end{tabularx}

\end{document}

Responder1

Estender o aparelho >{}parece <{}mais difícil do que o esperado; Não consigo encontrar uma maneira que use tokens de chaves explícitos. Aqui está uma solução alternativa que usa os argumentos delimitados do TeX. Em vez de usar \parboxdiretamente, definimos uma macro auxiliar \parboxx ... \endparboxxque o envolve. Esta macro é então usada no novo tipo de coluna P:

\documentclass[table]{article}
\usepackage{lmodern, microtype, xcolor, tabularx, tabulary}

\begin{document}

\def\parboxx#1\endparboxx{\parbox[t]{\hsize}{\raggedright#1}}

\newcolumntype{P}{>{\leavevmode\kern-\tabcolsep\bfseries\parboxx}X<{\endparboxx}}

\begin{tabularx}{0.5\columnwidth}{PXX<{\leavevmode\kern-\tabcolsep\raggedleft\arraybackslash}}

\rowcolor{lightgray}All this testing is not so funny&test&test\\\hline
testing, testing and even more testing &test&test\\
\rowcolor{lightgray}I want to write a noce table in a simple way&test&test\\
\end{tabularx}

\end{document}

saídas

insira a descrição da imagem aqui

informação relacionada