## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ tabularx uppercase all

Information and discussion about graphics, figures & tables in LaTeX documents.
comandos
Posts: 6
Joined: Sat Dec 15, 2018 3:46 pm

### tabularx uppercase all

Greetings,

I wish to uppercase/makeuppercase every entry in a tabularx table. Any suggestions? (Beside doing it manually for every entry.)
I tried using the command in the following manner but it didn’t work.

\begin{tabularx}{\textwidth\MakeUppercase\bfseries\large}{l X}    Test 1 & test 2  \\    Test 1 & test 2  \\    Test 1 & test 2  \\    Test 1 & test 2  \\  \end{tabularx}

Best regards

kaiserkarl13
Posts: 636
Joined: Tue Mar 25, 2008 5:02 pm
I got something to work by defining an environment (using environ) that makes everything inside it uppercase:
\documentclass{article}\usepackage{tabularx}\usepackage{environ}\begin{document}\NewEnviron{Uppercase}    {\MakeUppercase{\BODY}}\begin{tabularx}{\textwidth}{>{\begin{Uppercase}}l<{\end{Uppercase}} X}    Test 1 & test 2 \\    Test 3 & test 4 \\\end{tabularx}\end{document}

rais
Posts: 250
Joined: Sun Nov 16, 2014 8:51 pm
@comandos: even if the tabularx environment would allow stuff like that in its first argument (which it doesn't, it expects a length there), \MakeUppercase expects an argument, Since there are no braces, it would grab the \bfseries command, biut since there's no text...

The easiest way would be to use small caps instead of all uppercase, then you could say
{\scshape\bfseries\large\begin{tabularx}[\textwidth}{lX}%table's contents\end{tabularx}}

Then again, small caps may not be available for your font at your used encoding
.
An alternate to kaiserkarl13's example might be the usage of collcell package:
\documentclass{article}\usepackage[T1]{fontenc}\usepackage{tabularx}\usepackage{collcell}\newcommand\tabfmt[1]{\MakeUppercase{\bfseries\large#1}}\newcolumntype{E}{>{\collectcell\tabfmt}X<{\endcollectcell}}\begin{document}  \begin{tabularx}{\textwidth}{>{\collectcell\tabfmt}l<{\endcollectcell} E}    Test 1 & test 2  \\    Test 1 & test 2  \\    Test 1 & test 2  \\    Test 1 & test 2  \\  \end{tabularx}\end{document}

KR
Rainer

comandos
Posts: 6
Joined: Sat Dec 15, 2018 3:46 pm
I know I'm doing it wrong but thank you both!
Both examples were helpful.