LaTeX forum ⇒ Graphics, Figures & Tablesfit wide tables

Information and discussion about graphics, figures & tables in LaTeX documents.
carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

fit wide tables

Postby carol » Thu Mar 19, 2009 8:19 pm

Hi,
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

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Thu Mar 19, 2009 8:31 pm

Instead of all your descriptions you should have provided a minimal working example (MWE) because it is very difficult to figure out what you mean.

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¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7803
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Mar 20, 2009 12:14 am

Hi Carol,

perhaps this could help: Centering wide tables or figures.

Stefan
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links

carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Postby carol » Fri Mar 27, 2009 9:41 pm

Finally, it was narrow environment that suited the best. However, I noticed that the table caption is not extended to the width of the table but to the width of the text paragraph. It that normal?

thanks for your help

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Fri Mar 27, 2009 9:58 pm

I can't comprehend this issue.
  1. \documentclass[11pt,a4paper,english]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[latin1]{inputenc}
  4. \usepackage{babel}
  5. \usepackage{lmodern}
  6. \usepackage{blindtext}
  7.  
  8. \parindent0em
  9.  
  10. \newenvironment{narrow}[2]{%
  11. \begin{list}{}{%
  12. \setlength{\topsep}{0pt}%
  13. \setlength{\leftmargin}{#1}%
  14. \setlength{\rightmargin}{#2}%
  15. \setlength{\listparindent}{\parindent}%
  16. \setlength{\itemindent}{\parindent}%
  17. \setlength{\parsep}{\parskip}%
  18. }%
  19. \item[]
  20. }{\end{list}}
  21. \begin{document}
  22. \blindtext
  23. \begin{figure}[!ht]
  24. \begin{narrow}{-1cm}{-1cm}
  25. \rule{\linewidth}{5cm}
  26. \caption{\blindtext}
  27. \end{narrow}
  28. \end{figure}
  29.  
  30. \blindtext
  31. \end{document}

In case it doesn't work for you, provide a MWE as suggested earlier.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode:
HTML:
Hide post links
Show post links

carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Postby carol » Sat Mar 28, 2009 7:54 pm

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.

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 282 times

Link:
BBcode:
HTML:
Hide post links
Show post links

carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Postby carol » Tue Mar 31, 2009 11:06 pm

could the examples that I sent show the problems or should I send other examples?

Look forward to your reply,

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Wed Apr 01, 2009 7:09 pm

To me the situation is very clear. You do not handle the narrow environment correctly.
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. [...]

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: 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. [...]

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.
  1. Overfull \hbox (61.46605pt too wide) in paragraph at lines 38--50
  2. [][]
  3. []

And so does the caption but with a line break at the right. Compare the right margin of both captions. You should extend both margins by giving the same length in both parameters.
  1. \begin{narrow}{-1in}{-1in}
  2. % Contents
  3. \end{narrow}

If you want the caption of the second table to spread only over the original line width, then don't put it inside the narrow environment. Move it outside but keep it inside the table environment.
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. [...]

You can adjust some lengths to get the desired result [1]. Modify these lengths by adding the suitable lines into the preamble.

[1] TeX Frequently Asked Questions - question label "vertposfp"
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode:
HTML:
Hide post links
Show post links

carol
Posts: 105
Joined: Wed Dec 24, 2008 7:25 pm

Postby carol » Wed Apr 01, 2009 8:40 pm

Do you advise the same page dimension definition in the \documentclass and have the captions fitting the margin or another definition so that the caption would fit the length of tables and not beyond? I don't know which one is better. The first one might be more harmonious with paragraph width but the second one might be nicer with the table width.

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Thu Apr 02, 2009 5:21 pm

My advise concerns the page dimensions as well as the look of the tables themselves. There are many possibilities for customization.

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 369 times
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 3 guests