Graphics, Figures & Tables ⇒ Table with Column filling the remaining Width
Table with Column filling the remaining Width
How do I design a two-column table with paragraphs such that I fix the first column width, but I set the second column width to fill the remainder of the page width?
Also: How can I change this table width such that, for example, I can indent the left and right side of this table by 0.5 inches?
I have been searching on the internet for the past two days for solutions for my specific variation in using this kind of table, and I have not found any solutions for any kinds of tabular environments or people posting about this question. I went through the beginner guides in the Rules section, and those guides did not help. I tried searching this form for possible solutions, but none of the 117 matches that I ended up with were about my specific table construction.
So, how do I make a two-column table such that the second column fills the remainder of the page, or specified table width?
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
Table with Column filling the remaining Width
Code: Select all
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{caption}
\usepackage{booktabs,tabularx}
\captionsetup{
font=small,
labelfont=bf,
tableposition=top
}
\begin{document}
\begin{table}[!ht]
\caption{A table with a fixed width column and one that fills the remaining horizontal space.}
\centering
\begin{tabularx}{\dimexpr\textwidth-1in}{p{1in}X}\toprule
Table Head & Table Head \\\midrule
Some Text for Explanation & The quick brown fox jumps over the lazy dog. \\ \bottomrule
\end{tabularx}
\end{table}
\end{document}
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Table with Column filling the remaining Width
Also, a follow-up question:
I want to include a PDF (which contains an image) in a LaTeX document, but whenever I demand that the image width span the full page, the image either ends up on the last page, or I need to make the image small (like, 1 inch borders on either side).
I want to keep the image in the PDF, since it's mostly text and vector graphics, and I need the resolution. How do I force the image to span the full page width (and maybe even larger?
Code: Select all
\begin{figure}[!h]
\begin{center}
\includegraphics[width=17cm]{MyPDFVectorGraph}
\end{center}
\end{figure}
Code: Select all
\begin{figure}[!h]
\begin{center}
\includegraphics[width=\textwidth]{MyPDFVectorGraph}
\end{center}
\end{figure}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Table with Column filling the remaining Width
This is not really a follow-up questions since it is not related at all to the original question. You should not mix different topics in one thread and therefore open a new one.Andrej wrote:[…] I want to include a PDF (which contains an image) in a LaTeX document, but whenever I demand that the image width span the full page, the image either ends up on the last page, or I need to make the image small (like, 1 inch borders on either side). […]
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10350
- Joined: Mon Mar 10, 2008 9:44 pm
Table with Column filling the remaining Width
h
(also as !h
), allowing "here" is usually not sufficient. This way you don't allow floating to the top or to the bottom of a page. Where should it go if it happened, that "here" near the end of a page would not be sufficient space left?Regarding the width, you can put it centered within a box of the same width as the text:
Code: Select all
\begin{figure}[!htbp]
\makebox[\textwidth]{\includegraphics{MyPDFVectorGraph}}
\end{figure}
\makebox
centers by default. In general, better use \centering
with a figure
environment, not \begin{center}
... \end{center}
, because that causes additional vertical space.Stefan