I'm writting a two column document, which is essentially the extended abstract of another document I have. I've been trying to include some of the tables I have in the extended abstract, but simply adding the tables does not work very well as their size ruins the document layout. I've been trying to resize the tables, but every solution I've come across for a tabular
or tabularx
, such as resizebox
or scalebox
doesn't seem to want to work for the csvreader
.
How do I apply one of these solutions to my existing table code? I want to scale the table so it fits inside the linewidth
Here's how my code looks for the tables (I included all the packages to make sure no weird interactions are at fault):
\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage{graphicx} % Enhanced LaTeX Graphics
\usepackage{subfigure} % subcaptions for subfigures
\usepackage{subfigmat}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{csvsimple}
\usepackage{siunitx}
\usepackage{float}
\setlength{\topmargin}{-10.4mm}
\setlength{\headheight}{0.0mm}
\setlength{\headsep}{10.0mm}
\setlength{\textwidth}{160mm}
\setlength{\textheight}{242mm}
\setlength{\oddsidemargin}{0mm}
\setlength{\evensidemargin}{0mm}
\setlength{\marginparwidth}{0mm}
\setlength{\marginparsep}{0mm}
\begin{document}
\begin{table}
\centering
\csvreader[no head,
before reading=\sisetup{round-mode=places,round-precision=2,round-integer-to-decimal}\caption{Baseline GF Competition Circle Track 2014}\label{tab:baseline1},
tabular={c | S l | S c | c | c},
table head =Level & {Tokens} & (Max) & {Time} & (Max) & {Sucess(\%)} & Score\\\hline,
late after line= \\,
late after last line=\\\hline\multicolumn{7}{c}{Total Score: 1481}]{tables/BC14.csv}{}
{\csvcoli & \csvcolii & \csvcoliii & \csvcoliv & \csvcolv & \csvcolvi & \csvcolvii}
\end{table}
\end{document}
simply changing the fontsize doesn't yield good results either. The table only gets an acceptable size with tiny
but then the text is too small to be properly read.
edit: the code with the resize box gives me a Missing \endgroup inserted.
I'm using pdfLatex
\begin{table}
\centering
\resizebox{\columnwidth}{!}{
\csvreader[no head,
before reading=\sisetup{round-mode=places,round-precision=2,round-integer-to-decimal}\caption{Baseline GF Competition Circle Track 2014}\label{tab:baseline1},
tabular={c | S l | S c | c | c},
table head =Level & {Tokens} & (Max) & {Time} & (Max) & {Sucess(\%)} & Score\\\hline,
late after line= \\,
late after last line=\\\hline\multicolumn{7}{c}{Total Score: 1481}]{tables/BC14.csv}{}
{\csvcoli & \csvcolii & \csvcoliii & \csvcoliv & \csvcolv & \csvcolvi & \csvcolvii}
}
\end{table}
edit2: an example of the .csv:
01,1.35,(2),12.2,(20),65,140
Best Answer
Here are two solutions. First we reduce the
\tabcolsep
and set a smaller font size.Adjust both as you wish.
In second, we use
adjustbox
package and resize the tabular to\columnwidth
Full code with both methods: