修改模板的标题页?

修改模板的标题页?

我正在尝试向下载的模板的标题页添加一些信息。如何在“John Smith”下方添加文本(例如学生编号)或在 John Smith 上方添加副标题?该模板是 Frits Wenneker 的 Short Sectioned Assignment。

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Short Sectioned Assignment
% LaTeX Template
% Version 1.0 (5/5/12)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Frits Wenneker (http://www.howtotex.com)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[paper=a4, fontsize=11pt]{scrartcl}

\usepackage[T1]{fontenc} 
\usepackage{palatino}
\usepackage[english]{babel} 
\usepackage{amsmath,amsfonts,amsthm}

\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template

\usepackage{sectsty}
\allsectionsfont{\centering \normalfont\scshape} 

\usepackage{fancyhdr} 
\pagestyle{fancyplain} 
\fancyhead[L]{\textsc{European Competition Law}}
\fancyhead[R]{\textsc{John Smith}} 
\fancyfoot[L]{}
\fancyfoot[C]{}
\fancyfoot[C]{- \thepage -} 
\renewcommand{\headrulewidth}{0.5pt} 
\renewcommand{\footrulewidth}{0pt} 
\setlength{\headheight}{13.6pt} 

\fancypagestyle{noheader}{    
    \fancyhead{}
    \renewcommand{\headrulewidth}{0pt}
}

\numberwithin{equation}{section} 
\numberwithin{figure}{section} 
\numberwithin{table}{section} 

\setlength\parindent{0pt} 

%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------

\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} 

\title{ 
\normalfont \LARGE 
\textsc{University of Example - School of Management, Economics, Law, Social Sciences and International Affairs} \\ [25pt] 
\horrule{1pt} \\[0.4cm]
\huge European Competition Law 
\horrule{1pt} \\[0.5cm] 
}

\author{John Smith} 


\date{\normalsize\today} 


\begin{document}


\maketitle % Print the title
\thispagestyle{empty} 


\newpage
\end{document}

截屏

答案1

模板已经对标题进行了修改,因此,添加几行代码不会造成任何损害,如下所示

\title{
\normalfont \LARGE
\textsc{University of Example - School of Management, Economics, Law, Social Sciences and International Affairs} \\ [25pt] % Your university, school and/or department name(s)
\horrule{1pt} \\[0.4cm] % Thin top horizontal rule
\huge European Competition Law \\ % The assignment title
\horrule{1pt} \\[0.6cm] % Thick bottom horizontal rule adjust 0.6cm suitably
\Large This is a small sub title\\[0.5cm]  %% sub title, adjust \Large
}

\author{John Smith\\{\normalsize 123256}} % Your name and number

在此处输入图片描述

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Short Sectioned Assignment
% LaTeX Template
% Version 1.0 (5/5/12)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Frits Wenneker (http://www.howtotex.com)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size

\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{palatino} % Use the Adobe Utopia font for the document - comment this line to return to the LaTeX default
\usepackage[english]{babel} % English language/hyphenation
\usepackage{amsmath,amsfonts,amsthm} % Math packages

\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template

\usepackage{sectsty} % Allows customizing section commands
\allsectionsfont{\centering \normalfont\scshape} % Make all sections centered, the default font and small caps

\usepackage{fancyhdr} % Custom headers and footers
\pagestyle{fancyplain} % Makes all pages in the document conform to the custom headers and footers
\fancyhead[L]{\textsc{European Competition Law}}
\fancyhead[R]{\textsc{John Smith}} % No page header - if you want one, create it in the same way as the footers below
\fancyfoot[L]{} % Empty left footer
\fancyfoot[C]{} % Empty center footer
\fancyfoot[C]{- \thepage -} % Page numbering for right footer
\renewcommand{\headrulewidth}{0.5pt} % Remove header underlines
\renewcommand{\footrulewidth}{0pt} % Remove footer underlines
\setlength{\headheight}{13.6pt} % Customize the height of the header

\fancypagestyle{noheader}{    %create style that allows to skip header manually on pages with new section
    \fancyhead{}
    \renewcommand{\headrulewidth}{0pt}
}

\numberwithin{equation}{section} % Number equations within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{figure}{section} % Number figures within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{table}{section} % Number tables within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)

\setlength\parindent{0pt} % Removes all indentation from paragraphs - comment this line for an assignment with lots of text

%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------

\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height

\title{
\normalfont \LARGE
\textsc{University of Example - School of Management, Economics, Law, Social Sciences and International Affairs} \\ [25pt] % Your university, school and/or department name(s)
\horrule{1pt} \\[0.4cm] % Thin top horizontal rule
\huge European Competition Law \\ % The assignment title
\horrule{1pt} \\[0.6cm] % Thick bottom horizontal rule
\Large This is a small sub title\\[0.5cm]
}

\author{John Smith\\{\normalsize 123256}} % Your name


\date{\normalsize\today} % Today's date or a custom date


\begin{document}


\maketitle % Print the title
\thispagestyle{empty} %make title page header empty


\newpage
\end{document}

答案2

在 KOMA 类中,您已经有一个增强的元数据接口,即可以\subtitle添加字幕。对于其余部分,我建议使用一系列补丁来获取附加信息,并使收集元数据的宏不受任何类型的格式化命令的影响。具体来说,我更愿意写

\title{European Competition Law}
\subtitle{Here comes your subtitle}
\author{John Smith}
\date{\today}

那么补丁将会是这样的

\AtBeginDocument{\xpretocmd\@date{\normalsize}{}{}}
\xpatchcmd\@maketitle{\vskip 1em}{\vskip 2em}{}{}
\xpatchcmd\@maketitle{\@title}{%
  \normalfont\LARGE\@titlepreamble
  \rule\linewidth\p@\\[0.4cm]
  \huge\@title\par
  \rule\linewidth\p@\\[0.5cm]
}{}{}
\newcommand\@titlepreamble{%
  \textsc{%
    University of Example --
    School of Management, Economics, Law, Social Sciences and International Affairs}
  \\[25\p@]
}

(请注意,我删除了\horrule宏。在我看来,它并没有简化任何事情。)

为了在作者下方添加一些内容,我会手动扩展元数据接口( )并以与上述类似的方式\newcommand*\authorextra[1]{\gdef\@authorhook{#1}}编写代码。\@authorhook

输出

输出剪切

完整代码

\documentclass[paper=a4,fontsize=11pt]{scrartcl}
\usepackage[T1]{fontenc} 
\usepackage{palatino}

\usepackage{xpatch}

\makeatletter
\newcommand*\authorextra[1]{\gdef\@authorhook{#1}}
\authorextra{}
\AtBeginDocument{\xpretocmd\@date{\normalsize}{}{}}
\xpatchcmd\@maketitle{\vskip 1em}{\vskip 2em}{}{}
\xpatchcmd\@maketitle{\@author}{\@author\\\normalsize\@authorhook}{}{}
\xpatchcmd\@maketitle{\@title}{%
  \normalfont\LARGE\@titlepreamble
  \rule\linewidth\p@\\[0.4cm]
  \huge\@title\par
  \rule\linewidth\p@\\[0.5cm]
}{}{}
\newcommand\@titlepreamble{%
  \textsc{%
    University of Example --
    School of Management, Economics, Law, Social Sciences and International Affairs}
  \\[25\p@]
}
\g@addto@macro\maketitle{\thispagestyle{empty}}
\setkomafont{subtitle}{\normalfont}
\makeatother

\title{European Competition Law}
\subtitle{Here comes your subtitle}
\author{John Smith}
\authorextra{(foo)}
\date{\today}

\begin{document}
\maketitle
\end{document}

相关内容