General ⇒ placing text in the center of the row
-
- Posts: 58
- Joined: Sun Apr 27, 2008 12:50 pm
placing text in the center of the row
Hi there,
I have created the table, where is the text in each row defaultly placed on the bottom. I need it in the middle. Any ide how?
cheers
a.k.
I have created the table, where is the text in each row defaultly placed on the bottom. I need it in the middle. Any ide how?
cheers
a.k.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
placing text in the center of the row
Hi,
you could use m-columns of the array package, like this example:
Stefan
you could use m-columns of the array package, like this example:
Code: Select all
\usepackage{array}
...
\begin{tabular}{m{1cm}m{1.5cm}}
text & long text, two lines
\end{tabular}
LaTeX.org admin
-
- Posts: 58
- Joined: Sun Apr 27, 2008 12:50 pm
Re: placing text in the center of the row
Cheers.
It works ok now. But how to center the columns now?
a.k.
It works ok now. But how to center the columns now?
a.k.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: placing text in the center of the row
Hi,
you wrote that you don't want the text at the bottom, you want it to be centered. So I understood you meant vertically centered.
Cells in m-columns are centered vertically. Table formatting is done by columns, not by rows.
Perhaps show us your table code to clarify. We will look then what we can change there.
Stefan
you wrote that you don't want the text at the bottom, you want it to be centered. So I understood you meant vertically centered.
Cells in m-columns are centered vertically. Table formatting is done by columns, not by rows.
Perhaps show us your table code to clarify. We will look then what we can change there.
Stefan
LaTeX.org admin
-
- Posts: 58
- Joined: Sun Apr 27, 2008 12:50 pm
Re: placing text in the center of the row
Before that I used {ccccc} - so the text was in the centre of the column but on the bottom of the row. I need it in the centre of both, bottom as well as row.
After applying what you have suggested I have text in the centre of the row but not column (it is now aligned to the left)
Here it is:
\begin{landscape}
\begin{table}[dp]
\centering
\begin{tabular}{m{1cm}m{6cm}m{6cm}m{2.2cm}m{2.2cm}}
\hline
& {\bf Fibre} & {\bf Laser spot} & {\bf Focus depth ($\mu$m)} & {\bf Peak position (nm)}\\
\hline\hline
a) & \includegraphics[scale=0.3]{DA} & \includegraphics[scale=0.3]{DB} & +20 & 647.485\\
b) & \includegraphics[scale=0.3]{BA} & \includegraphics[scale=0.3]{BB} & 0 & 647.514\\
c) & \includegraphics[scale=0.3]{CA} & \includegraphics[scale=0.3]{CB} & -20 & 647.542\\
\hline
\end{tabular}
\caption[Influence of focusing on the position of the 648 nm luminescence band.]{\textbf{Influence of focusing on the position of the 648 nm luminescence band.}}
\label{tab6-3}
\end{table}
\end{landscape}
After applying what you have suggested I have text in the centre of the row but not column (it is now aligned to the left)
Here it is:
\begin{landscape}
\begin{table}[dp]
\centering
\begin{tabular}{m{1cm}m{6cm}m{6cm}m{2.2cm}m{2.2cm}}
\hline
& {\bf Fibre} & {\bf Laser spot} & {\bf Focus depth ($\mu$m)} & {\bf Peak position (nm)}\\
\hline\hline
a) & \includegraphics[scale=0.3]{DA} & \includegraphics[scale=0.3]{DB} & +20 & 647.485\\
b) & \includegraphics[scale=0.3]{BA} & \includegraphics[scale=0.3]{BB} & 0 & 647.514\\
c) & \includegraphics[scale=0.3]{CA} & \includegraphics[scale=0.3]{CB} & -20 & 647.542\\
\hline
\end{tabular}
\caption[Influence of focusing on the position of the 648 nm luminescence band.]{\textbf{Influence of focusing on the position of the 648 nm luminescence band.}}
\label{tab6-3}
\end{table}
\end{landscape}
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
placing text in the center of the row
You could combine m and \centering. Let's create a new column type inside the preamble:
Later you can write:
Stefan
Code: Select all
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
Code: Select all
\begin{tabular}{M{1cm}M{6cm}M{6cm}M{2.2cm}M{2.2cm}}
LaTeX.org admin
-
- Posts: 58
- Joined: Sun Apr 27, 2008 12:50 pm
Re: placing text in the center of the row
PERFECT! Thanks a lot.
a.k.
a.k.