如何让标题看起来像这样

如何让标题看起来像这样

我尝试过类似的东西。但它不起作用。我想把作者对象放在左侧,把日期对象放在右侧,在它们下面,标题应该在标题下面,一行应该在标题下面

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={180mm,266mm},
 left=15mm,
 top=14mm,
 }

\setlength{\parindent}{0em}
\setlength{\parskip}{1.4em}  


\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
  %\parindent=0pt% don't indent paragraphs in the title block
  {\@author \hfill \@date}
  \par
  \centering
  {\Large \bfseries\textsc{\@title}}
  \HRule\par%
}
\makeatother% resets the meaning of the at-sign (@)

\title{
Motivation Letter
}

\author{
Application for Master of Science\\
Computer Science\\
The University of X\\
}

\date{
Sourav Chakraborty\\
[email protected]\\
}

预期输出

答案1

由于\@author可能\@date包含多行,我建议使用minipage

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{geometry}
 \geometry{
 a4paper,
 total={180mm,266mm},
 left=15mm,
 top=14mm,
 }

\setlength{\parindent}{0em}
\setlength{\parskip}{1.4em}  


\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\makeatletter% since there's an at-sign (@) in the command name
\renewcommand{\@maketitle}{%
  %\parindent=0pt% don't indent paragraphs in the title block
  {\begin{minipage}[t]{.5\textwidth}\@author\end{minipage}\begin{minipage}[t]{.5\textwidth}\raggedleft\@date\end{minipage}}
  \par
  \centering
  {\Large \bfseries\textsc{\@title}}
  \HRule\par%
}
\makeatother% resets the meaning of the at-sign (@)

\title{Motivation Letter}

\author{%
Application for Master of Science\\
Computer Science\\
The University of X}

\date{%
Sourav Chakraborty\\
[email protected]}

\begin{document}
\maketitle

Lorem lipsum...
\end{document}

在此处输入图片描述

相关内容