¿Es posible redirigir llaves desequilibradas (`{` y `}`) a una columna tabular?

¿Es posible redirigir llaves desequilibradas (`{` y `}`) a una columna tabular?

Esta pregunta es una continuación de miPregunta anterior:

¿Es posible utilizar >y <canalizar llaves de apertura y cierre a cada lado del contenido de una celda? Para ser más específico lo que quiero es definir la siguiente columna:

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

Quiero un tipo de columna que incluya automáticamente el contenido de la celda en un archivo \parbox.

Adjunto un 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}

Respuesta1

Extender los tirantes >{}parece <{}más difícil de lo esperado; No se me ocurre una forma que utilice tokens de llaves explícitos. Aquí hay una solución alternativa que utiliza los argumentos delimitados de TeX. En lugar de utilizar \parboxdirectamente, definimos una macro auxiliar \parboxx ... \endparboxxque lo envuelve. Esta macro se utiliza luego en el nuevo tipo de columna 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}

salidas

ingrese la descripción de la imagen aquí

información relacionada