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.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- 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: 10324
- 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: 10324
- 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