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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer
    
Wow... I bet I tried that before... oh well. Thanks! – cherrung Jul 13 '12 at 21:22
2  
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 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}
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.