Graphics, Figures & Tablestabularx | Unwanted additonal Padding in Column

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
isharp2
Posts: 23
Joined: Fri Feb 11, 2011 2:06 am

tabularx | Unwanted additonal Padding in Column

Post by isharp2 »

Hi,
I would like all text in tabularx columns to be located at the same y-position on the page.
I find that using tabular X causes the second column to be padded, while the first column is not padded.

Working example:

Code: Select all

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\section{Appendix}
APPENDIX TIME.

\begin{table}[ht!]
\caption{Appendix} 
\label{Appendix}
\centering 
\begin{tabularx}{6.5in}{ |   p{1.25in} |  X |  }
\hline 
\textbf{a} & \textbf{b} \\ 

\hline 
\label{c}
c & d \\ 

\hline 
\end{tabularx} 
\end{table}
\cleardoublepage 
\newpage 

\end{document}

many thanks,

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

isharp2
Posts: 23
Joined: Fri Feb 11, 2011 2:06 am

tabularx | Unwanted additonal Padding in Column

Post by isharp2 »

Hi,
so it turns out that using:

Code: Select all

\label
adds a return character in the cell of your table. So to fix it, put your label at the end of the last column :)
MWE below.

Code: Select all

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\section{Appendix}
APPENDIX TIME.

\begin{table}[ht!]
\caption{Appendix} 
\label{Appendix}
\centering 
\begin{tabularx}{6.5in}{ |   p{1.25in} |  X |  }
\hline 
\textbf{a} & \textbf{b} \\ 

\hline 
c & d \label{c} \\ 

\hline 
\end{tabularx} 
\end{table}
\cleardoublepage 
\newpage 

\end{document}
 
Post Reply