8

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}
1
  • 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
8

\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.

2
  • Both solutions work, but, alas, they scale text size :_( @MartinScharrer Is there no command that just widens the spaces between words? – loved.by.Jesus Jun 10 '18 at 13:23
  • There might be, but I don't know it. Search for similar questions on this site, there are several. One might have the solution you want. – Martin Scharrer Jun 11 '18 at 12:49

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