我想为我的博士论文添加第二位导师。我使用以下命令:
\newcommand*{\supervisor}[1]{\def\supname{#1}}
\supervisor{Fernando Rubio Diez}
.tex
并在我的文档中引用它:
\emph{Director:} \\
\href{https://example.com}{\supname}
为了引用第二位主管,获取另一个变量的最佳方法是什么?
答案1
(1)修改标题页:在作者和导师下方添加第二行,以包含第二位导师。每行由两个并排的小页组成。
(2)添加一个新命令来存储和显示第二位主管的姓名。\director
在这里使用它是因为\supervisor
第一位主管已经使用了。
您没有指定要将第二位主管的头衔和姓名放在哪里。在此示例中,它位于第一位主管的下方。也许您想将其居中?
添加的修改已标记。
% !TeX TS-program = pdflatex
\documentclass[11pt, oneside]{Thesis} % The default font size and one-sided printing (no margin offsets)
\graphicspath{{Pictures/}} % Specifies the directory where pictures are stored
\usepackage[dvipsnames,svgnames,x11names,hyperref]{xcolor}
\usepackage[round, comma, sort&compress]{natbib} % Use the natbib reference package - read up on this to edit the reference style; if you want text (e.g. Smith et al., 2012) for the in-text references (instead of numbers), remove 'numbers'
\usepackage{tikz}
\usepackage{graphics}
\hypersetup{urlcolor=JungleGreen, colorlinks=true, citecolor=JungleGreen, linkcolor=black} % Colors hyperlinks in blue - change to black if annoying
\usepackage{lscape}
%\usepackage{draftwatermark}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{float}
%\SetWatermarkScale{2}
%\SetWatermarkColor{red}
\usepackage{listings}
\usepackage{color}
\definecolor{light-gray}{gray}{0.98}
\lstset{ language=R,% the language of the code
numbers=left,% where to put the line-numbers
numberstyle=\tiny\color{gray},% the style that is used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it's 1, each line
% will be numbered
numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{light-gray},% choose the background color. You must add \usepackage{color}
showspaces=false,% show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=single, % adds a frame around the code
rulecolor=\color{JungleGreen},% if not set, the frame-color may be changed on line-breaks within not-black text (e.g. commens (green here))
tabsize=2, % sets default tabsize to 2 spaces
captionpos=t, % sets the caption-position to top
breaklines=true, % sets automatic line breaking
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
title=\lstname, % show the filename of files included with \lstinputlisting;
% also try caption instead of title
keywordstyle=\color{RedViolet}, % keyword style
commentstyle=\color{JungleGreen}, % comment style
stringstyle=\color{orange}, % string literal style
escapeinside={\%*}{*)}, % if you want to add a comment within your code
morekeywords={*,...} % if you want to add more keywords to the set
}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{navy}{rgb}{0,0,128}
\usepackage{siunitx}
\sisetup{output-exponent-marker=\ensuremath{\mathrm{e}}}
\usepackage{fancyhdr}
%======================================================
\title{HMasters thesis template} % BUT you should use use " \title{\ttitle} " here instead to define the thesis title !
% \ttitle is defined in the file Thesis.cls
\begin{document}
\frontmatter % Use roman page numbering style (i, ii, iii, iv...) for the pre-content pages
\setstretch{1.3} % Line spacing of 1.3
% Define the page headers using the FancyHdr package and set up for one-sided printing
\fancyhead{} % Clears all page headers and footers
\rhead{\thepage} % Sets the right side header to show the page number
\lhead{} % Clears the left side page header
\renewcommand{\footrulewidth}{0.1pt}
\rfoot{Add Name}
\lfoot{Add Student Number}
\pagestyle{fancy} % Finally, use the "fancy" page style to implement the FancyHdr headers
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % New command to make the lines in the title page
% PDF meta-data
\hypersetup{pdftitle={\ttitle}}
\hypersetup{pdfsubject=\subjectname}
\hypersetup{pdfauthor=\authornames}
\hypersetup{pdfkeywords=\keywordnames}
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
%%******************************************************* added <<<<<<<<<<<<<<<<<
\newcommand*{\director}[2]{\def\dirname{#1}} % added <<<<<<<<<<<<<<<<<<<
\director{Fernando \textsc{Rubio Diez}} % You director's name - this is used in the title page
\supervisor{Name \textsc{Supervisor Surname}} % Your first supervisor's name - this is used in the title page
\authors{My Name \textsc{My Surname}} % Your name - this is used in the title page and abstract
%%*******************************************************
\begin{titlepage}
\begin{center}
\textsc{\LARGE \univname}\\[1.5cm] % University name
\textsc{\Large Masters Thesis}\\[0.5cm] % Thesis type
\HRule \\[0.4cm] % Horizontal line
{\huge \bfseries \ttitle}\\[0.4cm] % Thesis title
\HRule \\[1.5cm] % Horizontal line
\begin{minipage}{0.4\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
\href{https://www.uel.ac.uk}{\authornames} \\% %Author name - remove the \href bracket to remove the link
\end{flushleft}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
\emph{Supervisor:} \\
\href{https://www.uel.ac.uk}{\supname} % Supervisor name - remove the \href bracket to remove the link
\end{flushright}
\end{minipage}
%*********************************************** added <<<<<<<<<<<<<<<<<<<<<<
\vspace*{1cm}\par
\begin{minipage}{0.4\textwidth}
\begin{flushleft}
%spare
\end{flushleft}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
\emph{Director:}\\
\href{https://www.uel.ac.uk}{\dirname} \\% Director name - remove the \href bracket to remove the link
\end{flushright}
\end{minipage}\\[3cm]
%**********************************************
\large \textit{A thesis submitted in fulfilment of the requirements\\ for the degree of \degreename}\\[0.3cm] % University requirement text
\textit{in the}\\[0.4cm]
%\groupname\\
\deptname\\[2cm] % Research group name and department name
\emph{Module Code:} ADD CODE\\
{\large \today}\\[1cm] % Date
\includegraphics[width=6cm]{./Images/UELlogo.png} % University/department logo - uncomment to place it
\vfill
\end{center}
\end{titlepage}
\end{document}