1

I am trying to do centering and text sizing in tabularx environment using the following definitions:

\newcolumntype{b}{>{\centering}X}
\newcolumntype{s}{>{\hsize=.25\hsize}X}

However, when I want to center "s" using the following command, I get an error:

\newcolumntype{s}{>{\centering}{{\hsize=.25\hsize}X}}

Any ideas what might work? Thanks.

  • Try \newcolumntype{s}{>{\centering\arraybackslash\hsize=.25\hsize}X} – Jesse Mar 20 '14 at 13:48
  • sorry doesn't work for me :( – Sumit Mar 20 '14 at 13:52
  • Hmmmmm..., it works on my tabularx using |bs| specifier. – Jesse Mar 20 '14 at 13:56
  • @Sumit please always include a complete small document that shows the error. "doesn't work for me" doesn't allow anyone to help you. Every question should have an example starting \documentclass and ending \end{document} – David Carlisle Mar 20 '14 at 15:12
3

You have not supplied a document so this is untested but you have incorrect syntax here:

\newcolumntype{s}{>{\centering}{{\hsize=.25\hsize}X}}

> takes a single argument and > and its argument must immediately precede the column specification or another > clause. So you need

\newcolumntype{s}{>{\centering\arraybackslash\hsize=.25\hsize}X}

or, if you prefer

\newcolumntype{s}{>{\centering\arraybackslash}>{\hsize=.25\hsize}X}
1

With package ragged2e:

\newcolumntype{s}{>{\Centering\hsize=.25\hsize}X}

which also allows hyphenation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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