我希望标题页上的摘要采用以下样式:1. 单词“摘要”位于文本上方中央。2. 单词“摘要”下方有一条水平线,其宽度与文本宽度相同。3. 文本下方有一条相同长度的水平线。4. 左侧的单词“关键词:”可让我输入一些特定于论文的关键词。
我一直在努力解决这个问题,但显然我遗漏了一些东西。谢谢您的帮助!当前代码可在此处找到:
\renewenvironment{abstract}
{\begin{quote}
\noindent \rule{\linewidth}{.5pt}\par{\bfseries \abstractname.}}
{\medskip\noindent \rule{\linewidth}{.5pt}
\end{quote}
}
我期望的最终结果如下:
答案1
一种基于 和 的关键字解决方案tabularx
:threeparttable
它将xparse
摘要定义为一个三部分表 - 摘要本身是环境的单行tabularx
,关键字列表作为环境的可选参数输入,作为表格注释插入。
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{lipsum}
\usepackage{tabularx, threeparttable, booktabs}
\usepackage{xparse}
\title{Some Title}
\author{Some One}
\RenewDocumentEnvironment{abstract}{o}%
{\small\noindent\threeparttable\tabularx{\linewidth}{@{}>{\arraybackslash}X@{}}\bfseries\centering \abstractname\tabularnewline\addlinespace[1.5ex]\midrule\addlinespace[1ex]}%
{\endtabularx\vspace{-2ex}\hrule\IfNoValueF{#1}{ \begin{tablenotes}[flushleft, online]\smallskip\item[Keywords: ] #1
\end{tablenotes}}
\endthreeparttable\vspace*{6ex}}%
\begin{document}
\maketitle
\begin{abstract}%[small $\beta$s, Fama-MacBeth two-pass procedure; foreign currency portfolios; factor pricing; stochastic discount factors; weak identification; principal components]
\lipsum[1]
\end{abstract}
\lipsum[2-8]
\end{document}
答案2
查看基本文件夹(例如 article.cls)的定义可能会有所帮助。
由于\rule
在 hmode 下扩展,它始终占用\baselineskip
,而\hrule
在 vmode 下扩展并且不添加任何额外的垂直空间。中心环境在末尾添加了额外的空间,可以使用 删除\unskip
。
\documentclass{article}
\usepackage{lipsum}% MWE only
\usepackage{showframe}% MWE only
\renewenvironment{abstract}
{\begin{center}\bfseries \abstractname
\end{center}\unskip
\smallskip\hrule\smallskip\par}%
{\medskip\hrule\smallskip}
\begin{document}
%\begin{titlepage}
\begin{abstract}
\lipsum[1]
\end{abstract}
\noindent\lipsum[2]
%\end{titlepage}
\end{document}
答案3
我说了前我再说一遍:没有必要重新定义抽象环境。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Masters/Doctoral Thesis
% LaTeX Template
% Version 2.6 (26/4/18)
%
% This template was downloaded from:
% http://www.LaTeXTemplates.com
%
% Version 2.x major modifications by:
% Vel ([email protected])
%
% This template is based on a template by:
% Steve Gunn (http://users.ecs.soton.ac.uk/srg/softwaretools/document/templates/)
% Sunil Patel (http://www.sunilpatel.co.uk/thesis-template/)
%
% Template license:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[
english, % ngerman for German
chapterinoneline, % Uncomment to place the chapter title next to the number on one line
]{MastersDoctoralThesis} % The class file specifying the document structure
\usepackage{blindtext}
\usepackage{showframe}
\renewcommand{\chaptermarkformat}{\thechapter\space}
\ihead{\headmark Author p X}
\begin{document}
\begin{titlepage}
{\centering
{\scshape\LARGE Columbidae University \par}
\vspace{1cm}
{\scshape\Large Final year project\par}
\vspace{1.5cm}
{\huge\bfseries Pigeons love doves\par}
\vspace{2cm}
{\Large\itshape John Birdwatch\par}
\vfill
supervised by\par
Dr.~Mark \textsc{Brown}
\vspace{1cm}\textbf{Abstract}\par}
\noindent\raisebox{.5ex}{\rule{\linewidth}{.4pt}}\par
\blindtext\par
\noindent\raisebox{.5ex}{\rule{\linewidth}{.4pt}}\par
\noindent Keywords: Alpaca, Wombat, Capybara
\vfill
{\centering\large \today\par}
\end{titlepage}
\chapter{Wombat}
\blindtext[10]
\appendix
\addchap{Appendix}
\end{document}