当我加载 chemmacros 时,我收到以下错误消息(我不明白......):
! Extra alignment tab has been changed to \cr.
<template> ...egin \relax \d@llarend \endtemplate
l.62 \end{document}
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
我的非常简化的测试文档,如果我不加载它就可以工作{chemmacros}
,我只想在 pdf 中打印所有的包等:
\documentclass{scrreprt}
\usepackage{xparse}
\usepackage{etoolbox}
\usepackage{longtable}
\usepackage{calc}
\usepackage{array}
\usepackage{booktabs}
\usepackage{seqsplit}
%\usepackage{chemmacros}
\listfiles%
\AtEndDocument{\printfilelist}%
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}%
\ExplSyntaxOn%
\NewDocumentCommand{\printfilelist}{}{%
\setlength{\LTleft}{\fill}%
\setlength{\LTright}{\fill}%
\begin{longtable}{@{}%
>{\ttfamily}%
L{0.3\textwidth-\tabcolsep}%
L{\widthof{9999/99/99}}%
>{\raggedright}%
p{0.7\textwidth-\widthof{9999/99/99}-3\tabcolsep}%
@{}}%
\toprule%
\multicolumn{1}{@{}l}{\bfseries File~name} & \multicolumn{1}{c}{\bfseries Date} & \bfseries File~info%
\tabularnewline%
\midrule%
\endhead%
\bottomrule%
\endfoot%
\Holou_print_filelist:%
\end{longtable}%
}%
\tl_new:N \l_filelist_body_tl%
\tl_new:N \l_fileinfo_tl%
\cs_new_protected:Npn \Holou_print_filelist: {%
\clist_map_inline:cn {@filelist}{%
\Holou_print_fileinfo:n {##1}%
}%
\tl_use:N \l_filelist_body_tl%
}%
\cs_new_protected:Npn \Holou_print_fileinfo:n #1 {%
\regex_match:nnT { \.(sty|cls|tex|clo|fd|cfg|bbx|cbx|lbx|ldf|def|hak)\Z } {#1}{%
\Holou_print_pkginfo:n {#1}%
}%
}%
\cs_new_protected:Npn \Holou_print_pkginfo:n #1 {%
\tl_set_eq:Nc \l_fileinfo_tl {ver@#1}%
\tl_replace_once:Nnn \l_fileinfo_tl {~} {&}%
\tl_put_right:Nx \l_filelist_body_tl {%
\exp_not:N \seqsplit{#1}%
&%
\exp_not:V \l_fileinfo_tl%
\exp_not:N \tabularnewline%
}%
}%
\ExplSyntaxOff%
\begin{document}
\end{document}
{chemmacros}
对于那些想看看代码作用的人来说,这里有一张没有的图片:
现在我的问题是为什么我加载时它不起作用{chemmacros}
。我做错了什么吗?:D
解决方案(编辑):问题出在 chemmacros 文件信息中的 & 符号,我刚刚用 eg 替换了它,\tl_replace_all:Nnn \l_fileinfo_tl {&} {-}
然后我自己通过替换日期后的第一个 ~ 符号来添加 & 符号。谢谢 Ulrike。<3