使用 datatool 与 longtabu 的问题

使用 datatool 与 longtabu 的问题

我正在尝试使用从带有包的 CSV 文件中收集的数据来呈现一些表格datatool,并且我有一组想要呈现的数据,这些数据足够大,可以跨越多个页面,因此我尝试longtabutabu包中使用。

这是我的示例代码:

\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}

这是 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"

这是当前(错误)的输出: (Wrong) Output generated

因此,标题是错误的,cos.w 之前的第一个空格是错误的,每组项目之后的额外行也是错误的(我在 tabu 环境中也遇到了最后一个问题,正在其他问题中进行审查这里)。

当我通过 LaTeX 运行它时,也出现这个错误:

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

(请注意,第 198 行与上面代码中的 \end{longtabu} 行相对应)

有什么线索吗???

答案1

除了使用禁忌(不推荐)

  • Alongtable本身不是浮点数,并且不能放在浮动中。因此它不应该包含在table环境中。这是常识:longtable存在的理由是包含分页符的表格和浮动不能跨页。浮动包装器已在更正后的代码中删除。

  • 行尾需要在后面加上,longtable \caption\\在下面添加\caption... \label...

  • 下面发布的代码中第 174 行的宏不完整,未能指定强制参数。此问题已在此处更正。

  • 处理数据时的主要问题涉及虚假空格。subfamily不等于subfamily<space>等等。这影响了处理数据所涉及的所有行,并且已全面纠正。

修正后的代码:

\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}

请注意,虽然生成的代码可以工作,但是由于多种原因我们不建议这么做。

首先,使用垂直规则、固定宽度的水平规则和标准间距并不能制作出高质量的表格。参见书签手册中的评论、讨论和指导。(如果必须使用垂直规则,则需要整理表格的最后几行,但由于这些都不是一个好主意,因此最好升级表格的格式。)

其次,如上所述,该表依赖于禁忌本身就存在问题。在某些时候,代码会崩溃。目前,它仍然有缺陷。

尽管如此,至少就目前而言,即使看起来不太好,它还是有效的:

split data table

相关内容