GeneralTables with narrower margins

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
JoKo
Posts: 19
Joined: Tue Aug 12, 2008 11:28 am

Tables with narrower margins

Post by JoKo »

Hi,

I am writing my thesis using the book document class. I am quite pleased with the text's width, but I find it quite narrow for tables. Is there any way to for the table to start from the left sooner than the text?

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Tables with narrower margins

Post by Juanjo »

You can simply put a \hspace command with a negative length right before the tabular environment or, with the help of the @{} descriptor, in the tabular mandatory argument. For example,

Code: Select all

\hspace{-3cm}
\begin{tabular}{column descriptors}
  (tabular stuff)
\end{tabular}
or

Code: Select all

\begin{tabular}{@{\hspace{-2cm}}column descriptors}
  (tabular stuff)
\end{tabular}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Tables with narrower margins

Post by localghost »

JoKo wrote:Hi,

I am writing my thesis using the book document class. I am quite pleased with the text's width, but I find it quite narrow for tables. Is there any way to for the table to start from the left sooner than the text?
You can use a trick to get centered tables hanging into the margins on both sides.

Code: Select all

\begin{table}[!ht]
  \makebox[\textwidth]{%
    \begin{tabular}{*{15}{c}}
      ...
    \end{tabular}
  }
  \caption{Table with excess width}\label{tab:widetab}
\end{table}
But I think this is a very poor result. You should think about increasing the text width with geometry. Tables that exactly fit the text width are produced with tabularx. The documentations will show you how to get things work.


Best regards and welcome to the board
Thorsten¹
JoKo
Posts: 19
Joined: Tue Aug 12, 2008 11:28 am

Tables with narrower margins

Post by JoKo »

Juanjo wrote:You can simply put a \hspace command with a negative length right before the tabular environment or, with the help of the @{} descriptor, in the tabular mandatory argument. For example,

Code: Select all

\hspace{-3cm}
\begin{tabular}{column descriptors}
  (tabular stuff)
\end{tabular}
or

Code: Select all

\begin{tabular}{@{\hspace{-2cm}}column descriptors}
  (tabular stuff)
\end{tabular}
Thanks a lot for your help. The first example didn't produce the expected results. The second one is producing the format I wanted except for the lines ( \toprule and \hline ). I would be also glad to know the function of @ .
localghost wrote:
JoKo wrote:Hi,

I am writing my thesis using the book document class. I am quite pleased with the text's width, but I find it quite narrow for tables. Is there any way to for the table to start from the left sooner than the text?
You can use a trick to get centered tables hanging into the margins on both sides.

Code: Select all

\begin{table}[!ht]
  \makebox[\textwidth]{%
    \begin{tabular}{*{15}{c}}
      ...
    \end{tabular}
  }
  \caption{Table with excess width}\label{tab:widetab}
\end{table}
But I think this is a very poor result. You should think about increasing the text width with geometry. Tables that exactly fit the text width are produced with tabularx. The documentations will show you how to get things work.


Best regards and welcome to the board
Thorsten¹
At first, I was trying to do something similar using minipage and then the table inside. Unfortunately, neither of those methods produced the wanted result...

Thanks for your hospitality!


JoKo
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Tables with narrower margins

Post by gmedina »

Hi,

as localghost has mentioned, the result is really poor (from a typographic standpoint). However, the changepage package provides an easy solution:

Code: Select all

\documentclass{article}
\usepackage{changepage}
\usepackage{lipsum}%just to genearte some text

\begin{document}

\lipsum[1]
\begin{table}[!ht]
  \begin{adjustwidth}{-2.4cm}{}
    \begin{tabular}{*{14}{c}}
      text & text & text & text & text & text & text & text & text & text & text & text & text & text
    \end{tabular}
  \caption{Table with excess width}\label{tab:widetab}
  \end{adjustwidth}
\end{table}
\lipsum[1]
 
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
JoKo
Posts: 19
Joined: Tue Aug 12, 2008 11:28 am

Re: Tables with narrower margins

Post by JoKo »

Thanks a lot, gmedina!

This produces exactly the output I really wanted!
Acide Amine
Posts: 3
Joined: Wed May 16, 2012 9:58 am

Re: Tables with narrower margins

Post by Acide Amine »

Thanks gmedina !
Working and looking great.
Amine
Post Reply