LateX 中两个具有不同名称的摘要
Two abstracts with different names in LateX
我正在为我的博士论文使用 LateX 模板,可通过此获得 link:https://github.com/kks32/phd-thesis-template/blob/master/Classes/PhDThesisPSnPDF.cls
应大学的要求,我希望附上两份摘要。一个名称为 "Abstract",一个名称为 "Lay Summary"。但是我无法更改第二个摘要中的标题。摘要是一个以以下行开头的 tex 文件:
\begin{abstract}
....
\end{abstract}
文档类是自定义环境:
\documentclass[a4paper,12pt,times,numbered,print,index]{Classes/PhDThesisPSnPDF}
我在 \begin{abstract} 行之前的第二个摘要中尝试了此代码,但出现错误消息:“!LaTeX 错误:\abstractname 未定义”。
\renewcommand{\abstractname}{Lay Summary}
即使它会更改标题,我也不需要第二次全局更改它。我需要在编号内容之前有第二个摘要,最好在第一个摘要之后。有什么建议可以尝试吗?
查看文档类文件后,我将在第二个抽象文件中尝试以下操作:
\makeatletter
\renewcommand{\@title}{Lay Summary}
\makeatother
\begin{abstract}
...
\end{abstract}
但不能保证。
我很容易地说,我有一个经过测试的解决方案。
在我的文件夹中,我将您的自定义文档类文件保存为 docclass.cls
。
在同一个文件夹中,我保存并编译了我的 MWE/main .tex
文件:
\documentclass[a4paper,12pt,times,numbered,print,index]{docclass}
\newenvironment{laysummary} {
\cleardoublepage
\setsinglecolumn
\chapter*{\centering \Large Lay Summary}
\thispagestyle{empty}
}
\begin{document}
\begin{abstract}
First.
\end{abstract}
\begin{laysummary}
Second.
\end{laysummary}
\chapter{Chapter}
Some Text.
\end{document}
这会生成您想要使用摘要 和 简明摘要实现的输出:
请注意,关键在于以下几行:
\newenvironment{laysummary} {
\cleardoublepage
\setsinglecolumn
\chapter*{\centering \Large Lay Summary}
\thispagestyle{empty}
}
我从您的自定义文档类的第 1105-1121 行获取:
\newenvironment{abstract} {
\ifPHD@abstract
% Separate abstract as per Student Registry guidelines
\thispagestyle{empty}
\setsinglecolumn
\begin{center}
{ \Large {\bfseries {\@title}} \par}
{{\large \vspace*{1em} \@author} \par}
\end{center}
\else
% Normal abstract in the thesis
\cleardoublepage
\setsinglecolumn
\chapter*{\centering \Large Abstract}
\thispagestyle{empty}
\fi
}
我没有删除甚至修改这些 inside 文档类文件,我编辑了它的副本,然后将其粘贴到主 tex 文件中。如果你想让你的主 tex 文件更干净,我的六行定义 laysummary
environmemt 可以粘贴在文档类 cls 文件的末尾。
我正在为我的博士论文使用 LateX 模板,可通过此获得 link:https://github.com/kks32/phd-thesis-template/blob/master/Classes/PhDThesisPSnPDF.cls 应大学的要求,我希望附上两份摘要。一个名称为 "Abstract",一个名称为 "Lay Summary"。但是我无法更改第二个摘要中的标题。摘要是一个以以下行开头的 tex 文件:
\begin{abstract}
....
\end{abstract}
文档类是自定义环境:
\documentclass[a4paper,12pt,times,numbered,print,index]{Classes/PhDThesisPSnPDF}
我在 \begin{abstract} 行之前的第二个摘要中尝试了此代码,但出现错误消息:“!LaTeX 错误:\abstractname 未定义”。
\renewcommand{\abstractname}{Lay Summary}
即使它会更改标题,我也不需要第二次全局更改它。我需要在编号内容之前有第二个摘要,最好在第一个摘要之后。有什么建议可以尝试吗?
查看文档类文件后,我将在第二个抽象文件中尝试以下操作:
\makeatletter
\renewcommand{\@title}{Lay Summary}
\makeatother
\begin{abstract}
...
\end{abstract}
但不能保证。
我很容易地说,我有一个经过测试的解决方案。
在我的文件夹中,我将您的自定义文档类文件保存为 docclass.cls
。
在同一个文件夹中,我保存并编译了我的 MWE/main .tex
文件:
\documentclass[a4paper,12pt,times,numbered,print,index]{docclass}
\newenvironment{laysummary} {
\cleardoublepage
\setsinglecolumn
\chapter*{\centering \Large Lay Summary}
\thispagestyle{empty}
}
\begin{document}
\begin{abstract}
First.
\end{abstract}
\begin{laysummary}
Second.
\end{laysummary}
\chapter{Chapter}
Some Text.
\end{document}
这会生成您想要使用摘要 和 简明摘要实现的输出:
请注意,关键在于以下几行:
\newenvironment{laysummary} {
\cleardoublepage
\setsinglecolumn
\chapter*{\centering \Large Lay Summary}
\thispagestyle{empty}
}
我从您的自定义文档类的第 1105-1121 行获取:
\newenvironment{abstract} {
\ifPHD@abstract
% Separate abstract as per Student Registry guidelines
\thispagestyle{empty}
\setsinglecolumn
\begin{center}
{ \Large {\bfseries {\@title}} \par}
{{\large \vspace*{1em} \@author} \par}
\end{center}
\else
% Normal abstract in the thesis
\cleardoublepage
\setsinglecolumn
\chapter*{\centering \Large Abstract}
\thispagestyle{empty}
\fi
}
我没有删除甚至修改这些 inside 文档类文件,我编辑了它的副本,然后将其粘贴到主 tex 文件中。如果你想让你的主 tex 文件更干净,我的六行定义 laysummary
environmemt 可以粘贴在文档类 cls 文件的末尾。