# Center content in longtable

I have this table

\documentclass[a4paper]{scrartcl}
\usepackage{longtable}
\begin{document}

\begin{longtable}{c|p{6cm}p{4cm}p{4cm}}
\hline
Blub & Bla & Blip & Blop \\
Blub & Bla & Blip & Blop \\
\hline
\end{longtable}
\end{document}


Now, for whatever reason, I would like to center ONE cell of the second column. How would I achieve that?

Since you're using a paragraph column type (with fixed length), you can issue \centering inside the cell to centre it:

\documentclass[a4paper]{scrartcl}
\usepackage{longtable}
\begin{document}

\begin{longtable}{c|p{6cm}p{4cm}p{4cm}}
\hline
Blub & Bla & Blip & Blop \\
Blub & \centering Bla & Blip & Blop \\
\hline
\end{longtable}
\end{document}


Other column types (like l and r) requires a different approach.

• Wow... I bet I tried that before... oh well. Thanks! – cherrung Jul 13 '12 at 21:22
• With the caveat that if the last column is involved, either one says \centering\arraybackslash or ends the cell by \tabularnewline. – egreg Jul 13 '12 at 21:35
• I had to add a \par to close the centering to make this work for me. – rogueleaderr May 6 '16 at 0:58

Another approach -- which works regardless of whether the column is specified via l, r, or p monikers -- is to use the \multicolumn command. This command takes three arguments: set 1 as the first argument (the number of columns), c as the second argument (to center it, in this case), and "Bla" (or whatever it may be...) as the third argument:

\multicolumn{1}{c}{Bla}

• \multicolumn{1}{c|}{Bla} worked for me – A Fog Feb 25 at 9:25
• Does not work in the top row – A Fog Feb 25 at 9:27
• @AFog - \multicolumn works in any row, including the very first row. Please clarify what you mean by "does not work". – Mico Feb 25 at 9:33
• The specified column width was ignored when I used \multicolumn in the first row. – A Fog Feb 25 at 12:43
• @AFog - Not sure I understand what you are trying to say. For sure, the c column type, which LaTeX is told to use by the \multicolumn{1}{c}{Bla} directive, does not have a "prespecified column width". Hence, there is no prespecified column width to ignore to begin with. However, that doesn't mean that \multicolumn{1}{c}{Bla} "does not work." Please clarify what exactly you're trying to achieve. – Mico Feb 25 at 14:00