4

Hi I want to make an additional line in my document. The problem is that it tells me \hline is a "undefined control sequence"...

I tried to create a small example file but the problem is that I use a large template from our University and I cannot get the small file running. It would be something like this: (As I didn't know exactly which packages are important for this problem I just copied them all, I'm sorry)

\documentclass[11pt,a4paper,english,oneside,final]{book} %To exclude pictures - "draft", to include pictures - "final" (LUCA)
\usepackage{etex} %Because of many packages --> Extended TeX.
\usepackage[left=1in, right=1in]{geometry} %Helps to structure the paper layout.
\usepackage[Lenny]{fncychap} %Design of the thesis.
\usepackage[utf8]{inputenc} %Due to vowels.
\usepackage[british]{babel} %Define the language style.
\usepackage{dsfont} %Nice style for the indicator function.
\usepackage{fancyhdr} %To customize the headers and footers.
\usepackage{booktabs} %In case you need \cmidrule or \addlinespace in tables.
\usepackage[hang,bottom,stable,multiple]{footmisc} %Style of footnotes.
\usepackage{appendix} %For the \appendixpage command.
%Load some mathematical packages.
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}

\usepackage{etoolbox} %To remove the page number on \appendixpage.
\usepackage{amsthm} %For theorems, definitions etc.
\usepackage{thmtools} %For theorems, definitions etc.
\usepackage{setspace} %Use double spacing.
\usepackage{lipsum} %For the \lipsum command to generate a text.
\usepackage{datetime} %For the specification of the date.
%\usepackage{tocloft} %The ToC, LoF and LoT each appear not necessarily on a new page.
\usepackage{graphicx,listings,xcolor,textcomp} %For the graphics, listings etc.
\usepackage{mcode} %To implement a Matlab code.
\usepackage[margin=10pt, font=small, labelfont=bf, labelsep=endash]{caption} %Customize the captions.
\usepackage{chngcntr} %To use counterwithout.
\usepackage{epstopdf} %For inserting .eps files into the document.
\usepackage{pdfpages} %For inserting .pdf files as a whole page (LUCA)
\usepackage{hyperref} %Must be loaded at the end.
\usepackage{xparse} %Load for \NewDocumentCommand command.
\usepackage{cleveref} %For the command \cref, load after hyperref.
\usepackage{arydshln} %Due to the capability to draw horizontal/vertical dash-lines.
\usepackage{array,hhline} %To create tables and matrices.
\usepackage{rotating} %To rotate a table.
\usepackage{tabularx} %An extended version of tabular.


%-----------------
\usepackage{amssymb,amsmath} %Um Mathematische Formeln schreiben zu können
%\usepackage{apacite} %Um APA Style zu verwenden --> Funktioniert nicht. Man muss dann zuerst natbib rauskommentieren aber wohl auch noch viel in der .bib Datei anpassen...!
\usepackage[sort,round]{natbib} %For the bibliography.
%-----------------
%


%Setup of the reference links.
\hypersetup{
     colorlinks=false,
     linkcolor=blue,
     citecolor=blue,
     filecolor=magenta,
     urlcolor=blue}

%Define some reasonable margins.
\setlength{\textwidth}{6.6in}
\setlength{\textheight}{8.8in}
\setlength{\topmargin}{-0.1in}
\setlength{\oddsidemargin}{0in}
\setlength{\parskip}{1mm}

\bibliographystyle{abbrvnat} %Reference style.
\allowdisplaybreaks[1] %Page breaks of equations are allowed, but avoided if possible. 2-4 more relaxed.

%New command for the UZH logo.
\newcommand*{\plogo}{\includegraphics{uzh_logo_e_pos}}

%New command for the differential d to have an ordinary d.
\makeatletter
  \newcommand{\ud}{\mathrm{d}}
\makeatother

%Remove page number on \appendixpage. Use the package 'etoolbox'.
\makeatletter
\patchcmd{\@chap@pppage}{\thispagestyle{plain}}{\thispagestyle{empty}}{}{}
\makeatother

%Declare Definitions, Theorems etc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\declaretheorem[style=definition,qed=$\blacktriangleleft$, numberwithin=chapter]{remark} %additional options; numberwithin=,..., see 'Thmtools' Users’ Guide
\declaretheorem[style=definition,qed=$\triangle$,numberwithin=chapter]{definition}
\newtheorem{ass}{Assumption}[chapter]
\newtheorem{prop}{Proposition}[chapter]
\newtheorem{lemma}{Lemma}[chapter]
\declaretheorem[style=definition,qed=$\perp$,numberwithin=chapter]{example}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{coroll}{Corollary}[chapter]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Readjust the numbering.
\counterwithout{footnote}{chapter}
\numberwithin{equation}{chapter}


\begin{document}
\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{rrr}
    \toprule
    Time  & Returns & Value \\
    \midrule
    \multicolumn{1}{l}{0} &       & \multicolumn{1}{l}{100} \\
    \multicolumn{1}{l}{1} & 60\%  & \multicolumn{1}{l}{160} \\
    \multicolumn{1}{l}{2} & -30\% & \multicolumn{1}{l}{112} \\ 
\hline
    \multicolumn{2}{l}{arithmetic mean return} & 15.00\% \\
    \multicolumn{2}{l}{geometric mean return} & 5.83\% \\
    \multicolumn{2}{l}{variance of the returns} & 20.25\% \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%
\end{document}

When I drop the "\hline" it works perfectly fine in my actual tex file. But when I add \hline I get the error.

I think \usepackage{tabularx} is important.

Could someone help me?

Thanks

  • The exact error message is: (line 12 in the original tex file) ! Undefined control sequence. \adl@hline ...mpcnta \xdef \adl@rowsL {\adl@rowsL (#1/\number \@tempcnta );}... l.12 \hline – Luca Lengwiler Jun 22 '15 at 12:21
  • 1
    Welcome to TeX.SE! Please provide a full MWE, narrowing it down to the relevant bit to reproduce the problem. As is, it's very long. Also, you can properly format it by clicking on edit, then selecting the whole code in your question and then clicking on the {} icon. – Alenanno Jun 22 '15 at 12:24
  • Please, add to your question the precise error message, with the same line breaks. – egreg Jun 22 '15 at 12:51
9

You should load tabularx before arydshln.

Also load hyperref and cleveref last.

  • A rare bird indeed -- an egreg answer without a single upvote for an entire month after it's been posted! No longer... :-) – Mico Jul 22 '15 at 13:53

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.