## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ \end{longtabu} not compiling

Information and discussion about graphics, figures & tables in LaTeX documents.
Posts: 10
Joined: Mon Mar 30, 2015 9:39 am

### \end{longtabu} not compiling

Cross posted (sorry - beginner's mistake): http://tex.stackexchange.com/questions/ ... 664_236134

I have copy-pasted the codes and usepackages from a colleague to help me set up a long table landscape style. When I try to compile the copied code in a fresh document the compiling stops at the \end{longtabu} and I can not figure out why.

This is what I have in my document:
\documentclass[a4paper, 12pt]{article} \usepackage{tabularx}\usepackage[english]{babel}%\usepackage[round,sort&compress]{natbib}   % Natbib for better citations %longnamesfirst\usepackage{pdflscape}	% landscape env\usepackage[bottom]{footmisc}% places footnotes at page bottom\usepackage{rotating}\usepackage{longtable}\usepackage{tabu}\usepackage{tablefootnote}\usepackage{lipsum}\usepackage{blindtext}%\usepackage{fancyref}%\renewcommand{\fancyrefdefaultformat}{plain}\usepackage[round,colon]{natbib}  \title{xxx}\author{yyy}\begin{document} \tabcolsep=3pt % Half the width of the horizontal space between columns\extrarowsep=3pt\begin{landscape}\scriptsize\begin{longtabu} to \linewidth {	p{14em}      	% paper col aligned left	c		% levels	p{5em}		% criterion	X[2.5,l] 	% state var	X[1,l] 	% stage length	p{4em} 	% decisions	l 	% application	X[2.5,l] 	% misc	}   \caption{Overview over literature using MDPs for modeling within cattle farming.}\label{tab:cattle}\\   \toprule   Paper\footnotemk{a} & Levels\footnotemk{b} & Criterion\footnotemk{c} & State variables\footnotemk{d} & Stage Length\footnotemk{e} & Decisions\footnotemk{f} & Application\footnotemk{g} & Misc\\   \midrule\endfirsthead   \caption{Overview over literature using MDPs for modeling (cattle farming - table continued).}\\   \toprule   Paper\footnotemk{a} & Levels\footnotemk{b} & Criterion\footnotemk{c} & State variables\footnotemk{d} & Stage Length\footnotemk{e} & Decisions\footnotemk{f} & Application\footnotemk{g} & Misc\\   \midrule\endhead   %\midrule   (\emph{Continued on next page}) &  \\   \bottomrule\endfoot   \bottomrule\endlastfoot% table content%\cite{Giordano12} & ? & ? (?) & ? & ? & ? & ? & Study impact of reproductive programs. As I can read they do not use MDP?? \\%\cite{Cabrera12} & ? & ? (?) & ? & ? & ? & ? & Again they use Markov chain (so we do not include it?)\\\cite{Kalantari12} & 1 & $DR$ (VI) & lactation (9), days in preganacy (282), DIM (750), milk yield (5) & day ($\infty$) & K, R & dairy (US) & Study the effect of reproductive performance.\\\cite{Heikkila12} & 1 & $DR$ (PI) & month (78), culling reason (3), mastitis cases (5)  & month ($\infty$) & K, R & dairy (FIN) & Focus on clinical mastitis \\\cite{Langford12} & 1 & $DR$ (VI) & parity (12), milk yield level (15) & parity (20) & K, R & dairy (UK) & Extension of \cite{Stott94} which study the effect on welfare \\\cite{Cha11} & 3 & $DR$ (HPI) & permanent milk yield level (5); dummy (1); temporary milk yield level (5), pregnancy state (9), clinical mastitis state (13) & cow life ($\infty$); parity (8); month (20) & I, K, R & dairy (US)& Lactation number and stage of lactation known from stage number. Extension of the work by \citet{Bar08a} and \citet{Cha10}. \\\cite{Demeter11} & 4 & $DR$ (HPI) & permanent milk yield potential (PMYP) estimated at first calving(13); PMYP estimated at the beginning of lactation (13), months open previous lactation (8); PMYP estimated this month (13), temporary milk yield capacity (13), pregnancy state (2); PMYP estimated this month (13), temporary milk yield capacity (13) & cow life ($\infty$); parity (12); month/gestation period (18); month (9) & I, K, R & dairy (NL) & Used to assess herd level implication of genetic selection strategies. Lactation number, stage of lactation and month of pregnancy known from stage numbers. \\\cite{Cabrera10} & 1 & R/T (LP) & parity (15), month in lactation (24), pregnancy status (10) & month ($\infty$) & K, R & dairy (US) & Consider different diets and nitrogen excretion  \\\cite{Cha10} & 3 & $DR$ (HPI) & permanent milk yield level (5); dummy (1); temporary milk yield level (5), pregnancy state (9), lameness state (13) & cow life ($\infty$); parity (8); month (20) & I, K, R & dairy (US)& Lactation number and stage of lactation known from stage number. Extension of the work by \citet{Bar08a} with focus on lameness.  \\\cite{Kalantari10} & 1 & DR (VI) & lactation (12), month after calving (24), milk production class (15), pregnancy status (10) & lactation (180) & K, R & dairy (IR) & A modification of \cite{VanArendonk85a} applied to Iran conditions.  \\\cite{Nielsen10} & 3 & $DR$ (HPI) & dummy (1); milk yield potential (MYP) estimated at the beginning of lactation (13); combination of MYP estimated until present day and temporary milk yield level (45 combinations), drying off week (32) & cow life ($\infty$); parity (10); day (483) & K, R & dairy (DK) & Lactation number and stage of lactation known from stage number. Focus on management. Bayesian updating used.\\%\cite{Stygar10} & ? & ? (?) & ? & ? & ? & ? & A review of models applied to Beef prod\\\cite{Bar08,Bar08a} & 3 & $DR$ (HPI) & permanent milk yield level (5); mastitis in previous lactation (2); temporary milk yield level (5), pregnancy state (9), mastitis state in present lactation (13)  & cow life ($\infty$); parity (8); month (20) & I, K, R & dairy (US)& Lactation number and stage of lactation known from stage number. Focus on cost of clinical mastitis.   \\\cite{Heikkila08} & 1 & $DR$ (PI) & lactation (10), milk yield (3), health status (3) & lactation ($\infty$) & K, R & dairy (FIN) & Focus on diseases and milk yield. \\\cite{Nielsen07, Nielsen04} & 4 & $R/T$ (HPI), $R/Q$ (HPI) & birth month (12); live weight (up to 26) previous winter feeding level (2), weigh gain (5); weight gain at fattening (3) & steer life ($\infty$); seasons (summer/winter) (6); month (up to 6); month (4)& G, Fe, Fa, R & steer (DK) & \cite{Nielsen04} consider average reward per steer while in \cite{Nielsen07} the average reward per time unit is maximized \\\cite{Vries06} & 1 & $DR$ (VI) & lactation (12), days open (10), month of lactation (24), milk yield (15) & month ($\infty$) & K, R & dairy (US) & Extension of model by \cite{Vries04}.\\%\cite{Groenendaal05} & ? & ? (?) & ? & ? & ? &  Not MDP: Delete \\\cite{Stott05} & 1 & $DR$ (VI) & lactation (12), milk yield (15) & lactation (20) & K, R & dairy (UK) & Studies financial incentive to control paratuberculosis. Extension of model by \cite{Stott94}.\\%\cite{Vries05} & ? & ? (?) & ? & ? & ? & ?& I don't think this is MDP: Delete \\%\cite{Groenendaal04} & ? & ? (?) & ? & ? & ? & Not MDP: Delete \\\cite{Vries04} & 1 & $DR$ (VI) & lactation (12), days open (10), month of lactation (24), milk yield (15), month of calving (12) & month ($\infty$) & K, R & dairy (US) & Studies the effect of delayed replacement with seasonal cow performance.\\\cite{Grohn03} & 1 & $DR$ (VI) & lactation (12), days open (10), month of lactation (20), milk yield (5), month of calving (12), disease state (240) & month (60) & I, K, R & dairy (US) & Extension of models by \cite{Delorenzo92} and \cite{Mccullough96}. \\\cite{Stott02} & 1 & $DR$ (VI) & lactation (12), milk yield (15), somatic cell count (11) & lactation (20) & K, R & dairy (UK) & Extension of model by \cite{Stott94}. \\\cite{Pihamaa02} & 1 & $DR$ (VI) & live weight (507) & week (326) & Fe, K, R  & beef (FIN) & Study the effect of agricultural policy reforms in Finland. \\\cite{Rajala-Schultz01} & 1 & \emph{DR} (VI) & lactation (12), production level (5), month of calving (12), month of lactation (19), days open (10)  & month (60) & I, K, R & dairy (FIN) & Compares optimal decisions with farmer decisions. Use of model by \cite{Mccullough96}.\\\cite{Vargas01} & 1 & \emph{DR} (VI) & lactation $l$ (12), stage in lactation (11), milk yield $l$ (15), $l-1$ (15) & month (180) & I, K, R & dairy (CR) & Based on model by \cite{VanArendonk85a}.\\\cite{Rajala-Schultz00, Rajala-Schultz00a} & 1 & $DR$ (VI) &  parity (12), days open (10), stage of lactation (19), production level (3, 5, 7), month of calving (12) & month (48-120)  & I, K, R & dairy (FIN) &  Use of model by \cite{Mccullough96}. \\\cite{Yalcin00} & 1 & $DR$ (VI) & lactation (12), milk yield (15), somatic cell count (11) & lactation (20) & K, R & dairy (UK) & Extension of work by \cite{Stott94}\\%\cite{Makulska99} & ? & ? (?) & ? & ? & ? & ? &  Model never built: Delete \\%\cite{Allore99} & ? & ? (?) & ? & ? & ? & ? & Only MC: Delete \\\cite{Cardoso99, Cardoso99a} & 1 & $DR$ (VI) & lactation $l$ (12), stage in lactation (11), milk yield $l$ (15), $l-1$ (15) & month (240) & I, K, R & dairy (BR) & Use of model by \cite{VanArendonk85a}. \\\cite{Mourits99, Mourits99a} & 2 & $DR$ (HPI) & month of birth (12); body weight (173), reproductive state (32), prepubertal growth rate (3) & rearing period ($\infty$); month (30) & Fe, I, K, R & heifers (NL) & Age of heifer known from stage number. The keep and inseminate decisions can be done under different growth strategies \\%\cite{Mourits99a} & ? & ? (?) & ? & ? & ? & ? \\%\cite{Polimeno99} & 1 & $R$ (VI) & body weight & 4 weeks (11) & Fe & dairy & Deterministic model \\%\cite{Allore98} & ? & ? (?) & ? & ? & ? & ? & Only MC: Delete \\%\cite{Lehenbauer98} & ? & ? (?) & ? & ? & ? & ? & Review paper - no model built: Delete \\%\cite{Noordegraaf98} & ? & ? (?) & ? & ? & ? & ? & Only MC: Delete \\\cite{Yates98} & 1 & $DR$ (LP) & lactation (12), genetic level (4) & year (10) & K, R & dairy (UK) & The keep decision has 2 options: produce calf for replacement or for beef.  \\\cite{Dekkers98} & 1 & $DR$ (VI) & lactation $l$ (12), month in lactation (16), milk yield $l$ (15), calving intervals (6) & month (180) & I, K, R & dairy (CDN) & Quantify the impact of persistency of lactation. Adaptation of the work in \cite{VanArendonk85a} \\\cite{Haran97} & 2 & $DR$ (HPI) & month of first calving (12); current month (12), milk production level (15), time of conception (5)  & cow life ($\infty$); lactation stage (72) & I, K, R & dairy (IRL) & Lactation number and stage of lactation known from stage number.  \\%\cite{Mourits97} & ? & ? (?) & ? & ? & ? & heifer & No model given. Talk about a model by Galligan96 (proc) \\%\cite{Hardie96} & ? & ? (?) & ? & ? & ? & ? & PHD WITH NO ACCESS\\\cite{Mccullough96,Mccullough96a} & 1 & \emph{DR} (VI) & lactation (12), production level (15), month of calving (12), month of lactation (19), days open (10) & month (60) & I, K, R & dairy (US) & Focus: levels of state variables, milk price and management inputs. Model based on \cite{Delorenzo92} \\%\cite{Yates96,Yates96a} & ? & ? (?) & ? & ? & ? & ? & SEEMS TO BE A MC \\\cite{Houben94} & 2 & \emph{R/T} (HPI) & dummy (1); milk production $l$ (15), $l-1$ (15), calving interval (18), mastitis current month (2), mastitis cases $l$ (4), $l+1$ (4) & life span of a cow ($\infty$); month (204) & I, K, R & dairy (NL) & Focus on mastitis \\\cite{Stott94} & 1 & \emph{DR} (VI) & lactation (12), yield class (15)  & lactation ($\infty$) & K, R & dairy (UK) & Uses bayesian updating for milk yield \\%\cite{Jalvingh93, Jalvingh93a, Jalvingh94} &  1 & \emph{DR} (VI) & lactation $l$ (10), stage in lactation (11), milk yield $l$ (15), time of conception (7), month of calving (12) & month (180) & I, K, R & dairy (NL) & Focus: calving patterns. MDP based on \cite{VanArendonk86}. ONLY MC\\\cite{Kennedy93} & 1 & \emph{DR} (VI) & lactation $l$ (12), yield class (5), mastitis status $l-1$ (2)  & lactation ($\infty$) & K, R & dairy (UK) & Focus: model and bayesian updating\\\cite{Stott93} & 1 & $DR$ (VI) & lactation number (12), mastitis state (2) & lactation ($\infty$) & K, R & dairy (UK) & Focus on clinical mastitis. \\\cite{Delorenzo92} & 1 & \emph{DR} (VI) & lactation (12), production level (15), month of calving (12), month of lactation (16), days open (7)  & month (240) & I, K, R & dairy (US) & Model based on \cite{VanArendonk86} \\%\cite{Kristensen92} & ? & ? (?) & ? & ? & ? & & Considers how to solve the multi-component system. The model is applied to the MDP in \cite{Kristensen89}. \\%\cite{Kristensen91b} & ? & ? (?) & ? & ? & ? & ? & Theoretical study - no model developed: Delete?  \\\cite{Dekkers91} & 1 & $DR$ (VI) & lactation $l$ (12), stage in lactation (11), milk yield $l$ (15), $l-1$ (15), time of conception (6) & month (180) & I, K, R & dairy (CDN) & Studies economic values for breeding goals. Adaptation of the work in \cite{VanArendonk85a} \\\cite{Boichard90} & 1 & \emph{DR} (VI) & lactation $l$ (6), lactation stage (22), stage of conception (7), calving date (18), milk yield in $l$ (9), $l-1$ (9) & 20 days (200) & I, K, R & dairy (F) & Focus: economic value of conception \\\cite{Harris90} & 1 & \emph{DR} (VI) & lactation (10), best linear prediction of future milkfat production, milk volume production, milk protein production, breed, calving date (6) & year (20) & K, R & dairy (NZ) & It is not clear from the description whether an optimization is performed or the model is only used for simulation.  \\\cite{Kristensen89, Kristensen91, Kristensen91a} & 2 & $R/Q$ (HPI) & estimated genetic class at first calving (5); milk yield of present lactation (15), milk yield of previous lactation (15), length of calving interval (8)  & cow life ($\infty$); 4 week period (108) & K, R & dairy (DK) & Lactation number and stage of lactation known from stage number. Average reward per kg milk is maximized. Extension of work by \cite{Kristensen87}. The model is later applied by \cite{Kristensen91a,Kristensen91} \\ %\cite{Kristensen92} considers how to solve the multi-component system. \\\cite{Rogers1988a, Rogers1988b} & 1 & $DR$ (VI) & lactation $l$ (12), stage in lactation (11), milk yield $l$ (15), $l-1$ (15), time of conception (6) & month (180) & I, K, R & dairy (US) & Adaptation of the work in \cite{VanArendonk85a} \\\cite{Kristensen87} & 2 & $DR$ (HPI) & estimated genetic class at first calving (5); milk yield of present lactation (15), milk yield of previous lactation (15), length of calving interval (8)  & cow life ($\infty$); lactation stage (24) & K, R & dairy (DK) & Lactation number and stage of lactation known from stage number.  \\\cite{VanArendonk86} & 1 & \emph{DR} (VI) & lactation $l$ (12), stage in lactation (11), milk yield $l$ (15), time of conception (6), month of calving (12) & month (180) & I, K, R & dairy (NL) & Extension of the work in \cite{VanArendonk85} \\\cite{VanArendonk85a, VanArendonk88} & 1 & \emph{DR} (VI) & lactation $l$ (12), stage in lactation (11), milk yield $l$ (15), $l-1$ (15), time of conception (6) & month (180) & I, K, R & dairy (NL) & Extension of the work in \cite{VanArendonk85} \\\cite{VanArendonk85,VanArendonk85b} & 1 & \emph{DR} (VI) & lactation $l$ (12), stage in lactation (11), milk yield $l$ (15), $l-1$ (15) & month (240) & I, K, R & dairy (NL) & The model has had a huge impact on later models.\\\cite{Ben-Ari83, Ben-Ari86} & 1 & DR (VI) & lactation, milk yield, body weight & lactation ($\infty$) & K, R & dairy (IL) & \citet{Ben-Ari86} consider how to solve the multi-component system. \\\cite{Killen78} & 1 & $R$ (VI) & lactation number (9) & lactation (20) & R, K & dairy (IRL) & Very small model.\\\cite{Stewart77,Stewart78} & 1 & \emph{DR} (VI) & lactation (7), body weight (5), 305d milk yield (11), milk fat pct (7) & lactation (10) & R, K & dairy (CDN)  & \cite{Stewart77} describe the model and \cite{Stewart78} consider different breeds. Culling decisions were assumed to occur at 60 days postcalving \\\cite{McArthur73} & 1 & $R$ (VI) & lactation number (7), milk production level (80) & lactation (15) & K, R &  dairy (NZ) & Milk yield represented as average over lactations. \\\cite{Smith73,Smith71} & 1 & \emph{DR} (VI) & lactation $l$ (6), yield in $l$ (29), $l-1$ (29), calving interval (3) & lactation (15) & R, K & dairy (US) & Far more detailed model than the one by \cite{Giaever66}.\\\cite{Giaever66} & 1 & $DR$ (VI) & lactation number (5), calving interval (3), milk yield (7) &  & & dairy (US) & Alternative optimization methods described. Important considerations about Markov property.\\\end{longtabu} \footnotetxt{a}{Papers have been ordered in reverse order of year.}\footnotetxt{b}{Number of levels in the MDP. If 1 then the MDP is an ordinary MDP.}\footnotetxt{c}{$DR$ = expected discounted reward, $R$ = expected reward, $R/T$ = average reward per time unit, $R/Q$ average reward per quantity unit. Algorithm used is given in parentheses (VI = value iteration, PI = policy iteration, HPI = hierarchical policy iteration, LP = Linear programming).}\footnotetxt{d}{State variables for each level in the process (separated with semicolon). The number of levels/classes of each state variable is given in parentheses.}\footnotetxt{e}{Stage length at each level in the process (separated with semicolon). Maximum number of stages given in parentheses.}\footnotetxt{f}{R = replace, K = keep, I = Inseminate, G = Grazing, Fe = Feeding intensity, Fa = Fattening.}\footnotetxt{g}{Animal group applied to. The country from which the parameters has been estimated is given in parentheses.}\end{landscape}   % section MDP models applied to cattle farming (end)   \bibliographystyle{plainnat}%\bibliographystyle{elsarticle-harv}%\bibliographystyle{spbasic}\bibliography{Refbib} \end{document}
Last edited by KatarinaD on Tue Mar 31, 2015 3:12 pm, edited 1 time in total.

Tags:

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
Getting code from some other dude is almost always a quite bad idea, no matter how nice he is or how high his academic degree is.

Very very often, code that gets inherited like this is often old and obsolete, or simple faulty. So please be careful.

In the example above, package booktabs is missing. Furthermore, your colleague seems to have made own and a bit shorter commands, \footnotemk instead of \footnotemark
and \footnotetxt instead of \footnotetext. Maybe a package i don't know actually provides thos commands, but right now, this is impossible for me to tell.

As you can see, the benefit is minimal, but it is very very hard for a beginner to find the cause and once you send some article to a publisher, it will drive their copy editor simply mad. Some user-defined commands are usefull, but they should be defined in the document
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Posts: 10
Joined: Mon Mar 30, 2015 9:39 am
Thank you very much for your answer (and again: sorry for the cross posting). I can see what you mean about my colleague making his own definitions.

I will begin defining the table from scratch - and actually trying to find the solution to my problem has provided me with a lot of useful information on how to build tables - which packages exist (at least some of them) and what they do.

Thanks again