5

I don't understand what > does in:

>{\centering}

which I've seen used for centering text in columns such as:

\newcolumntype{C}[1]{>{\centering}m{#1}}

If it's possible I'd like to know what > does in general, but since it can have a lot of uses, if it's very long it's okay with just explaining how it works in my example.

Oh, and if this question is too basic tell me how to search for these things and where, because I've tried searching in this website and google and some others and I can't find it.

Torbjørn T.
  • 206,688
Mr. Nobody
  • 175
  • 1
  • 5
  • 1
    Welcome to TeX SX! It inserts the \centering directive at the very beginning of every cell in the column. Thus these cells will have a fixed width, and their content will be centred both horizontally and vertically. See the documentation of the array package. – Bernard Feb 09 '18 at 22:23
  • Welcome! Did you try checking the manual for the array package? – egreg Feb 09 '18 at 22:24
  • I think there should be an \arraybackslash after that \centering. Take a look at the documentation of array and the explanation of the \arraybackslash macro. – Skillmon Feb 10 '18 at 00:05
  • @Skillmon not necessarily. It is only needed in the final column and only if the table uses \\ rather than \tabularnewline to end the table rows. – David Carlisle Feb 10 '18 at 11:24
  • @DavidCarlisle true, but imho one should mention that... (and who uses \tabularnewline?) – Skillmon Feb 10 '18 at 11:47
  • "who uses \tabularnewline?" people who have \centering in their tables (that's why I added it to latex:-) – David Carlisle Feb 10 '18 at 12:08

1 Answers1

11
    >{stuff}

Just inserts stuff at the start of the cell so if the column is >{stuff}p{3cm} then it works as if the column was p{3cm} but every cell in that column started with stuff.

it is often used with declarations such as \centering but can be used with any tokens that can be used in a cell.

David Carlisle
  • 757,742