Apart from the "trivial" solution of using lrbox environment...
%! TEX program = lualatex
\documentclass{article}
\usepackage{array}
\usepackage{graphics}
\begin{document}
\newsavebox{\mybox}
\begin{tabular}{cc>{\begin{lrbox}{\mybox}}c<{\end{lrbox}%
\scalebox{1.5}{\usebox{\mybox}}%
}}
some & simple & te \verb+x+ t
\end{tabular}
\end{document}
there is also the solution of adapting the implementation of scalebox (the problem is obvious -- once the graphicx package changes the macro definition your code might break/is incompatible)
%! TEX program = lualatex
\documentclass{article}
\usepackage{array}
\usepackage{graphics}
\begin{document}
\makeatletter
% scalebox is defined as:
% \protected macro:#1->@ifnextchar [{\Gscale@box {#1}}{\Gscale@box {#1}[#1]}
% so \scalebox{factor}{content} = \Gscale@box{factor}[factor]{content}
% \Gscale@box body is
% \leavevmode \def \Gscale@x {#1}\def \Gscale@y {#2}\setbox \z@ \hbox {{#3}}\setbox \tw@ \hbox {\Gscale@start \rlap {\copy \z@ }\Gscale@end }\ifdim #2\p@ <\z@ \ht \tw@ -#2\dp \z@ \dp \tw@ -#2\ht \z@ \else \ht \tw@ #2\ht \z@ \dp \tw@ #2\dp \z@ \fi \ifdim #1\p@ <\z@ \hb@xt@ -#1\wd \z@ {\kern -#1\wd \z@ \box \tw@ \hss }\else \hb@xt@ #1\wd \z@ {\box \tw@ \kern #1\wd \z@ \hss }\fi %
% take the part before #3 put into Gscaleboxfirst, and the part after that put in Gscaleboxsecond.
\def\Gscaleboxfirst #1#2{%
\leavevmode \def \Gscale@x {#1}\def \Gscale@y {#2}\setbox \z@ \hbox \bgroup\bgroup%
}
\def\Gscaleboxsecond #1#2{%
\egroup\egroup \setbox \tw@ \hbox {\Gscale@start \rlap {\copy \z@ }\Gscale@end }\ifdim #2\p@ <\z@ \ht \tw@ -#2\dp \z@ \dp \tw@ -#2\ht \z@ \else \ht \tw@ #2\ht \z@ \dp \tw@ #2\dp \z@ \fi \ifdim #1\p@ <\z@ \hb@xt@ -#1\wd \z@ {\kern -#1\wd \z@ \box \tw@ \hss }\else \hb@xt@ #1\wd \z@ {\box \tw@ \kern #1\wd \z@ \hss }\fi %
}
\makeatother
\newsavebox{\mybox}
\begin{tabular}{cc>{\Gscaleboxfirst{1.5}{1.5}}c<{\Gscaleboxsecond{1.5}{1.5}}}
some & simple & te \verb+x+ t
\end{tabular}
\end{document}
Read the code comment to see where the code comes from. Parsing optional argument/avoiding duplicating the arguments in both the first and the second part is left as an exercise for the reader.
Unlike collcell both of those does support verbatim (it's not like that non-boxing solutions cannot support verbatim, it's just more of a hassle to do that with set catcode & scantokens/input)
Talking about verbatim, I'd also mention my package cprotectinside (allows \verb and other verbatim-like commands/environments to be used with collcell solution)...
%! TEX program = lualatex
\documentclass{article}
\usepackage{array}
\usepackage{graphics}
\usepackage{collcell}
\usepackage{cprotectinside}
\newcommand{\myresize}[1]{\scalebox{1.5}{#1}}
\begin{document}
\cprotectinside{}{
\begin{tabular}{cc>{\collectcell\myresize}c<{\endcollectcell}}
some & simple & te\verb+x+t*
\end{tabular}
}
\end{document}
\begin{lrbox}and\end{lrbox}– David Carlisle Jun 26 '22 at 11:36