3

I am trying to add some information to the title page of a template which I downloaded. How can I add text below "John Smith", for instance a student number, or a subtitle above John Smith? The template is Short Sectioned Assignment by Frits Wenneker.

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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}

Screenshot

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) , starting with \documentclass{...} and ending with \end{document}. – user36296 May 18 '16 at 13:45
  • As an addendum to @samcarter: You may start off by adding the class you are using (which in this case is the most important thing to know) in the comment section and then complete the example code to be compilable. – Ruben May 18 '16 at 13:52
  • I am using the scrartcl class and have made the edits you suggested. – SW7 May 18 '16 at 14:13
  • Little advice from someone who knows a bit about templates and titles. Do the titlepage from scratch, it will be more satisfying that way. Otherwise, you have to use pretty confusing code. How to customize my titlepage? – Johannes_B May 18 '16 at 16:22
  • Contrary to the template does it, you should better avoid fancyhdr with a KOMA class. sectsty? Also not a brilliant idea if you want to use KOMA features. Just saying, don't worry, you are ok. – Johannes_B May 18 '16 at 16:26
2

The template already fiddles with the title, so, you are not doing any harm by adding few more lines as in

\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

enter image description here

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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}
  • Thanks, Harish! This will work great in this case, but is there a "cleaner" way to do it in the future? E.g. might it be possible to modify the template to get those modifications in without packing stuff into the "name" bracket? – SW7 May 18 '16 at 14:28
  • @SW7: scrartcl provides \subtitle macro for sub titles (\subtitle{This is a sub title}). And for number, easiest is to abuse the \author macro. – user11232 May 18 '16 at 14:50
1

In the KOMA classes you have alredy have an enhanced meta data interface, i.e. there is \subtitle to add a subtitle. For the rest I recommend to use a series of patches to get in the additional information and keep the macros gathering the meta data clean of any sort of formatting command. Specifically I would prefer to write

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

The patch would then be something like

\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@]
}

(Note that I got rid of the \horrule macro. In my opinion it does not simplify anything.)

For adding something beneath the author I would extend the meta data interface by hand (\newcommand*\authorextra[1]{\gdef\@authorhook{#1}}) and code in \@authorhook in a similar fashion as above.

Output

output_cut

Complete code

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.