Graphics, Figures & Tables ⇒ How can I specify column width and then centering text?
-
- Posts: 17
- Joined: Sat Oct 10, 2009 9:28 pm
How can I specify column width and then centering text?
How can I specify column width and then centering text in tables? I tried p{2cm},however, the text will left aligned.
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How can I specify column width and then centering text?
Code: Select all
\begin{tabular}{>{\centering}p{10cm}}
% contents
\end{tabular}
Best regards
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10358
- Joined: Mon Mar 10, 2008 9:44 pm
How can I specify column width and then centering text?
use \centering and the array package:
Code: Select all
\usepackage{array}
...
\begin{tabular}{>{\centering\arraybackslash}p{2cm}...}
-
- Posts: 17
- Joined: Sat Oct 10, 2009 9:28 pm
Re: How can I specify column width and then centering text?
-
- Posts: 17
- Joined: Sat Oct 10, 2009 9:28 pm
Re: How can I specify column width and then centering text?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How can I specify column width and then centering text?
Code: Select all
\begin{table}[!ht]
\caption{Dummy table}\label{tab:dummy}
\centering
\begin{tabular}{>{\centering}p{10cm}}
% contents
\end{tabular}
\end{table}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10358
- Joined: Mon Mar 10, 2008 9:44 pm
How can I specify column width and then centering text?
Code: Select all
\begin{center}
\begin{tabular}
...
\end{tabular}
\end{center}
Code: Select all
\begin{table}[htbp]
\centering
\begin{tabular}
...
\end{tabular}
\end{table}
-
- Posts: 17
- Joined: Sat Oct 10, 2009 9:28 pm