2

I have a two-column document and what to inset a table. My problem is that the some of the columns in the table overlaps into the other side column. I have found a question which deals with generating a column spanning two columns. But I want to make the table fit within a column width. Any suggestions would be great? Does one have to resize the text or manually specify the column width?

\documentclass[10pt,a4paper]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[margin=2.5cm]{geometry} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx} \usepackage{booktabs} \usepackage[colaction]{multicol} \usepackage{hyperref} \usepackage{lineno} \usepackage{setspace} \usepackage{lipsum} \title{Table formatting} \author{The geniuses at SE} \begin{document} \maketitle \doublespacing \begin{multicols}{2} \section{Introduction} \lipsum[1-1] \begin{center} \begin{minipage}{\columnwidth} \centering \captionaboveof{table}{Distribution of XXX} \begin{tabular}{c c c c c c c} \textbf{Sex} & \textbf{[0-1]} & \textbf{[1--5)} & \textbf{[5--10)} & \textbf{[10--25)} & \textbf{25-50} & \textbf{[50+]} \\ \hline M & 61\% & 28\% & 4\% & -\% & 6\% & x\% \\ F & 60\% & 25\% & 5\% & 3\% & 7\% & x\% \\ \hline \end{tabular} \end{minipage} \end{center} \lipsum[1-2] \end{multicols} \end{document} 

1 Answer 1

3

Here is one option, where you could just decrease the inter-column spacing; Instead of a regular \tabcolsep, I've reduced that to 35% of \tabcolsep:

enter image description here

\documentclass[10pt]{scrartcl} \usepackage[margin=25mm,paper=a4paper]{geometry} \usepackage{booktabs} \usepackage[colaction]{multicol} \usepackage{setspace} \usepackage{lipsum} \title{Table formatting} \author{The geniuses at SE} \begin{document} \maketitle \doublespacing \begin{multicols}{2} \section{Introduction} \lipsum[1-1] %\addvspace{\intextsep}% You may want to add this... \noindent \begin{minipage}{\columnwidth} \centering \captionaboveof{table}{Distribution of XXX} \setlength{\tabcolsep}{.35\tabcolsep} \begin{tabular}{ *{7}{c} } \toprule \textbf{Sex} & \textbf{[0-1]} & \textbf{[1--5)} & \textbf{[5--10)} & \textbf{[10--25)} & \textbf{[25-50)} & \textbf{[50+]} \\ \midrule M & 61\% & 28\% & 4\% & -\% & 6\% & x\% \\ F & 60\% & 25\% & 5\% & 3\% & 7\% & x\% \\ \bottomrule \end{tabular} \end{minipage} \addvspace{\intextsep} \lipsum[1-2] \end{multicols} \end{document} 

Since you included booktabs, I've used its rules.

2
  • thanks, that seems to do it. Can you suggest any other methods, I am just beginning with latex. Commented Jan 18, 2016 at 22:29
  • 1
    @lukeg: Alternative methods (this one included) are subjective and depends heavily on what you have in your table. Some people resize the entire tabular by wrapping it inside \resizebox{\columnwidth}{!}{...}. But that resizes everything and not everyone likes it. Commented Jan 18, 2016 at 22:32

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.