重新定义 \maketitle 时出现多个作者

重新定义 \maketitle 时出现多个作者

我想在我的文档中添加多个作者。但是,\maketitle需要重新定义才能适合我的文档样式。因此,我习惯于\def重新定义它,如下所示:

\documentclass[a4paper,11pt]{article}

%%% PACKAGES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[swedish]{babel}
\usepackage{geometry}
\usepackage[dvipsnames]{xcolor}

%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt}

\geometry{margin=2cm}

\definecolor{oscars-darkblue}{HTML}{134590}

%%% TITLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter
\def\@maketitle{%
  \huge\centering\textbf{\textcolor{oscars-darkblue}{\fontfamily{qag}\selectfont\@title}}
  \vskip 4mm
  \normalsize\centering\@author
}
\makeatother

\title{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor}
\author{FirstName1 LastName1\\example1gmail.com\\affiliation1\\
   \and FirstName2 LastName2\\example2gmail.com\\affiliation2\\
   \and FirstName3 LastName3\\example3gmail.com\\affiliation3\\
   \and FirstName4 LastName4\\example4gmail.com\\affiliation4\\
   \and FirstName5 LastName5\\example5gmail.com\\affiliation5\\
}
\date{}

%%% DOCUMENT STARTS HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\maketitle

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\end{document}

这会导致命令出现问题\author。它将不再使作者与\and命令对齐。使用 Google Docs,我可以大致了解我想要的内容:

我的问题是:您能更改我现有的代码以使其工作吗?在这种情况下该怎么做?或者我需要使用命令renewcommand来单独定义\author\title

答案1

只能重新定义\title。试试这个代码。

更新在后续请求之后,第一页上将显示请求的标头。

b

\upperright使用、等填充四个角的内容\lowerright(文字或图形)。

示例中使用的图oscars.png取自评论中提供的链接。

\documentclass[a4paper,11pt]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[swedish]{babel}
\usepackage{geometry}
\usepackage[dvipsnames]{xcolor}

\usepackage{lipsum}% just dummy text

\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt}
\geometry{margin=2cm}
\definecolor{oscars-darkblue}{HTML}{134590}

%********************************************* added <<<<<<<<<<<<<<<<
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{makecell}
\usepackage{tabularx}

\makeatletter
\DeclareRobustCommand\title[1]{\gdef\@title{%
\vspace*{-4.5ex}{\small\makeheader}\sffamily\bfseries\huge\centering\textcolor{oscars-darkblue}{#1}\vspace*{4mm}}} 
\makeatother

\newcommand{\makeheader}{%
    \begin{tabularx}{\textwidth}{@{}X X@{}}
        \makecell[l]{\upperleft} &  \makecell[r]{\upperright} \\[5ex]
        \makecell[bl]{\lowerleft}& \makecell[br]{\lowerright} \\[1ex]
    \end{tabularx}\\ \color{gray!70}    \rule{\textwidth}{1pt}\\
}
%********************************************* 

% ***************************** fill the four corners with text or graphics <<<<<<<<<<<<<<<<<<<
\newcommand{\upperright}{Some text above to the right \\    Some more text above to the right}
\newcommand{\upperleft}{Some text above to the left \\  Some more text above to the left}
\newcommand{\lowerleft}{\includegraphics[scale=0.8]{oscars.png}}
\newcommand{\lowerright}{Some text align with the logo \\ Some more text align with the logo}
% *****************************

\title{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor}
\author{FirstName1 LastName1\\example1gmail.com\\affiliation1\\ \and FirstName2 LastName2\\example2gmail.com\\affiliation2\\ \and FirstName3 LastName3\\example3gmail.com\\affiliation3\\ \and FirstName4 LastName4\\example4gmail.com\\affiliation4\\ \and FirstName5 LastName5\\example5gmail.com\\affiliation5\\ }
\date{}
%%%%% dont mind the things below this
\begin{document}

\maketitle
\begin{abstract}
    \lipsum[1]
\end{abstract}  

\begin{multicols}{2}
    \lipsum[2-4]
\end{multicols}
\end{document}

相关内容