[Tex/LaTex] Improve the TeX-layout + Illegal pream-token

graphicspdftexpreambletables

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}

Best Answer

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.

Related Question