Graphics, Figures & Tables ⇒ fit wide tables
fit wide tables
How to shift a wide table to left? I have created a table using table and tabular environment. The width of columns is fine. I also use tiny as character size to fit every thing. However, I see that the table starts from the left margin of the page but goes to the end of the page width (see below). How is it possible to make use of the left margin as well?
suppose
left margin right margin
----------> <-------------
text fits here ..................
my table starts here and ends here--------------
how to shift as follows?
my table starts here and ends here ----------------
thanks
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
fit wide tables
You can either turn your table with help of the rotating package or use the narrow environment which is introduced in the epslatex document (Section 23 - Wide figures, p. 90f).
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
fit wide tables
Re: fit wide tables
thanks for your help
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
fit wide tables
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{lmodern}
\usepackage{blindtext}
\parindent0em
\newenvironment{narrow}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]
}{\end{list}}
\begin{document}
\blindtext
\begin{figure}[!ht]
\begin{narrow}{-1cm}{-1cm}
\rule{\linewidth}{5cm}
\caption{\blindtext}
\end{narrow}
\end{figure}
\blindtext
\end{document}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: fit wide tables
2- But if you look at the 2nd table (table 2), the caption doesn't have the same width as the table which is not normal.
3- I'd also like to know how to remove too much space between the two tables so that the table 2 will be displayed right below table 1.
To compare the width of the caption with the width of paragraph, I had put the following sentence
"Some texts are added to see how the caption is adjusted compared to the paragraphs. This is to verify on the parameters on narrow environment." but I made it as comment to show the space mentioned at point 3.
- Attachments
-
- test.tex
- (2.42 KiB) Downloaded 711 times
Re: fit wide tables
Look forward to your reply,
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
fit wide tables
With your document class you have got certain page dimensions such as the margins hence a specific line width. The default behaviour of captions is to fill the whole line width. For the first table you have the default layout (margins, line width) and the captions fits to the margins.carol wrote:1- Actually, the caption problem doesn't occur systematically. If you have a look at the attached file, the caption of the first table (table 1) is narrower than the table width (is it normal?) and narrow envir. is not used. I don't know how to adjust. [...]
The second table including its caption is inside the narrow environment. With the given parameters you extend only the left side into the margin by half an inch. The right margin is untouched. But your table is still too wide and looms into the right margin while beginning at the newly set left side. The result is an according error message.carol wrote: 2- But if you look at the 2nd table (table 2), the caption doesn't have the same width as the table which is not normal. [...]
Code: Select all
Overfull \hbox (61.46605pt too wide) in paragraph at lines 38--50
[][]
[]
Code: Select all
\begin{narrow}{-1in}{-1in}
% Contents
\end{narrow}
You can adjust some lengths to get the desired result [1]. Modify these lengths by adding the suitable lines into the preamble.carol wrote:3- I'd also like to know how to remove too much space between the two tables so that the table 2 will be displayed right below table 1. [...]
[1] TeX Frequently Asked Questions - question label "vertposfp"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: fit wide tables
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
fit wide tables
At first you should set up an appropriate type area with suitable margins. This is done best (for standard classes) with the geometry package.
The caption package allows to customize float captions in many ways. I did some modifications which you can adapt to your needs.
Concerning the tables, there is always room for improvement. I used the tabularx package to make your second table fit to the line width. The booktabs package makes tables look nicer and improves their legibility. The new narrow environment now is unnecessary.
The question for positioning of floats is answered by the optional parameters I gave to the table environments.
For all modifications see the attached file. To learn more about the used packages, refer to their manuals.
- Attachments
-
- test-mod.tex
- The modified example file.
- (2.71 KiB) Downloaded 1365 times
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10