[免责声明:虽然我已经使用 LaTeX 很长一段时间了,但我仍然有很多关于代码和定制的内容需要学习]
在撰写硕士论文的过程中,我了解到这个模板。它在文件中有关于大学/部门名称等的命令,*.cls
如下所示:
\department {\texorpdfstring{\href{Department or School Web Site URL Here (include http://)}
{Department or School Name}}
{Department or School Name}}
\DEPARTMENT {\texorpdfstring{\href{Department or School Web Site URL Here (include http://)}
{DEPARTMENT OR SCHOOL NAME (IN BLOCK CAPITALS)}}
{DEPARTMENT OR SCHOOL NAME (IN BLOCK CAPITALS)}}
\group {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
{Research Group Name}}
{Research Group Name}}
\GROUP {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
{RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
{RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
\faculty {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
{Faculty Name}}
{Faculty Name}}
\FACULTY {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
{FACULTY NAME (IN BLOCK CAPITALS)}}
{FACULTY NAME (IN BLOCK CAPITALS)}}
其声明如下:
\newcommand*{\department}[1]{\def\deptname{#1}}
\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
\newcommand*{\group}[1]{\def\groupname{#1}}
\newcommand*{\GROUP}[1]{\def\GROUPNAME{#1}}
\newcommand*{\faculty}[1]{\def\facname{#1}}
\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
模板中第二行相同的文本有什么用处?似乎只需更改最上面的一行,它就可以正确显示。有人能告诉我吗?
答案1
让我们选择您的一个命令调用(刚刚拆分):
\DEPARTMENT {
\texorpdfstring{
\href{Department or School Web Site URL Here (include http://)}
{DEPARTMENT OR SCHOOL NAME (IN BLOCK CAPITALS)}
}
{DEPARTMENT OR SCHOOL NAME (IN BLOCK CAPITALS)}
}
这意味着您定义\DEPTNAME
在输出和书签中的行为有所不同。在输出中,您将发现一个超链接,它将像第一个参数一样以大写形式出现。
如果没有生成超链接(例如在书签中),您将获得第二个全大写字符串。我不清楚为什么您必须给出这些相同的定义,但这是一个设计决定。