答案1
list of members
这是一种将所有组成员添加到并像 一样显示的快捷方法ToC
。
该代码使用expl3
语法(由 加载xparse
),目前是expl3
和传统的的不太漂亮的混合TeX/LaTeX
。
\documentclass{book}
\usepackage{ulem}
\usepackage{xparse}
\makeatletter
\newcommand{\listofgroupmembers}{%
\begingroup
\thispagestyle{empty}
\renewcommand{\@pnumwidth}{40pt}%
\section*{Group Members}
\markboth{}{}%
\@starttoc{gmb}%
\endgroup
}
\newcounter{members}
\renewcommand{\themembers}{\arabic{members}.}
\ExplSyntaxOn
\newcommand{\addgroupmember}[1]{%
\ifnum\value{members} = 0
\addtocontents{gmb}{\protect\contentsline{chapter}{Name}{ID\ \uuline{No}}}
\fi
\refstepcounter{members}
\clist_set:Nn \l_tmpa_clist {#1}
\addtocontents{gmb}{\protect\contentsline{section}{\protect\numberline{\themembers}\clist_item:Nn \l_tmpa_clist{1}}{\clist_item:Nn \l_tmpa_clist {2}}}
}
\ExplSyntaxOff
\begin{document}
\tableofcontents
\clearpage
\markboth{}{}
\listofgroupmembers
\chapter{First}
\addgroupmember{Salmon,788878}
\addgroupmember{Mark,5588778}
\addgroupmember{Ramos,444487}
\addgroupmember{Groucho,1}
\addgroupmember{Chico,2}
\addgroupmember{Harpo,3}
\addgroupmember{Zeppo,4}
\addgroupmember{Gummo,5}
\end{document}