0

First of all, when I compile my TeX document it says: "! Package array Error: Illegal pream-token (D): `c' used."

How can that happend?

Second, I am gonna deliver a huge assignment in two weeks, so I would like to know, if any of you have some improvements to optimize the layout (so it looks more nicer). My preamble looks as follows:

\documentclass[a4paper,11pt,oneside]{article} 
\usepackage[english,danish]{babel}
\usepackage{fixltx2e} 
\usepackage{layout}
\renewcommand{\danishhyphenmins}{22} 
\usepackage[protrusion=true,expansion=true]{microtype} 

\addto\captionsdanish{
\renewcommand\appendixname{Appendiks}
\renewcommand\contentsname{Indhold}
\renewcommand\refname{Litteratur}
\renewcommand\listfigurename{Figur}}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{icomma}

\usepackage{amsmath,amssymb,bm,mathtools}
\usepackage[pdftex]{graphicx}
\usepackage{float}
\usepackage[left=3.0cm,right=3.0cm,top=3.0cm,bottom=3.0cm]{geometry}
\usepackage{setspace}
\setstretch{1.6}
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\usepackage{tabu}

\usepackage[round, colon, sort, authoryear]{natbib}
\setlength{\bibsep}{0.0pt}
\setlength{\bibhang}{2em}
\bibpunct{(}{)}{;}{a}{}{}
\setcitestyle{notesep={: }}
\def\citeapos#1{\citeauthor{#1}'s (\citeyear{#1})}

\usepackage{csquotes}
\MakeOuterQuote{"}

\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{shapes,arrows,positioning,calc, matrix} 

\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}
\usepackage{titletoc}
\usepackage{longtable}
\usepackage{array}
\usepackage{siunitx,multirow,tabularx,caption,subcaption,booktabs,threeparttable}

\newcommand{\sym}[1]{{}^{#1}} % correct?
\newcommand\mc[1]{\multicolumn{1}{@{}c@{}}{#1}} % handy shortcut macro
\newcommand\narrowtab[2]{%  %% macro to hide depth of its argument from outer tabular
 \ensuremath{\smash{\begin{tabular}[t]{@{}>{\raggedright\arraybackslash}p{#1}@{}}%
     #2 \end{tabular}}}}

\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}

\usepackage{pdfpages}
\includepdfset{pagecommand=\thispagestyle{plain}}
\renewcommand{\TPTnoteSettings}{\footnotesize}
\renewcommand{\TPTnoteLabel}[1]{#1}

\sisetup{input-symbols = ()}
\usepackage{fancyvrb}

I would appreciate all comments.

New table code:
\begin{document}
\begin{table}[H]
\caption{Regression results}\label{tabel1}
\begin{threeparttable}
\renewcommand\arraystretch{1.1}
\renewcommand\tabcolsep{1pt}  
\begin{tabular*}{\textwidth}{@{} p{1.3in} @{\extracolsep{\fill}} *{5}{D{,}{,}{2.4}} @{}}
\toprule
& \mc{Model I} & \mc{Model II} & \mc{Model III} & \mc{Model IV} \\
\emph{Afh.\ var.}
& \mc{All} & \mc{All} & \mc{Soc.Dem} & \mc{Liberal} \\
\midrule
\emph{Uafh.\ var.} \\
X & 
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
X & 
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
X & \\
\ \ \ $\Delta$92--93 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$93--94 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$94--95 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$95--96 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
X & \\
\ \ \ $\Delta$92--93 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$93--94 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$94--95 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
X & \\
\ \ \ $\Delta$92--93 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$93--94 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$94--95 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$95--96 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
X & \\
\ \ \ $\Delta$92--93 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$93--94 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$94--95 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\ \ \ $\Delta$95--96 &
0,11 (0,11) & 0,22 (0,11) & 0,33\sym{***} (0,11) & 0,44 (0,11) \\
\cmidrule{1-1}
Justeret R\textsuperscript{2} & 
0,11 & 0,22 & 0,33 & 0,44  \\
N & \mc{111} & \mc{222} & \mc{333} & \mc{444} \\
\bottomrule
\end{tabular*}
\end{threeparttable}
\end{table}
\end{document}
  • 1
    There isn't much point posting all those lines of code if they do not generate the error that you ask about. Presumably you have \begin{tabular}{DDD} somewhere and D is not a defined column type by default. – David Carlisle Dec 10 '14 at 15:45
  • It doesn't work. I should use dcoloum right? – A. F. Dec 10 '14 at 16:14
  • Can I still use siunitx? or – A. F. Dec 10 '14 at 16:15
  • What doesn't work? You should fix your code example so that it generates an error, how can people debug code that you have not shown? dcolumn defines a D column type but so can anyone else using \newcolumntype{D}{c} for example. How can we know if any definition fits your table? You haven't shown any use of siunitx other than loading the package, so I can't comment on that. – David Carlisle Dec 10 '14 at 16:29
  • Sorry about that. Now you can see my preamble (first part) and table (second part). Hope that helps - thank you! :) – A. F. Dec 10 '14 at 16:47
2

It would help more if you made the example a complete document but anyway that D is dcolumn syntax so most likely adding

\usepackage{dcolumn}

to the preamble will fix the problem, although that is untested as you have not provided a test file.

  • When I put that in my preamble it says: "{ missing [...]" – A. F. Dec 10 '14 at 18:21
  • I made a new question, where I specify what I mean. Hope that helps! :) – A. F. Dec 10 '14 at 18:40

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.