0

I have the following longtabu which does not compile and give an error. This example is shorter than my original, but my table just continues with more columns.

\documentclass{standalone}
\usepackage{amsthm,amsmath}
\RequirePackage{natbib}
\RequirePackage[authoryear]{natbib}% uncomment this for author-year bibliography
\RequirePackage{hyperref}
\usepackage[utf8]{inputenc} %unicode support
\urlstyle{same}
\usepackage[width=\textwidth]{caption}
\captionsetup{
labelsep = space,
justification = raggedright,
font = {footnotesize,singlespacing,sf},
labelfont = {footnotesize,bf,singlespacing,sf},
singlelinecheck=off,
skip=4pt,
position=top}
\usepackage{float}
\usepackage{pgfplots}
\usepackage{graphicx} 
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable,tabu}
\usepackage{array} 
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{threeparttable}
\usepackage{pgfplotstable}
\usepackage[markup=nocolor,final]{changes} Annehmen der Änderungen
\usepackage[markup=nocolor]{changes} 
 \usepackage{longtable,tabu}
 \begin{document}
  \begin{longtabu} to \textwidth{XXXX}
  \caption{Questions of online questionnaire}\\
\toprule
\multicolumn{1}{X}{Question Nr} & \multicolumn{1}{p{5cm}}{Questions} &          \multicolumn{1}{X}{Answer choices (simplified)} & \multicolumn{1}{X}{Conditions}\\
\midrule
1     & \multicolumn{1}{p{5cm}}{Is your practice part of practice network consisting of practices at different places?} & Yes/No (Y/N) & Madatory for all \\
2     & \multicolumn{1}{p{5cm}}{How many doctors do work in your practice?} & Number & Madatory for all \\
\end{longtabu}
\end{document}

The error is the following:
Argument of \tabu@ has an extra}

Any help is appreciated! Thanks :)

  • \end longtabu should be replaced by \end{longtabu}. – leandriis Jun 15 '18 at 15:56
  • sorry, I had in my code \end{longtabu}. But it gives me the mentioned error. This was just a typing error in the question. – Renata Josi Jun 15 '18 at 15:59
  • Why do you use that many \multicolumn{1} commands? They seem unnecessary to me. Also using the X column type for all 4 columns is not needed. You could for example use {p{1.2cm}Xp{2.5cm}l} instead. – leandriis Jun 15 '18 at 16:00
  • @RenataJosi please don't post code that does not produce the error, no one can help you in that case: edit the example to be a complete small test file that makes the error. – David Carlisle Jun 15 '18 at 16:01
  • I'm sorry. The one above produces the error. Thank you! – Renata Josi Jun 15 '18 at 16:07

1 Answers1

2

I'd suggest the following redesign of your table: Is it des not make much sense, to have four equally wide columns (especially not regarding the contents of the first and second column), I have used an l type column for the first column. Additionally, I have added the l option to all X columns in order to allow for a raggedright alignment in them. I have also added some multipliers (2) and (0.75). In order to make the second column wider. Lastly, I have added the \tabulinesep in order to adjust the spacing:

\documentclass{article}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{booktabs}
\setlength{\tabulinesep}{3pt}
\begin{document}

\begin{longtabu} to \textwidth {lX[2 l]X[l]X[0.75 l]}
\caption{Questions of online questionnaire}\\
\toprule
Nr & Questions & Answer choices (simplified) & Conditions\\
 \midrule
1     & Is your practice part of practice network consisting of practices at different places? & Yes/No (Y/N) & Madatory for all \\
2     & How many doctors do work in your practice? & Number & Madatory for all \\
\end{longtabu}
\end{document}

enter image description here

leandriis
  • 62,593