![使用数据工具时最后一列为空/空白](https://linux22.com/image/396828/%E4%BD%BF%E7%94%A8%E6%95%B0%E6%8D%AE%E5%B7%A5%E5%85%B7%E6%97%B6%E6%9C%80%E5%90%8E%E4%B8%80%E5%88%97%E4%B8%BA%E7%A9%BA%2F%E7%A9%BA%E7%99%BD.png)
我使用 datatools 创建 pdf 但最后一列显示为空或空白
我的最低限度的编码:
\documentclass[a5paper,oneside,8pt]{article}
\usepackage[a5paper,landscape,left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{datatool}
\usepackage{filecontents}
\begin{filecontents*}{fileabc.tex}
AAA|BBB|CCC|DDD|
1|TNMT\_100|NT|E1|
2|TNMT\_109|NT|EE|
3|TNMT\_210|AT|E|
4|TNMT\_340|NT|E30|
5|TNMT\_12|AT|E31|
\end{filecontents*}
\usepackage{datatool}
\DTLsetseparator{|}
\DTLsetdelimiter{"}
\DTLloaddb[autokeys=false]{fileabc}{fileabc.tex}
\newcommand{\printCCCCoding}[1]{%
\par
\DTLforeach*
[\DTLiseq{\CCCCoding}{#1}]%
{fileabc}% Database
{\CCCCoding=CCC,\AAACoding=AAA, \BBBCoding=BBB,\DDDCoding=\DDD}{%
\noindent \CCCCoding \hspace{0.1cm} 2 \AAACoding \hspace{0.1cm} 3 \BBBCoding \hspace{0.1cm} 4 \DDD \par
}%
}
\begin{document}
\DTLdisplaydb{fileabc}
%\newpage
\\
\printCCCCoding{NT}
\end{document}
答案1
您的 DDD 列的语法\printCCCCoding
不正确。它应该与其他列类似:
\newcommand{\printCCCCoding}[1]{%
\par
\DTLforeach*
[\DTLiseq{\CCCCoding}{#1}]%
{fileabc}% Database
{\CCCCoding=CCC,\AAACoding=AAA, \BBBCoding=BBB,\DDDCoding=DDD}{%
\noindent \CCCCoding \hspace{0.1cm} 2 \AAACoding \hspace{0.1cm} 3 \BBBCoding \hspace{0.1cm} 4 \DDDCoding \par
}%
}
请注意,下一行中相应的是 ,而\DDDCoding=DDD
不是原来的。\DDDCoding=\DDD
\DDDCoding
结果: