Centering text in \parbox

3,117

I think you are making the markup far more complicated than needed (and please always make your examples complete so people can run them) Something like:

enter image description here

\documentclass{article}
\usepackage{array,booktabs}
\begin{document}

\noindent X \dotfill X

\begin{table}
\centering
\begin{tabular}{c*{2}{>{\centering\arraybackslash}m{4.9cm}}}
\toprule
& \bfseries Cost & \bfseries Benefit\\
\midrule
\bfseries Social
& 
Possible land competition 

Possible increase of extraction of wood from forest
& 
Less air pollution 

Less medical expenses

More labour available \\
\bottomrule
\end{tabular}
\end {table}

\end{document}
Share:
3,117

Related videos on Youtube

Stefano
Author by

Stefano

L'esperimento dello Schiehallion è stato un esperimento scientifico del XVIII secolo — pensato e progettato in gran parte da Henry Cavendish, ma eseguito dall'astronomo Nevil Maskelyne — per tentare una misurazione della densità della Terra o, utilizzando le parole dello stesso Maskelyne, per rendere «palpabile la gravitazione universale della materia».

Updated on October 21, 2020

Comments

  • Stefano
    Stefano about 3 years

    I used \parbox to auto-wrap the text, but it should be centered. How can I do?

    enter image description here

    \begin{table}[H]
        \centering
            \begin{tabular}{cW{5}W{5}}
            \toprule
            & {\bf Cost} & {\bf Benefit}\\
            \midrule
            \multirow{3}{*}{\bf Social} & Possible land competition & Less air pollution \\
                                    & \multirow{2}{*}{\parbox{5cm}{Possible increase of extraction of wood from forest}} & Less medical expenses \\
                                    & & More labour available \\
                \bottomrule
            \end{tabular}
    \end {table}
    
    • touhami
      touhami about 8 years
      try \parbox{5cm}{\centering Possible increase of extraction of wood from forest}
    • Bernard
      Bernard about 8 years
      Where is the W column type defined?
    • David Carlisle
      David Carlisle about 8 years
      There is no need to use parbox here you can simply specify a width instead of * to multirow and it will use a p column. You shouldn't be using \bf in latex (it is not defined by default)