1

I'm trying to render some tables with data collected from a CSV file with datatool package and I have a set of data that I want to render that is large enough to span across several pages, so I'm trying to use longtabu from the tabu package.

Here's my sample code:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[verbose=false]{datatool}
\usepackage{datatool-base}
\usepackage{tabu}
\usepackage{ifthen}
\usepackage{longtable}

\begin{document}

\DTLsetseparator{|}
\DTLloaddb[]{isa}{isa_cordic_reduced.csv}

\begin{table}
  \begin{center}
    \begin{longtabu} to \textwidth {|ll|X[l]|}
    \caption{Cordic instructions}
    \label{tbl:c_instructions}
      \hline
      \multicolumn{2}{|c|}{Mnemonic}   & Description
      \\ \hline \hline
      \endfirsthead

      \hline
      \multicolumn{3}{|c|}{-- Continued from previous page}
      \\ \hline
      \multicolumn{2}{|c|}{Mnemonic}   & Description
      \\ \hline
      \endhead

      \hline \multicolumn{3}{|r|}{{Continued on next page}} 
      \\ \hline
      \endfoot

      \\ \hline
      \endlastfoot

      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{0}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{1}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{2}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{3}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{4}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{5}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{6}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{7}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{8}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{9}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{10}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{11}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{12}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{13}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{14}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
      \DTLforeach*[\DTLiseq{\family}{Cordic} \and \DTLiseq{\subfamily}{15}]{isa}{
      \mnemonic=mnemonic,
      \args=args,
      \description=shortdescription,
      \family=family,
      \subfamily=subfamily} % Assign list
    { %
      \DTLiffirstrow{\\ \hline}{\\} %
      \texttt{\mnemonic} & \texttt{\args} & \description
    } % End loop
    \end{longtabu}
  \end{center}
\end{table}

\end{document}

Here's the CSV file:

