
當我加載 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 文件資訊中的 & 符號,我現在剛剛將其替換為 例如,\tl_replace_all:Nnn \l_fileinfo_tl {&} {-}
然後我自己通過替換日期後的第一個 ~ 符號來添加 & 符號。謝謝烏爾麗克。 <3