0

I tried something like this. But it is not working. I want to put the author object on the left side, the date object on the right side and below them, the title should come and a line should come below the title

\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\\
x@gmail.com\\
}

Expected Output

1

As \@author and \@date may include several lines, I suggest using 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\\
x@gmail.com}

\begin{document}
\maketitle

Lorem lipsum...
\end{document}

enter image description here

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.