如何在第一页的标题前添加两列标题?

如何在第一页的标题前添加两列标题?

我想在第一页的顶部(文章标题之前)添加两列。它应该看起来像这样(我只用红色矩形突出显示了顶部以显示我想要实现的目标):

标题前两列

我当前的代码如下:

\documentclass[a4paper, 12pt]{article}

\title{SPSS opdracht Kansrekening en Statistiek}
\author{Eerste zittijd}

\begin{document}
\maketitle

Here is some text...

\tableofcontents
\newpage

\end{document}

我该如何进一步开展工作?

(对于那些懂荷兰语的人:不要介意文本的含义。当然“Eerste Zittijd”不是作者。我只是将其改编成屏幕截图。)

答案1

下次,请记住所有问题都应包括最小工作示例(MWE)它说明了问题或者演示了您已经尝试过的内容和基本设置。

以下是该课程的基本解决方案article,您可以根据自己的情况进行适当调整:

\documentclass{article}
\usepackage{titling}
\usepackage{calc}
\newcommand*{\myinstitution}{}
\newcommand*{\institution}[1]{%
  \renewcommand*{\myinstitution}{#1}}
\newcommand*{\myacyear}{}
\newcommand*{\acyear}[1]{%
  \renewcommand*{\myacyear}{#1}}

\title{The Title}
\author{The Author}
\institution{Author's Institution}
\acyear{Academic Year YYYY--YYYY}

\renewcommand{\maketitlehooka}{%
  \noindent\parbox{\linewidth}{\myinstitution\hfill\myacyear}}

\begin{document}
\maketitle

\end{document}

附加标题

使用\institution{}\acyear{}设置盒装物料左右两侧的内容。

这是一个包含红色框架的版本,因为我刚刚意识到你实际上并不想要它(它可能对某些人有用,至少是另一种颜色):

\documentclass{article}
\usepackage{titling}
\usepackage{efbox,calc}
\newcommand*{\myinstitution}{}
\newcommand*{\institution}[1]{%
  \renewcommand*{\myinstitution}{#1}}
\newcommand*{\myacyear}{}
\newcommand*{\acyear}[1]{%
  \renewcommand*{\myacyear}{#1}}

\title{The Title}
\author{The Author}
\institution{Author's Institution}
\acyear{Academic Year YYYY--YYYY}

\newlength{\myboxwidth}
\setlength{\myboxwidth}{\linewidth-2\fboxrule-2\fboxsep}

\renewcommand{\maketitlehooka}{%
  \noindent\efbox[linecolor=red]{%
    \parbox{\myboxwidth}{\myinstitution\hfill\myacyear}}}

\begin{document}
\maketitle

\end{document}

标题处有红框

答案2

这是使用环境的另一种解决方案{tabular*}

\documentclass[12pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}
\begin{titlepage}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here

\center % Center everything on the page

%----------------------------------------------------------------------------------------
%   HEADING SECTIONS
%----------------------------------------------------------------------------------------
\textsc{\LARGE University Name}\\[1.5cm] % Name of your university/college
\textsc{\Large Major Heading}\\[0.5cm] % Major heading such as course name
\textsc{\large Minor Heading}\\[0.5cm] % Minor heading such as course title
%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------
\begin{center}
\begin{table}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lr}
  Author's Institution & Academic Year YYYY--YYYY
  \end{tabular*}
\end{table}
\end{center} 
\HRule \\[0.4cm]
{ \huge \bfseries Title}\\[0.4cm] % Title of your document
\HRule \\[1.5cm]
\vfill % Fill the rest of the page with whitespace
\end{titlepage}
\end{document}

在此处输入图片描述

答案3

用瑞士军刀叫tikz

\documentclass[a4paper, 12pt]{article}
\usepackage{tikz}

\title{SPSS opdracht Kansrekening en Statistiek}
\author{Eerste zittijd}

\begin{document}
\maketitle
%% put this after \maketitle and this placement is important
\begin{tikzpicture}[remember picture,overlay]
  \node[draw=red,thick,minimum width=\textwidth,text width=\textwidth] at ([yshift=-1in]current page.north) {Author's Institution \hfill Academic Year YYYY--YYYY};
\end{tikzpicture}

Here is some text...

\tableofcontents
\newpage

\end{document}

在此处输入图片描述

这至少需要 2 次编译运行。

相关内容