I am having trouble center alligning the contents of my table. I am using the array package. Below is the code.
\begin{center}
\newcommand{\mc}[3]{\multicolumn{#1}{#2}{#3}}
\scriptsize
%\renewcommand{\multirowsetup}{\centering}
%\renewcommand{\multicolumnsetup}{\centering}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|}
%\begin{tabular}{|m{0.6in}|m{0.4in}|m{0.4in}|m{0.45in}|m{0.4in}|m{0.45in}|m{0.4in}|m{0.45in}|m{0.4in}|m{0.45in}|}
\hline
% First row
\mc{2}{|c|}{\multirow{2}{*}{2.75xBW=550 lbs}} & \multicolumn{2}{m{0.8in}|}{28 mm ball diamter} & \mc{2}{m{0.8in}|}{56 mm ball diameter} & \mc{2}{m{0.8in}|}{28 mm ball diamter} & \mc{2}{m{0.8in}|}{56 mm ball diameter} \\ \cline{3-10}
%Second row
\mc{2}{|c|}{} & \mc{1}{m{0.4in}|}{CPS4 Stresses in neck region (MPa)} & \mc{1}{m{0.4in}|}{CPS4 Stresses in contact region (MPa)} & \mc{1}{m{0.4in}|}{CPS4 Stresses in neck region (MPa)} & \mc{1}{m{0.4in}|}{CPS4 Stresses in contact region (MPa)} & \mc{1}{m{0.4in}|}{CPE4 Stresses in neck region (MPa)} & \mc{1}{m{0.4in}|}{CPE4 Stresses in contact region (MPa)} & \mc{1}{m{0.4in}|}{CPE4 Stresses in neck region (MPa)} & \mc{1}{m{0.4in}|}{CPE4 Stresses in contact region (MPa)} \\ \hline
\end{tabular}
\end{center}
My objectives are:
(1) To get the first entry which is spanned by 2 columns and 2 rows to be alligned at the center. Presently, it is alligned close to the center of the first row (please look at the picture).
(2) How do I get center allignment horizontally for the contents of the other columns? I can get this by specifying \centering in every entry of the column. Is there a easier way to do this??
I would appreacite all suggestions to solve my problem.
Thank you
General ⇒ Center alligning entries of a table
Center alligning entries of a table
Last edited by shaikster on Mon Sep 29, 2008 2:59 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Center alligning entries of a table
Hi shaikster,
why do you declare c columns but use frequently \mc{1}{m{0.4in}|} ?
You could do it this way:
m gives you middle aligned paragraph cells, >{\centering} centers the content.
Stefan
why do you declare c columns but use frequently \mc{1}{m{0.4in}|} ?
You could do it this way:
Code: Select all
\begin{tabular}{|c|>{\centering}m{0.4in}|...}
Stefan
LaTeX.org admin
Re: Center alligning entries of a table
Thank you again Stefan..I was a ble to get the contents of all columns in the center except for the contents of first multicolumn and multirow box..These contents still seem to be alligned more on top rather than the center.
Thank you
Thank you