% HKUST-GZ Letter Template
% Open source at: https://github.com/ViGeng/HKUSTGZ-letter-latex-template
% Feel free to add issues or pull request.
%----------------------------------------------------------------------------------------
% CUSTOMIZABLE VARIABLES - Edit these to personalize your letter
%----------------------------------------------------------------------------------------
\newcommand{\senderName}{Your Name}
\newcommand{\senderTitle}{X Thrust, X Hub}
\newcommand{\senderInstitution}{The Hong Kong University of Science and Technology (Guangzhou)}
\newcommand{\senderPhone}{00000000}
\newcommand{\senderEmail}{@connect.ust.hk}
\newcommand{\recipientName}{Mr./Mrs.\ Name}
\newcommand{\recipientTitle}{Title of Letter}
\newcommand{\recipientInstitution}{The name of institute / department / school / company / ...}
\newcommand{\letterDate}{\today} % You can also use specific date like {August 25, 2025}
\newcommand{\letterSubject}{} % Optional subject line
\newcommand{\letterClosing}{Best Wishes,}
% Optional: Uncomment to enable background watermark
% \newcommand{\useBackground}{true}
%----------------------------------------------------------------------------------------
\documentclass[11pt]{article}
%----------------------------------------------------------------------------------------
% PACKAGES AND SETTINGS
%----------------------------------------------------------------------------------------
\usepackage{charter}        % Professional Charter font
\usepackage[utf8]{inputenc} % UTF-8 encoding for international characters
\usepackage[T1]{fontenc}    % Better font encoding
\usepackage{microtype}      % Improved typography and spacing
\usepackage{xcolor}         % Color support
\usepackage{ifthen}         % Conditional statements
\usepackage[
	a4paper,    % Paper size
	top=1in,    % Top margin
	bottom=1in, % Bottom margin
	left=1in,   % Left margin
	right=1in,  % Right margin
	%showframe  % Uncomment to show frames around the margins for debugging
]{geometry}
\setlength{\parindent}{0pt}     % No paragraph indentation 
\setlength{\parskip}{0.8em}     % Vertical space between paragraphs
\linespread{1.1}                % Slightly increased line spacing
\usepackage{wallpaper}      % Background images
\usepackage{graphicx}       % Required for including images
\usepackage{fancyhdr}       % Required for customizing headers and footers
\usepackage{array}          % Advanced table column types
\usepackage{booktabs}       % Professional table formatting
\usepackage{lastpage}       % Reference to last page number
%----------------------------------------------------------------------------------------
% HEADER AND FOOTER SETUP
%----------------------------------------------------------------------------------------
\fancypagestyle{firstpage}{%
	\fancyhf{} % Clear default headers/footers
	\renewcommand{\headrulewidth}{0pt} % No header rule on first page
	\renewcommand{\footrulewidth}{0.5pt} % Subtle footer rule
	\fancyfoot[C]{\small Page \thepage\ of \pageref{LastPage}} % Centered page numbering
}
\fancypagestyle{subsequentpages}{%
	\fancyhf{} % Clear default headers/footers
	\renewcommand{\headrulewidth}{0.5pt} % Header rule thickness
	\renewcommand{\footrulewidth}{0.5pt} % Footer rule thickness
	\fancyhead[L]{\small \senderName} % Sender name in header
	\fancyhead[R]{\small \letterDate} % Date in header
	\fancyfoot[C]{\small Page \thepage\ of \pageref{LastPage}} % Centered page numbering
}
\AtBeginDocument{\thispagestyle{firstpage}} % Use first page style on first page
\pagestyle{subsequentpages} % Use subsequent pages style on other pages
%----------------------------------------------------------------------------------------
\begin{document}
%----------------------------------------------------------------------------------------
% OPTIONAL BACKGROUND SETUP
%----------------------------------------------------------------------------------------
% Uncomment the line below to enable background watermark
%\newcommand\BackgroundPicture{
%   \put(0,0){
%     \parbox[b][\paperheight]{\paperwidth}{
%       \vfill
%       \centering\includegraphics[width=0.3\paperwidth,height=0.3\paperheight,keepaspectratio]{background.png}
%       \vfill
%     }}}
%\AddToShipoutPicture{\BackgroundPicture}
%----------------------------------------------------------------------------------------
% LETTER HEADER
%----------------------------------------------------------------------------------------
% Header with logo and contact info aligned
\begin{minipage}[c]{0.5\textwidth}
    \includegraphics[width=0.9\textwidth]{HKUSTGZ.png}
\end{minipage}\hfill
\begin{minipage}[c]{0.48\textwidth}
    \raggedleft
    \begin{tabular}{@{}l@{}}
        Date: \letterDate\\
        Name: \senderName\\
        Phone: \senderPhone\\
        Email: \senderEmail
    \end{tabular}
\end{minipage}
\vspace{3mm}
\rule{\linewidth}{0.8pt} % Professional horizontal rule
\vspace{4mm}
%----------------------------------------------------------------------------------------
% RECIPIENT ADDRESS
%----------------------------------------------------------------------------------------
\begin{tabular}{@{}l}
	\textbf{\recipientName} \\
	\textbf{\recipientTitle} \\
	\textbf{\recipientInstitution} \\
\end{tabular}
\vspace{1.5em}
%----------------------------------------------------------------------------------------
% LETTER CONTENT
%----------------------------------------------------------------------------------------
Dear \recipientName,
% Optional subject line - uncomment if needed
%\vspace{0.5em}
%\textbf{Re: \letterSubject}
%\vspace{0.5em}
% Main letter content goes here
I am writing to express my interest in [topic/position/opportunity]. As a member of the \senderInstitution, I believe this collaboration would be mutually beneficial.
Please find the detailed proposal in the attached documents. I would welcome the opportunity to discuss this matter further at your convenience.
Thank you for your time and consideration. I look forward to hearing from you soon.
%----------------------------------------------------------------------------------------
% LETTER CLOSING
%----------------------------------------------------------------------------------------
\vspace{1.5em}
\letterClosing
\vspace{1cm}
% Signature image (comment out if no signature file)
\IfFileExists{signature.png}{%
    \includegraphics[height=1cm]{signature.png}\\[0.5em]
}{}
\textbf{\senderName} \\
\senderTitle \\
\senderInstitution
% Optional: Add enclosures or cc lines
%\vspace{1em}
%\textbf{Enclosures:} Research proposal, CV
%\textbf{cc:} Department Head
\end{document}