
我知道這裡至少已經存在一個關於如何設定審批表的問題。不過,我現在帶給大家的問題略有不同,因為問題本身就是關於如何實現審查委員會成員人數的自動化。通常,根據學生所屬的項目,委員會可能由三名、四名、五名或更多成員組成。因此,我想編寫一個程式碼,我可以在文件序言中告知以下資訊: 1 - 告知審查委員會的成員人數; 2 - 輸入第一個成員的姓名; 3 - 告知第一位成員的頭銜; 4 - 通知第一個成員的機構,依此類推。當然,當我告知委員會成員人數時,第 2、3 和 4 項將被重複。是否可以創建這樣的程式碼?
下面,我給一個最小的例子。
\documentclass[12pt,a4paper]{memoir}
\parindent0pt
\setSpacing{1.5}
\abnormalparskip{0.2\baselineskip}%
\setlength{\parindent}{1.5cm}%
\renewcommand*{\footnoterule}{\kern -3pt \hrule width 50mm \kern
2.6pt}%
\setlrmarginsandblock{30mm}{20mm}{*}%
\setulmarginsandblock{30mm}{20mm}{*}%
\setheadfoot{\baselineskip}{2\baselineskip}
\setheaderspaces{20.0mm}{*}{*}%
\setmarginnotes{2.0mm}{16mm}{5.0mm}%
\setcolsepandrule{3.5mm}{0.15mm}
\setfootins{\bigskipamount}{\bigskipamount}
\checkandfixthelayout[fixed]
\newcommand{\committeemembernumber}[1]{#1}
\newcommand{\memberonename}[1]{\gdef\thememberonename{#1}}
\newcommand{\memberoneinstitute}[1]{\gdef\thememberoneinstitute{#1}}
\newcommand{\membertwoname}[1]{\gdef\themembertwoname{#1}}
\newcommand{\membertwoinstitute}[1]{\gdef\themembertwoinstitute{#1}}
\newcommand{\memberthreename}[1]{\gdef\thememberthreename{#1}}
\newcommand{\memberthreeinstitute}[1]{\gdef\thememberthreeinstitute{#1}}
\newcommand{\memberfourname}[1]{\gdef\thememberfourname{#1}}
\newcommand{\memberfourinstitute}[1]{\gdef\thememberfourinstitute{#1}}
\newcommand{\memberfivename}[1]{\gdef\thememberfivename{#1}}
\newcommand{\memberfiveinstitute}[1]{\gdef\thememberfiveinstitute{#1}}
\title{Approval sheet: an example for the LaTeX}
\author{Alexsandro Lucena Mota}
\date{2020}
%\committeemembernumber{3}
\memberonename{Prof.~MA. Sir Isaac Newton}
\memberoneinstitute{Trinity College -- University of Cambrigde}
\membertwoname{Prof.~PhD. Albert Einstein}
\membertwoinstitute{Institute for Advanced Study (IAS)}
\memberthreename{Prof. PhD. Paul Adrien Maurice Dirac}
\memberthreeinstitute{Florida State University}
\memberfourname{Prof. PhD. Richard Phillips Feynman}
\memberfourinstitute{California Institute of Technology -- Caltech}
\memberfivename{Prof. PhD. Murray Gell-Mann}
\memberfiveinstitute{California Institute of Technology -- Caltech}
\begin{document}
\thispagestyle{empty}
\begin{center}
{\large \theauthor\par}
\vspace{\baselineskip}
{\Large
\begin{OnehalfSpace}%
\bfseries\thetitle\par%
\end{OnehalfSpace}%
}
\vspace{0.0cm}
\end{center}
\begin{flushright}%
\begin{minipage}{0.55\textwidth}%
\begin{SingleSpacing}%
{\small Doctoral thesis presented at Postgraduate
Program in Physics of the Universidade Federal do
Maranhão as prerequisite to obtain the Doctoral
degree.}\par
{\small {\bfseries Research line:} Topological
field theory with Lorentz symmetry breaking.}\par%
\end{SingleSpacing}%
\end{minipage}%
\end{flushright}
\vspace{\baselineskip}
Approval in: \rule[0.0cm]{3cm}{0.04cm}~
\rule[0.0cm]{1cm}{0.04cm},~\thedate.\par
\vspace{\baselineskip}
\begin{center}
{\Large Examining Committee}\par%
\vspace{\baselineskip}
\begin{SingleSpacing}
\rule{12cm}{0.04cm}\par%
\thememberonename\par%
\thememberoneinstitute\par
\vspace{1.9\baselineskip}
\rule{12cm}{0.04cm}\par
\themembertwoname\par%
\themembertwoinstitute\par
\vspace{1.9\baselineskip}
\rule{12cm}{0.04cm}\par
\thememberthreename\par
\thememberthreeinstitute\par
\vspace{1.9\baselineskip}
\rule{12cm}{0.04cm}\par
\thememberfourname\par%
\thememberfourinstitute\par
\vspace{1.9\baselineskip}
\rule{12cm}{0.04cm}\par
\thememberfivename\par
\thememberfiveinstitute\par
\end{SingleSpacing}
\end{center}
\end{document}
此程式碼提供以下 pdf 文件:
答案1
這是一種方法。基本想法是有一個命令:
\member{<name>}{<institute>}
這將自動分配委員會的成員,並追蹤有多少人。然後,使用追蹤成員的計數器為每個委員會名稱/隸屬關係賦予一個唯一的名稱。這是使用包包提供的\csgdef
包裝器來完成的。然後,我們使用該計數器和循環(使用套件)來產生正確數量的成員行(當然受頁面上的空間量限制。)\csname ... \endcsname
etoolbox
pgffor
\documentclass[12pt,a4paper]{memoir}
\parindent0pt
\setSpacing{1.5}
\abnormalparskip{0.2\baselineskip}%
\setlength{\parindent}{1.5cm}%
\renewcommand*{\footnoterule}{\kern -3pt \hrule width 50mm \kern
2.6pt}%
\setlrmarginsandblock{30mm}{20mm}{*}%
\setulmarginsandblock{30mm}{20mm}{*}%
\setheadfoot{\baselineskip}{2\baselineskip}
\setheaderspaces{20.0mm}{*}{*}%
\setmarginnotes{2.0mm}{16mm}{5.0mm}%
\setcolsepandrule{3.5mm}{0.15mm}
\setfootins{\bigskipamount}{\bigskipamount}
\checkandfixthelayout[fixed]
\usepackage{etoolbox}
\usepackage{pgffor}
\newcounter{committee}
\newcommand{\member}[2]{\stepcounter{committee}\csgdef{member\thecommittee}{#1}
\csgdef{institute\thecommittee}{#2}}
\title{Approval sheet: an example for the LaTeX}
\author{Alexsandro Lucena Mota}
\date{2020}
\member{Prof.~MA. Sir Isaac Newton}{Trinity College -- University of Cambridge}
\member{Prof.~PhD. Albert Einstein}{Institute for Advanced Study (IAS)}
\member{Prof. PhD. Paul Adrien Maurice Dirac}{Florida State University}
\member{Prof. PhD. Richard Phillips Feynman}{California Institute of Technology -- Caltech}
\member{Prof. PhD. Murray Gell-Mann}{California Institute of Technology -- Caltech}
\begin{document}
\thispagestyle{empty}
\begin{center}
{\large \theauthor\par}
\vspace{\baselineskip}
{\Large
\begin{OnehalfSpace}%
\bfseries\thetitle\par%
\end{OnehalfSpace}%
}
\vspace{0.0cm}
\end{center}
\begin{flushright}%
\begin{minipage}{0.55\textwidth}%
\begin{SingleSpacing}%
{\small Doctoral thesis presented at Postgraduate
Program in Physics of the Universidade Federal do
Maranhão as prerequisite to obtain the Doctoral
degree.}\par
{\small {\bfseries Research line:} Topological
field theory with Lorentz symmetry breaking.}\par%
\end{SingleSpacing}%
\end{minipage}%
\end{flushright}
\vspace{\baselineskip}
Approval in: \rule[0.0cm]{3cm}{0.04cm}~
\rule[0.0cm]{1cm}{0.04cm},~\thedate.\par
\vspace{\baselineskip}
\begin{center}
{\Large Examining Committee}\par%
\vspace{\baselineskip}
\begin{SingleSpacing}
\foreach \x in {1,...,\value{committee}}{
\rule{12cm}{0.04cm}\par%
\csuse{member\x}\par%
\csuse{institute\x}\par
\vspace{1.9\baselineskip}
}
\end{SingleSpacing}
\end{center}
\end{document}