Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to use the package collcell to change the case of every string in a column of a tabuenvironment. I know there are workarounds to do this without resorting to the package, but none of those I know seem quite "elegant" to me. Is it possible to do this in a more direct way by resorting to that package? I have tried with the following MWE but I get an error message.

\documentclass[12pt]{memoir}

\usepackage{tabu,collcell}

\newcommand{\makeupper}[1]{\MakeUppercase{#1}}
\newcolumntype{U}{>{\collectcell\makeupper}X[-1,r]<{\endcollectcell}}
\tabucolumn U

\begin{document}
\pagestyle{empty}

\begin{tabu} spread0pt{@{}U@{}}
    Title \\
\end{tabu}

\end{document}

I would also like to use the package soul for letterspacing, but this comes only after having solved this first issue.

share|improve this question
1  
You should consider microtype for letter spacing. –  egreg Jul 7 '12 at 19:56
    
Dear egreg, thanks so much. I'm used to the soul package, but I understand that the package microtype is more powerful than the former even regarding letterspacing for assorted pieces of text. Hence, in the near future I will most likely do as you suggest. –  Marcos Jul 7 '12 at 20:01
    
A real example would be useful for suggesting maybe better strategies. –  egreg Jul 7 '12 at 20:02
1  
X columns do paragraphs and \MakeUppercase doesn't like them. That's why I asked for a real example. –  egreg Jul 7 '12 at 20:16
1  
If you use X[-1,m,p] you code seems to work just fine. –  Peter Grill Jul 7 '12 at 22:44

1 Answer 1

up vote 3 down vote accepted

With X[-1,m,p] your code seems to work just fine and the case is switched to upper case as desired:

enter image description here

Code:

\documentclass[12pt]{memoir}

\usepackage{tabu,collcell}

\newcommand{\makeupper}[1]{\MakeUppercase{#1}}
\newcolumntype{U}{>{\collectcell\makeupper}X[-1,m,p]<{\endcollectcell}}
\tabucolumn U

\begin{document}
\pagestyle{empty}

\begin{tabu} spread0pt{@{}U@{}}
    Title \\
\end{tabu}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.