General ⇒ Center alligning entries of a table
Center alligning entries of a table
\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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10397
- Joined: Mon Mar 10, 2008 9:44 pm
Center alligning entries of a table
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
Re: Center alligning entries of a table
Thank you