Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Following my post here, how could I use the command:

\resizebox{\linewidth}{!}{...}

to place a table a bit outside of the text margins?

EDIT:

At the moment this works fine for me. My only problem is that the height changes correspondingly which is something that I do not want.

\documentclass[12pt,a4paper]{article}
\usepackage{setspace}
\spacing{1.5}
% \raggedright

\usepackage[margin=1.3in]{geometry}

\usepackage[polutonikogreek,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{textalpha}

\usepackage{amsmath}

\usepackage{graphicx}
\usepackage{float}

\usepackage{color}
\usepackage{soul}

\usepackage{adjustbox}

\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\newcommand{\greek}[1]{{\selectlanguage{polutonikogreek}#1}}

\begin{document}

\section{Introduction}

\begin{table}[H]
    \begin{adjustbox}{width=1.3\textwidth,center}
        \begin{tabular}{ll}
            \hline
            \multicolumn{2}{c}{\head{Fuels}} \\
            \hline
            \multicolumn{1}{l}{\head{Name}} & \multicolumn{1}{l}{\head{Numbes}} \\
            \hline
            \ttfamily XXXXXXXXXX & \ttfamily XXX \\
            \ttfamily XXXXXXXXXX & \ttfamily XXX \\
            \hline
        \end{tabular}
    \end{adjustbox}
    \caption{Selected fuels}
    \label{tab:SelectedFuels}
\end{table}

\end{document}
share|improve this question
    
I would only resize text as a last resort. It can be very distracting to have sections of the document using arbitrarily changing font sizes just to make things fit. You can make the table extend beyond the margins, or adjust the inter-column spaces, or use specific design size such as \small or \footnotesize any of which might be preferable to scaling. –  David Carlisle Sep 15 '12 at 14:43
    
@DavidCarlisle You are right. Its a bit ugly to use arbitrarily font sizes. But, what else can I do? Can you give me further instructions? –  eualin Sep 15 '12 at 15:07
    
Well I gave some examples in the previous comment. Hard to say any more without any indication of the input table or what size you are trying to fit it to. –  David Carlisle Sep 15 '12 at 15:10
    
Please take a look at the updated question. –  eualin Sep 15 '12 at 15:14
    
That's a narrow table, I'd just use \centering\begin{tabular}... Do you really want to use a massive font to make it wider or have a massive gap between the columns just so they reach the edge? –  David Carlisle Sep 15 '12 at 15:30

2 Answers 2

Based on discussion in comments, I think you want something like this with two tables set to the same width:

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage{setspace}



\usepackage[margin=1.3in]{geometry}
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}



\begin{document}

\section{Introduction}


\noindent X\dotfill X

\noindent X\dotfill X

\begin{table}[hpt]
\centering
        \begin{tabular*}{.7\textwidth}{|@{\extracolsep{\fill}}ll@{}|}
            \hline
            \multicolumn{2}{c}{\head{Fuels}} \\
            \hline
            \multicolumn{1}{l}{\head{Name}} & \multicolumn{1}{l}{\head{Numbes}} \\
            \hline
            \ttfamily XXXXXXXXXX & \ttfamily XXX \\
            \ttfamily XXXXXXXXXX & \ttfamily XXX \\
            \hline
        \end{tabular*}

    \caption{Selected fuels}
    \label{tab:SelectedFuels}
\end{table}

\noindent X\dotfill X

\begin{table}[hpt]
\centering
        \begin{tabular*}{.7\textwidth}{|@{\extracolsep{\fill}}ll@{}|}
            \hline
            \multicolumn{2}{c}{\head{Fuels}} \\
            \hline
            \multicolumn{1}{l}{\head{Name}} & \multicolumn{1}{l}{\head{Numbes}} \\
            \hline
            \ttfamily XXXXXXX & \ttfamily XXX \\
            \ttfamily XXXXXXX & \ttfamily XXXYYYY \\
            \hline
        \end{tabular*}

    \caption{Selected fuels2}
    \label{tab:SelectedFuels2}
\end{table}

\end{document}

Note I changed [H] to [hpt] as I can say with some authority (being the person who first implemented it) that [H] is usually a bad choice. also I removed the \spacing command as that generates an error at the end of document as it starts a group but doesn't close it. I think it is intended to be used as an environment \begin{spacing}..\end{spacing} but didn't check the setspace documentation.

share|improve this answer

Here are some possibilities.

\documentclass{article}
\usepackage[left=3in,right=3in,showframe]{geometry}
%\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{adjustbox}

\begin{document}
\noindent\resizebox{\linewidth}{!}{%
\begin{tabular}{|c|c|c|c|c|}
  \hline
   some thing & some thing & some thing & some thing & some thing \\
  \hline
\end{tabular}%
}%

\begin{adjustbox}{width=1.2\textwidth,center}
\begin{tabular}{|c|c|c|c|c|}
  \hline
   some thing & some thing & some thing & some thing & some thing \\
  \hline
\end{tabular}
\end{adjustbox}

\begin{adjustbox}{max width=\textwidth,center}
\begin{tabular}{|c|c|c|c|c|}
  \hline
   some thing & some thing & some thing & some thing & some thing \\
  \hline
\end{tabular}
\end{adjustbox}

\noindent\makebox[\textwidth]{%
\resizebox{1.2\linewidth}{!}{%
\begin{tabular}{|c|c|c|c|c|}
  \hline
   some thing & some thing & some thing & some thing & some thing \\
  \hline
\end{tabular}%
}%
}%

\end{document}

enter image description here

share|improve this answer
    
Given that I would like to set a specific width for each table, \usepackage{adjustbox} seems as the best choice, right? However, I get the following error when loading the package \usepackage{adjustbox}: ! LaTeX Error: File `trimclip.sty' not found. –  eualin Sep 15 '12 at 12:46
    
@Hurish: Just changed the original post. The problem is that the height changes correspondingly which is something that I do not want. –  eualin Sep 15 '12 at 15:13
    
@Hurish: The MWE is up. Please take a look if you don't mind. –  eualin Sep 15 '12 at 15:26
    
@eualin: When you use \resizebox the hieght as well as width get resized. Here fonts are also resized and correspondingly the baseline skip etc. If you increase only the width, the fonts get skewed and look ugly. This solution is good only if you have a wide table that won't fit inside the margin. By the way what are you after if your table is not that wide?. Can you please clarify? –  Harish Kumar Sep 15 '12 at 15:30
    
@eualin: You can control the height also by putting height=4cm, as in \begin{adjustbox}{width=1.3\textwidth,height=4cm,center}. But I can't stand to see the results. –  Harish Kumar Sep 15 '12 at 15:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.