LaTeX forum ⇒ LettersHow to add "subject" and page numbers?

Formal letters, Cover letters, Newsletters
rodrigoqa
Posts: 1
Joined: Mon Nov 02, 2020 3:56 pm

How to add "subject" and page numbers?

Postby rodrigoqa » Mon Nov 02, 2020 5:36 pm

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Professional Formal Letter
% LaTeX Template
% Version 2.0 (12/2/17)
%
% This template originates from:
% http://www.LaTeXTemplates.com
%
% Authors:
% Brian Moses
% Vel (vel@LaTeXTemplates.com)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[11pt, a4paper]{letter} % Set the font size (10pt, 11pt and 12pt) and paper size (letterpaper, a4paper, etc)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\usepackage{graphicx} % Required for including pictures

\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage{gfsdidot} % Use the GFS Didot font: http://www.tug.dk/FontCatalogue/gfsdidot/
\usepackage{microtype} % Improves typography

\pagestyle{empty} % Suppress headers and footers

\setlength\parindent{1cm} % Paragraph indentation

% Create a new command for the horizontal rule in the document which allows thickness specification
\makeatletter
\newcommand{\vhrulefill}[1]{\leavevmode\leaders\hrule\@height#1\hfill \kern\z@}
\makeatother

%----------------------------------------------------------------------------------------
% DOCUMENT MARGINS
%----------------------------------------------------------------------------------------

\usepackage{geometry} % Required for adjusting page dimensions

\geometry{
top=1cm, % Top margin
bottom=1.5cm, % Bottom margin
left=3cm, % Left margin
right=3cm, % Right margin
%showframe, % Uncomment to show how the type block is set on the page
}

%----------------------------------------------------------------------------------------
% DEFINE CUSTOM COMMANDS
%----------------------------------------------------------------------------------------

\newcommand{\logo}[1]{\renewcommand{\logo}{#1}}

\newcommand{\Who}[1]{\renewcommand{\Who}{#1}}
\newcommand{\Title}[1]{\renewcommand{\Title}{#1}}

\newcommand{\headerlineone}[1]{\renewcommand{\headerlineone}{#1}}
\newcommand{\headerlinetwo}[1]{\renewcommand{\headerlinetwo}{#1}}

\newcommand{\authordetails}[1]{\renewcommand{\authordetails}{#1}}

%----------------------------------------------------------------------------------------
% AUTHOR DETAILS STRUCTURE
%----------------------------------------------------------------------------------------

\newcommand{\authordetailsblock}{
\hspace{\fill} % Move the author details to the far right
\parbox[t]{0.48\textwidth}{ % Box holding the author details; width value specifies where it starts and ends, increase to move details left
\footnotesize % Use a smaller font size for the details
\Who\\ % Author name
\textit{\authordetails} % The author details text, all italicised
}
}

%----------------------------------------------------------------------------------------
% HEADER STRUCTURE
%----------------------------------------------------------------------------------------

\address{
\includegraphics[width=1in]{\logo} % Include the logo of author institution
\hspace{0.82\textwidth} % Position of the institution logo, increase to move left, decrease to move right
\vskip -0.1\textheight~\\ % Position of the large header text in relation to the institution logo, increase to move down, decrease to move up
\Large\hspace{0.2\textwidth}\headerlineone\hfill ~\\[0.006\textheight] % First line of institution name, adjust hspace if your logo is wide
\hspace{0.2\textwidth}\headerlinetwo\hfill \normalsize % Second line of institution name, adjust hspace if your logo is wide
\makebox[0ex][r]{\textbf{\Who\Title}}\hspace{0.01\textwidth} % Print author name and title with a little whitespace to the right
~\\[-0.01\textheight] % Reduce the whitespace above the horizontal rule
\hspace{0.2\textwidth}\vhrulefill{1pt} \\ % Horizontal rule, adjust hspace if your logo is wide and \vhrulefill for the thickness of the rule
\authordetailsblock % Include the letter author's details on the right side of the page under the horizontal rule
\hspace{-0.25\textwidth} % Horizontal position of the author details block, increase to move left, decrease to move right
\vspace{-0.1\textheight} % Move the date and letter content up for a more compact look
}

%----------------------------------------------------------------------------------------
% COMPOSE THE ENTIRE HEADER
%----------------------------------------------------------------------------------------

\renewcommand{\opening}[1]{
{\centering\fromaddress\vspace{0.05\textheight} \\ % Print the header and from address here, add whitespace to move date down
\hspace*{\longindentation}\today\hspace*{\fill}\par} % Print today's date, remove \today to not display it
{\raggedright \toname \\ \toaddress \par} % Print the to name and address
\vspace{1cm} % White space after the to address
\noindent #1 % Print the opening line
}

%----------------------------------------------------------------------------------------
% SIGNATURE STRUCTURE
%----------------------------------------------------------------------------------------

\signature{\Who\Title} % The signature is a combination of the author's name and title

\renewcommand{\closing}[1]{
\vspace{2.5mm} % Some whitespace after the letter content and before the signature
\noindent % Stop paragraph indentation
\hspace*{\longindentation} % Move the signature right to the value of \longindentation
\parbox{\indentedwidth}{
\raggedright
#1 % Print the signature text
\vskip 1.65cm % Whitespace between the closing text and author's name for a physical signature
\fromsig % Prints the value of \signature{}, i.e. author name and title
}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\longindentation=0pt % Un-commenting this line will push the closing "Sincerely," and date to the left of the page

%----------------------------------------------------------------------------------------
% YOUR INFORMATION
%----------------------------------------------------------------------------------------

\Who{Dr. Niko Bellic} % Your name

\Title{, PhD} % Your title, leave blank for no title

\authordetails{
Department of Mathematics\\ % Your department/institution
123 Broadway\\ % Your address
Berkeley CA 12345\\ % Your city, zip code, country, etc
Email: j.smith@berkeley.edu\\ % Your email address
Phone: (000) 111-1111\\ % Your phone number
URL: LaTeXTemplates.com % Your URL
}

%----------------------------------------------------------------------------------------
% HEADER CONTENTS
%----------------------------------------------------------------------------------------

\logo{logo.jpg} % Logo filename, your logo should have square dimensions (i.e. roughly the same width and height), if it does not, you will need to adjust spacing within the HEADER STRUCTURE block in structure.tex (read the comments carefully!)

\headerlineone{UNIVERSITY} % Top header line, leave blank if you only want the bottom line

\headerlinetwo{OF CALIFORNIA} % Bottom header line

%----------------------------------------------------------------------------------------

\begin{document}

%----------------------------------------------------------------------------------------
% TO ADDRESS
%----------------------------------------------------------------------------------------

\begin{letter}{
Prof. Jones\\
Mathematics Search Committee\\
Department of Mathematics\\
University of California\\
Berkeley, California 12345
}

%----------------------------------------------------------------------------------------
% LETTER CONTENT
%----------------------------------------------------------------------------------------

\opening{Dear Sir or Madam,}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent a nisi diam. Morbi consequat facilisis mi, sit amet laoreet velit aliquet quis. Sed a nisi vel augue ultricies blandit. Phasellus et congue dolor, at cursus dui. Integer quis faucibus metus. Vestibulum lobortis ligula in lectus pretium, in placerat lacus iaculis. Mauris nibh erat, condimentum at tortor at, sagittis viverra tortor. Vivamus posuere fermentum eros, rhoncus sagittis nisi imperdiet ac.

Pellentesque hendrerit neque quis quam fringilla, vitae vulputate quam bibendum. Fusce in hendrerit mauris. Mauris pretium libero eget convallis mattis. Vivamus nec nisi imperdiet, lacinia diam id, facilisis nulla. Vivamus eleifend augue ut libero tincidunt commodo. Vivamus sodales in lacus vitae dictum. Nam et semper felis. Integer scelerisque accumsan condimentum. Aliquam laoreet erat vitae ornare consequat. Donec enim lacus, rutrum ut dui a, pretium mattis dui. Vivamus vulputate arcu nec congue convallis. Suspendisse faucibus turpis ac neque gravida, vel aliquet mauris tristique. In auctor fringilla nunc, sit amet tristique diam semper ac. Cras egestas nisi eu turpis facilisis, ac scelerisque elit lacinia. Sed eget adipiscing enim. Ut pulvinar ultrices purus ac eleifend.

Proin nunc erat, vestibulum quis tincidunt sit amet, cursus et libero. Aliquam erat volutpat. Sed vel malesuada velit. Vivamus risus arcu, facilisis non mauris sed, interdum varius tellus. Vivamus aliquam vel sapien quis ultricies. Mauris venenatis risus enim, in dapibus quam volutpat in. Vivamus iaculis sapien sit amet massa vehicula, tempus facilisis nulla adipiscing. Mauris ullamcorper pharetra libero, quis sodales dolor blandit et. Donec convallis risus id euismod pharetra. Suspendisse placerat laoreet imperdiet. Praesent malesuada fringilla urna, non sollicitudin erat. Nullam arcu neque, lobortis nec facilisis at, scelerisque ac erat. Nunc quis tincidunt lorem, vitae laoreet enim.

\closing{Sincerely,}

%----------------------------------------------------------------------------------------
% OPTIONAL FOOTNOTE
%----------------------------------------------------------------------------------------

% Uncomment the 4 lines below to print a footnote with custom text
%\def\thefootnote{}
%\def\footnoterule{\hrule}
%\footnotetext{\hspace*{\fill}{\footnotesize\em Footnote text}}
%\def\thefootnote{\arabic{footnote}}

%----------------------------------------------------------------------------------------

\end{letter}

\end{document}

Return to “Letters”

Who is online

Users browsing this forum: No registered users and 1 guest