"mnemonic"|"args"|"shortdescription"|"family"|"subfamily"
"jral"|"rdst,rsrc"|"Jump register and link"|"Control"|"0"
"cos.w"|"rdst,rsrc"|"Cosine of GPR"|"Cordic"|"0"
"cos.l"|"rdst,rsrc"|"Cosine of long GPR"|"Cordic"|"0"
"cos.f"|"fdst,fsrc"|"Cosine of FPR"|"Cordic"|"0"
"cos.d"|"fdst,fsrc"|"Cosine of double FPR"|"Cordic"|"0"
"cosh.w"|"rdst,rsrc"|"Hyperbolic cosine of GPR"|"Cordic"|"1"
"cosh.l"|"rdst,rsrc"|"Hyperbolic cosine of long GPR"|"Cordic"|"1"
"cosh.f"|"fdst,fsrc"|"Hyperbolic cosine of FPR"|"Cordic"|"1"
"cosh.d"|"fdst,fsrc"|"Hyperbolic cosine of double FPR"|"Cordic"|"1"
"sin.w"|"rdst,rsrc"|"Sine of GPR"|"Cordic"|"2"
"sin.l"|"rdst,rsrc"|"Sine of long GPR"|"Cordic"|"2"
"sin.f"|"fdst,fsrc"|"Sine of FPR"|"Cordic"|"2"
"sin.d"|"fdst,fsrc"|"Sine of double FPR"|"Cordic"|"2"
"sinh.w"|"rdst,rsrc"|"Hyperbolic sine of GPR"|"Cordic"|"3"
"sinh.l"|"rdst,rsrc"|"Hyperbolic sine of long GPR"|"Cordic"|"3"
"sinh.f"|"fdst,fsrc"|"Hyperbolic sine of FPR"|"Cordic"|"3"
"sinh.d"|"fdst,fsrc"|"Hyperbolic sine of double FPR"|"Cordic"|"3"
"sqrt1msq.w"|"rdst,rsrc"|"Square root 1 minus square of GPR"|"Cordic"|"4"
"sqrt1msq.l"|"rdst,rsrc"|"Square root 1 minus square of long GPR"|"Cordic"|"4"
"sqrt1msq.f"|"fdst,fsrc"|"Square root 1 minus square of FPR"|"Cordic"|"4"
"sqrt1msq.d"|"fdst,fsrc"|"Square root 1 minus square of double FPR"|"Cordic"|"4"
"sqrt1psq.w"|"rdst,rsrc"|"Square root 1 plus $GPR^{2}$"|"Cordic"|"5"
"sqrt1psq.l"|"rdst,rsrc"|"Square root 1 plus long $GPR^{2}$"|"Cordic"|"5"
"sqrt1psq.f"|"fdst,fsrc"|"Square root 1 plus $FPR^{2}$"|"Cordic"|"5"
"sqrt1psq.d"|"fdst,fsrc"|"Square root 1 plus double $FPR^{2}$"|"Cordic"|"5"
"atan.w"|"rdst,rsrc"|"Arctangent of GPR"|"Cordic"|"6"
"atan.l"|"rdst,rsrc"|"Arctangent of long GPR"|"Cordic"|"6"
"atan.f"|"fdst,fsrc"|"Arctangent of FPR"|"Cordic"|"6"
"atan.d"|"fdst,fsrc"|"Arctangent of double FPR"|"Cordic"|"6"
"atanh.w"|"rdst,rsrc"|"Hyperbolic arctangent of GPR"|"Cordic"|"7"
"atanh.l"|"rdst,rsrc"|"Hyperbolic arctangent of long GPR"|"Cordic"|"7"
"atanh.f"|"fdst,fsrc"|"Hyperbolic arctangent of FPR"|"Cordic"|"7"
"atanh.d"|"fdst,fsrc"|"Hyperbolic arctangent of double FPR"|"Cordic"|"7"
"ln.w"|"rdst,rsrc"|"Natural logarithm of GPR"|"Cordic"|"8"
"ln.l"|"rdst,rsrc"|"Natural logarithm of long GPR"|"Cordic"|"8"
"ln.f"|"fdst,fsrc"|"Natural logarithm of FPR"|"Cordic"|"8"
"ln.d"|"fdst,fsrc"|"Natural logarithm of double FPR"|"Cordic"|"8"
"sqrt.w"|"rdst,rsrc"|"Square root of GPR"|"Cordic"|"9"
"sqrt.l"|"rdst,rsrc"|"Square root of long GPR"|"Cordic"|"9"
"sqrt.f"|"fdst,fsrc"|"Square root of FPR"|"Cordic"|"9"
"sqrt.d"|"fdst,fsrc"|"Square root of double FPR"|"Cordic"|"9"
"pol2recx.w"|"rdst,rsrc1,rsrc2"|"Polar to rectangular x of GPR's"|"Cordic"|"10"
"pol2recx.l"|"rdst,rsrc1,rsrc2"|"Polar to rectangular x of long GPR's"|"Cordic"|"10"
"pol2recx.f"|"fdst,fsrc1,fsrc2"|"Polar to rectangular x of FPR's"|"Cordic"|"10"
"pol2recx.d"|"fdst,fsrc1,fsrc2"|"Polar to rectangular x of double FPR's"|"Cordic"|"10"
"pol2recy.w"|"rdst,rsrc1,rsrc2"|"Polar to rectangular src of GPR's"|"Cordic"|"11"
"pol2recy.l"|"rdst,rsrc1,rsrc2"|"Polar to rectangular src of long GPR's"|"Cordic"|"11"
"pol2recy.f"|"fdst,fsrc1,fsrc2"|"Polar to rectangular src of FPR's"|"Cordic"|"11"
"pol2recy.d"|"fdst,fsrc1,fsrc2"|"Polar to rectangular src of double FPR's"|"Cordic"|"11"
"hyp2recx.w"|"rdst,rsrc1,rsrc2"|"Hyperbolic to rectangular x of GPR's"|"Cordic"|"12"
"hyp2recx.l"|"rdst,rsrc1,rsrc2"|"Hyperbolic to rectangular x of long GPR's"|"Cordic"|"12"
"hyp2recx.f"|"fdst,fsrc1,fsrc2"|"Hyperbolic to rectangular x of FPR's"|"Cordic"|"12"
"hyp2recx.d"|"fdst,fsrc1,fsrc2"|"Hyperbolic to rectangular x of double FPR's"|"Cordic"|"12"
"hyp2recy.w"|"rdst,rsrc1,rsrc2"|"Hyperbolic to rectangular src of GPR's"|"Cordic"|"13"
"hyp2recy.l"|"rdst,rsrc1,rsrc2"|"Hyperbolic to rectangular src of long GPR's"|"Cordic"|"13"
"hyp2recy.f"|"fdst,fsrc1,fsrc2"|"Hyperbolic to rectangular src of FPR's"|"Cordic"|"13"
"hyp2recy.d"|"fdst,fsrc1,fsrc2"|"Hyperbolic to rectangular src of double FPR's"|"Cordic"|"13"
"norm.w"|"rdst,rsrc1,rsrc2"|"Norm of GPR's"|"Cordic"|"14"
"norm.l"|"rdst,rsrc1,rsrc2"|"Norm of long GPR's"|"Cordic"|"14"
"norm.f"|"fdst,fsrc1,fsrc2"|"Norm of FPR's"|"Cordic"|"14"
"norm.d"|"fdst,fsrc1,fsrc2"|"Norm of double FPR's"|"Cordic"|"14"
"atan2.w"|"rdst,rsrc1,rsrc2"|"Arctangent of GPR's"|"Cordic"|"15"
"atan2.l"|"rdst,rsrc1,rsrc2"|"Arctangent of long GPR's"|"Cordic"|"15"
"atan2.f"|"fdst,fsrc1,fsrc2"|"Arctangent of FPR's"|"Cordic"|"15"
"atan2.d"|"fdst,fsrc1,fsrc2"|"Arctangent of double FPR's"|"Cordic"|"15"

