1

Apologies if this is a straightforward question, but how do you separate the columns in the following table so that the text isn't so close together?

    \documentclass[a4paper,11pt]{article}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\usepackage{gensymb}
\usepackage{times}
\usepackage{adjustbox}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage,caption}
\usepackage[british]{babel}
\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\usepackage[section]{placeins}%Allows you to permanently fix figures. 
\usepackage[left=2.5cm, right=2.cm, top=2.5cm]{geometry}

\begin{document}
\pagenumbering{roman}
\newpage
\addcontentsline{toc}{section}{Abbreviations}
\section*{Abbreviations}
\begin{longtable}
\setlength\tabcolsep{60pt}
\centering
  \small
 % your table
    \hspace*{-18mm}%
        \vspace{-5.5mm}%
\begin{longtable}
\toprule
{Abbreviation}&{Explanation}\\[0.5 ex]
\midrule
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
\bottomrule
 \end{longtable}%
    \hspace*{-12mm}%
    \vspace{50mm}

\label{table:ETD Raman}\\
\end{longtable}

\end{document}

I have gone through every line of code, changing paameters, but can't seem to move the text. I've attached my MWE and a picture of the output.

Thanks in advance!

Column width

5
  • 1
    Why did you nest a long table in another long table? What are you trying to achieve?
    – Bernard
    Feb 22 '18 at 18:24
  • increase \tabcolsep?
    – Zarko
    Feb 22 '18 at 18:24
  • 2
    Your begin{longtable} also misses the column types. Additionally, you seem to want to use this kind of table for a list of abbreviations. You might therefor be interested in the glossaries-extra or nomencl packages that can automatize this task.
    – leandriis
    Feb 22 '18 at 18:33
  • Notice that your code did not compile properly. The two columns are glued to each other. If you look at the log you'll see a lot of errors. Your LaTeX editor is probably reporting you these errors. Feb 22 '18 at 18:34
  • 1
    if you get an error message then do not even look at the pdf, which (as here) will be nonsense. You have not specified any columns so any output is purely accidental. Feb 22 '18 at 19:48
1

You example has many problems...

  • You are using longtable but you did not \usepackage{longtable};

  • As @Bernard pointed out, you don't have (must not?) to nest two longtable wnvironments. I changed the outer environment to table;

  • The answer to your actual question is: remove the \setlength\tabcolsep{60pt}. This line increases the width of each column by 120pt;

  • The longtable, as any other tabular environment (tabular, tabularx, etc.), takes a mandatory argument that is the column descriptors. I used tho centered columns for you ({c c});

  • And I removed a line break after \label{table:ETD Raman}.

  • You don't need to use \centering for longtable.

enter image description here

\documentclass[a4paper,11pt]{article}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\usepackage{gensymb}
\usepackage{times}
\usepackage{adjustbox}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage,caption}
\usepackage[british]{babel}
% \usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\usepackage[section]{placeins}%Allows you to permanently fix figures. 
\usepackage[left=2.5cm, right=2.cm, top=2.5cm]{geometry}

\begin{document}
\pagenumbering{roman}
\newpage
\addcontentsline{toc}{section}{Abbreviations}
\section*{Abbreviations}
% \begin{table}
% \setlength\tabcolsep{60pt}
% \centering
 % your table
\hspace*{-18mm}%
\vspace{-5.5mm}%
{\small
\begin{longtable}{c c}
\toprule
{Abbreviation}&{Explanation}\\[0.5 ex]
\midrule
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
\bottomrule
\label{table:ETD Raman}
 \end{longtable}%
    \hspace*{-12mm}%
    \vspace{50mm}
}

% \end{table}

\end{document}
7
  • 3
    longtable in table environment has not sense. in table is simpler use tabular or other table environments which are not designed to span table over many pages.
    – Zarko
    Feb 22 '18 at 18:42
  • 2
    Also, a longtable is automatically centred by default.
    – Bernard
    Feb 22 '18 at 18:58
  • @Zarko I didn't know that. To tell you the truth, I have never used longtable. But what if I want a caption to the table? Feb 22 '18 at 19:25
  • for example: \begin{table}\centering\begin{tabular} ... \end{tabular}\caption{....}\label{fig:...}\end{table} :-)
    – Zarko
    Feb 22 '18 at 19:34
  • @Zarko Oooohh, now I understood why... The floating environment doesn't let the longtable split at the page break. Thanks for that! Feb 22 '18 at 19:48
0

Update: problem solved! Turns out the issue was because I had nested my longtable into a table environment (this was mentioned above but I did not understand at the time).

I commented out the code referring to the table environment and now it works. The result is the table splits across 2 pages, columns are spaced appropriately.

\documentclass[a4paper,11pt]{article}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\usepackage{gensymb}
\usepackage{times}
\usepackage{adjustbox}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage,caption}
\usepackage[british]{babel}
% \usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\usepackage[section]{placeins}%Allows you to permanently fix figures. 
\usepackage[left=2.5cm, right=2.cm, top=2.5cm]{geometry}

\begin{document}
\pagenumbering{roman}
\newpage
\addcontentsline{toc}{section}{Abbreviations}
\section*{Abbreviations}
%\begin{table}
% \setlength\tabcolsep{60pt}
% \centering
  %\small
 % your table
    %\hspace*{-18mm}%
        %\vspace{-5.5mm}%
\begin{longtable}{c c}
\toprule
{Abbreviation}&{Explanation}\\[0.5 ex]
\midrule
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
Item1&Item1\\
\bottomrule
 \end{longtable}%
    \hspace*{-12mm}%
    \vspace{50mm}

\label{table:ETD Raman}
%\end{table}

\end{document}

Thanks for the help everyone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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