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.

I see that many people have already asked the same question, but unfortunately I can't make it work for me at the moment. So, once again, how can I centre and fit tables larger than that to my report? Command \scalebox{0.8} doesn't work for larger tables.

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

\usepackage[margin=1.3in]{geometry}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{soul}
\usepackage{color}
\usepackage{graphicx}

\newcommand{\head}[1]{\textnormal{\textbf{#1}}}

\usepackage[polutonikogreek,english]{babel}
\usepackage[utf8x]{inputenx}
\newcommand{\greek}[1]{{\selectlanguage{polutonikogreek}#1}}

\begin{document}

\begin{table}
    \centering
    \resizebox{\linewidth}{!}{\begin{tabular}{ll}
    \hline
    \head{XXXXXXXXX} & \head{XXXXXXXXX}\\
    \hline
    \ttfamily xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx & \ttfamily xxxxxxxxxxxxxxxxxxxxxx \\
    \ttfamily xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx & \ttfamily xxxxxxxxxxxxxxxxx \\
    \ttfamily xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx & \ttfamily xxxxxxxxxxxxxxxxx \\
    \ttfamily xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx & \ttfamily xxxxxxxxxxxxxxxxx \\
    \hline
    \end{tabular}}
    \caption{Articles related to stock-prediction techniques}
    \label{tab:RegressionMarketEquitiesRSSs}
\end{table}

\end{document}
share|improve this question
2  
Please add a fully compilable minimal working example (MWE) that illustrates your problem. –  canaaerus Sep 13 '12 at 16:53
1  
I try to avoid scaling text (although it should work, I don't know why you say it doesn't) better really is to choose a small font size eg \footnotesize\begin{tabular}.... –  David Carlisle Sep 13 '12 at 17:20
add comment

1 Answer

up vote 7 down vote accepted

\scalebox{0.8}{..} simply scales to 80% of the original size. You need to use \resizebox{\linewidth}{!}{..} to scale it to the text width. Both macros are from graphicx. Note that you can't have special content inside them, e.g. verbatim text etc.

For such content I recommend the adjustbox package. You can use e.g. \begin{adjustbox}{width=\linewidth} .. \end{adjustbox}. It's even possible to make the table a little wider than the text using e.g. the keys width=1.2\linewidth,center.

share|improve this answer
    
Thanks Martin! It works. Just one last question: In addition to the above, how could I make the Appendix a bit more wide (but revert back to the original settings when the section is over)? –  eualin Sep 13 '12 at 21:38
add comment

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.