And here's the current (wrong) output: (Wrong) Output generated

So, header is wrong, first space before cos.w is wrong, extra line after each group of items is wrong too (I also have this last problem in tabu environment, and is being reviewed in other question here).

I also get this error when I run this through LaTeX:

! Misplaced \noalign.
\hline ->\noalign 
                  {\ifnum 0=`}\fi \penalty \@M \futurelet \@let@token \LT@@h...
l.198     \end{longtabu}

(Notice that line 198 corresponds with the \end{longtabu} line in the code above)

Any clues???

  • 1
    Please post a complete example here with sufficient data to reproduce the issue. I don't want to download a file from an untrusted dropbox just in order to see if I can help, and future users will not be able to use your code if the link goes stale. Plus, I have no permission to use your data in an answer here and, in fact, no legal permission to even post output produced from that data. (Unless the data file includes a licence statement giving me that right, of course.) – cfr Dec 28 '15 at 2:21
  • @cfr what else would be needed? – Luciano César Natale Dec 28 '15 at 2:24
  • 1
    Enough data to reproduce the problem. It should be included in your question. (Of course, it need not be your real data. Just so as it produces the problem is all.) – cfr Dec 28 '15 at 2:25
  • @cfr If you mean the data that is loaded, I've provided a link to csv file I'm using! – Luciano César Natale Dec 28 '15 at 2:27
  • Yes, but you should include enough of it here to reproduce the issue. – cfr Dec 28 '15 at 2:28
2

There are multiple problems (aside from the use of tabu itself, which cannot be recommended).

  • A longtable is not a float itself and cannot be placed in a float. So it ought not be included in a table environment. This is common-sense: longtable's raison d'être is tables which include page breaks and floats cannot break across pages. The float wrapper has been removed in the corrected code.

  • An end of row is required following a longtable \caption and \\ is added following \caption... \label... below.

  • The macro on line 174 of the code posted below was incomplete and failed to specify a mandatory argument. This has been corrected here.

  • The major problems in processing the data concerned the spurious spaces. subfamily is not equal to subfamily<space> and so on. This affected all rows involved in processing the data and has been corrected throughout.

Corrected code:

\begin{filecontents}{\jobname.csv}
"mnemonic"|"args"|"shortdescription"|"family"|"subfamily"
"jral"|"rdst,rsrc"|"Jump register and link"|"Control"|"0"
"cos.w"|"rdst,rsrc"|"Cosine of GPR"|"Cordic"|"0"
"cos.l"|"rdst,rsrc"|"Cosine of long GPR"|"Cordic"|"0"
"cos.f"|"fdst,fsrc"|"Cosine of FPR"|"Cordic"|"0"
"cos.d"|"fdst,fsrc"|"Cosine of double FPR"|"Cordic"|"0"
"cosh.w"|"rdst,rsrc"|"Hyperbolic cosine of GPR"|"Cordic"|"1"
"cosh.l"|"rdst,rsrc"|"Hyperbolic cosine of long GPR"|"Cordic"|"1"
"cosh.f"|"fdst,fsrc"|"Hyperbolic cosine of FPR"|"Cordic"|"1"
"cosh.d"|"fdst,fsrc"|"Hyperbolic cosine of double FPR"|"Cordic"|"1"
"sin.w"|"rdst,rsrc"|"Sine of GPR"|"Cordic"|"2"
"sin.l"|"rdst,rsrc"|"Sine of long GPR"|"Cordic"|"2"
"sin.f"|"fdst,fsrc"|"Sine of FPR"|"Cordic"|"2"
"sin.d"|"fdst,fsrc"|"Sine of double FPR"|"Cordic"|"2"
"sinh.w"|"rdst,rsrc"|"Hyperbolic sine of GPR"|"Cordic"|"3"
"sinh.l"|"rdst,rsrc"|"Hyperbolic sine of long GPR"|"Cordic"|"3"
"sinh.f"|"fdst,fsrc"|"Hyperbolic sine of FPR"|"Cordic"|"3"
"sinh.d"|"fdst,fsrc"|"Hyperbolic sine of double FPR"|"Cordic"|"3"
"sqrt1msq.w"|"rdst,rsrc"|"Square root 1 minus square of GPR"|"Cordic"|"4"
"sqrt1msq.l"|"rdst,rsrc"|"Square root 1 minus square of long GPR"|"Cordic"|"4"
"sqrt1msq.f"|"fdst,fsrc"|"Square root 1 minus square of FPR"|"Cordic"|"4"
"sqrt1msq.d"|"fdst,fsrc"|"Square root 1 minus square of double FPR"|"Cordic"|"4"
"sqrt1psq.w"|"rdst,rsrc"|"Square root 1 plus $GPR^{2}$"|"Cordic"|"5"
"sqrt1psq.l"|"rdst,rsrc"|"Square root 1 plus long $GPR^{2}$"|"Cordic"|"5"
"sqrt1psq.f"|"fdst,fsrc"|"Square root 1 plus $FPR^{2}$"|"Cordic"|"5"
"sqrt1psq.d"|"fdst,fsrc"|"Square root 1 plus double $FPR^{2}$"|"Cordic"|"5"
"atan.w"|"rdst,rsrc"|"Arctangent of GPR"|"Cordic"|"6"
"atan.l"|"rdst,rsrc"|"Arctangent of long GPR"|"Cordic"|"6"
"atan.f"|"fdst,fsrc"|"Arctangent of FPR"|"Cordic"|"6"
"atan.d"|"fdst,fsrc"|"Arctangent of double FPR"|"Cordic"|"6"
"atanh.w"|"rdst,rsrc"|"Hyperbolic arctangent of GPR"|"Cordic"|"7"
"atanh.l"|"rdst,rsrc"|"Hyperbolic arctangent of long GPR"|"Cordic"|"7"
"atanh.f"|"fdst,fsrc"|"Hyperbolic arctangent of FPR"|"Cordic"|"7"
"atanh.d"|"fdst,fsrc"|"Hyperbolic arctangent of double FPR"|"Cordic"|"7"
"ln.w"|"rdst,rsrc"|"Natural logarithm of GPR"|"Cordic"|"8"
"ln.l"|"rdst,rsrc"|"Natural logarithm of long GPR"|"Cordic"|"8"
"ln.f"|"fdst,fsrc"|"Natural logarithm of FPR"|"Cordic"|"8"
"ln.d"|"fdst,fsrc"|"Natural logarithm of double FPR"|"Cordic"|"8"
"sqrt.w"|"rdst,rsrc"|"Square root of GPR"|"Cordic"|"9"
"sqrt.l"|"rdst,rsrc"|"Square root of long GPR"|"Cordic"|"9"
"sqrt.f"|"fdst,fsrc"|"Square root of FPR"|"Cordic"|"9"
"sqrt.d"|"fdst,fsrc"|"Square root of double FPR"|"Cordic"|"9"
"pol2recx.w"|"rdst,rsrc1,rsrc2"|"Polar to rectangular x of GPR's"|"Cordic"|"10"
"pol2recx.l"|"rdst,rsrc1,rsrc2"|"Polar to rectangular x of long GPR's"|"Cordic"|"10"
"pol2recx.f"|"fdst,fsrc1,fsrc2"|"Polar to rectangular x of FPR's"|"Cordic"|"10"
"pol2recx.d"|"fdst,fsrc1,fsrc2"|"Polar to rectangular x of double FPR's"|"Cordic"|"10"
"pol2recy.w"|"rdst,rsrc1,rsrc2"|"Polar to rectangular src of GPR's"|"Cordic"|"11"
"pol2recy.l"|"rdst,rsrc1,rsrc2"|"Polar to rectangular src of long GPR's"|"Cordic"|"11"
"pol2recy.f"|"fdst,fsrc1,fsrc2"|"Polar to rectangular src of FPR's"|"Cordic"|"11"
"pol2recy.d"|"fdst,fsrc1,fsrc2"|"Polar to rectangular src of double FPR's"|"Cordic"|"11"
"hyp2recx.w"|"rdst,rsrc1,rsrc2"|"Hyperbolic to rectangular x of GPR's"|"Cordic"|"12"
"hyp2recx.l"|"rdst,rsrc1,rsrc2"|"Hyperbolic to rectangular x of long GPR's"|"Cordic"|"12"
"hyp2recx.f"|"fdst,fsrc1,fsrc2"|"Hyperbolic to rectangular x of FPR's"|"Cordic"|"12"
"hyp2recx.d"|"fdst,fsrc1,fsrc2"|"Hyperbolic to rectangular x of double FPR's"|"Cordic"|"12"
"hyp2recy.w"|"rdst,rsrc1,rsrc2"|"Hyperbolic to rectangular src of GPR's"|"Cordic"|"13"
"hyp2recy.l"|"rdst,rsrc1,rsrc2"|"Hyperbolic to rectangular src of long GPR's"|"Cordic"|"13"
"hyp2recy.f"|"fdst,fsrc1,fsrc2"|"Hyperbolic to rectangular src of FPR's"|"Cordic"|"13"
"hyp2recy.d"|"fdst,fsrc1,fsrc2"|"Hyperbolic to rectangular src of double FPR's"|"Cordic"|"13"
"norm.w"|"rdst,rsrc1,rsrc2"|"Norm of GPR's"|"Cordic"|"14"
"norm.l"|"rdst,rsrc1,rsrc2"|"Norm of long GPR's"|"Cordic"|"14"
"norm.f"|"fdst,fsrc1,fsrc2"|"Norm of FPR's"|"Cordic"|"14"
"norm.d"|"fdst,fsrc1,fsrc2"|"Norm of double FPR's"|"Cordic"|"14"
"atan2.w"|"rdst,rsrc1,rsrc2"|"Arctangent of GPR's"|"Cordic"|"15"
"atan2.l"|"rdst,rsrc1,rsrc2"|"Arctangent of long GPR's"|"Cordic"|"15"
"atan2.f"|"fdst,fsrc1,fsrc2"|"Arctangent of FPR's"|"Cordic"|"15"
"atan2.d"|"fdst,fsrc1,fsrc2"|"Arctangent of double FPR's"|"Cordic"|"15"
\end{filecontents}

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[verbose=false]{datatool}
\usepackage{datatool-base}
\usepackage{tabu}
\usepackage{ifthen}
\usepackage{longtable}

\begin{document}

\DTLsetseparator{|}
\DTLloaddb[]{isa}{\jobname.csv}

\begin{longtabu} to \textwidth {|ll|X[l]|}
  \caption{Cordic instructions}
  \label{tbl:c_instructions}\\
  \hline
  \multicolumn{2}{|c|}{Mnemonic}   & Description\\ \hline \hline
  \endfirsthead
  \hline
  \multicolumn{3}{|c|}{-- Continued from previous page}\\ \hline
  \multicolumn{2}{|c|}{Mnemonic}   & Description\\ \hline
  \endhead
  \hline \multicolumn{3}{|r|}{{Continued on next page}}\\ \hline
  \endfoot
  \\ \hline
  \endlastfoot
  \DTLforeach*[\DTLiseq{\family}{Cordic}\AND\DTLiseq{\subfamily}{0}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{}{\\} \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{1}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
    {%
      \DTLiffirstrow{\\ \hline}{\\}%
        \texttt{\mnemonic} & \texttt{\args} & \shortdescription
      }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{2}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{3}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{4}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{5}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{6}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{7}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{8}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
    \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{9}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
    \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{10}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
    \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{11}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
    \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{12}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{13}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{14}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \DTLforeach*[\DTLiseq{\family}{Cordic} \AND \DTLiseq{\subfamily}{15}]{isa}%
  {\mnemonic=mnemonic,\args=args,\shortdescription=shortdescription,\family=family,\subfamily=subfamily}% Assign list
  {%
    \DTLiffirstrow{\\ \hline}{\\}%
      \texttt{\mnemonic} & \texttt{\args} & \shortdescription
    }% End loop
  \end{longtabu}
\end{document}

Note that although the resulting code works, it is not recommended for several reasons.

First, the use of vertical rules, horizontal rules of invariant widths and standard spacing does not make for quality tables. See booktabs's manual for commentary, discussion and guidelines. (If you must use vertical rules, you need to sort out the final lines of the table, but since these aren't a good idea anyway, it would be better to upgrade the table's format generally.)

Second, as mentioned above, the fact that the table relies on tabu is itself problematic. At some point, the code will break. For now, it remains buggy.

Nonetheless, for now at least, it works even if it does not look that good:

split data table

  • it's been very usefull your answer! I did not know the thing about longtable not being a float. I still got some problems with formatting I'll try to solve! – Luciano César Natale Dec 29 '15 at 20:34

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.