% main.tex - an example LaTeX file to demonstrate the usage of Tongjiletter.cls
%
% Template originally created by Brian Wood (brian.wood@oregonstate.edu). Please feel free to send suggestions for improvements; this template/cls may not be perfectly optimized.
% Modified by Shaozuo Yu (AugustYum@outlook.com) to suit the requirements of Tongji students.
% Further modifications and maintenance by Rizhong Lin (rizhonglin@tongji.edu.cn) as of May 22, 2023.
\documentclass[12pt]{Tongjiletter}
\usepackage{fontspec}
\usepackage{tikz}
\usepackage{xcolor}
\definecolor{tongjiblue}{rgb}{0, 0.372, 0.643}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{graphicx}
\usepackage{eso-pic}
% Set custom font here. Tongji uses Source Serif Pro.
% Comment this line out if you do not have Source Serif Pro installed;
% computer modern (or your default font) will be substituted.
\setmainfont{Source Serif Pro}
% Set up fancy page style for page numbering
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\rhead{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\newcommand{\watermark}[3]{\AddToShipoutPictureBG{
\parbox[b][\paperheight]{\paperwidth}{
\vfill%
\centering%
\begin{tikzpicture}
\path (0,0) -- (\paperwidth,\paperheight);
\node[opacity=.1] at (current page.center)
{\includegraphics[width=0.55\textwidth]{logo.pdf}};
\end{tikzpicture}
\vfill}}}
% Define custom coordinate system for \tikz
\makeatletter
\def\parsecomma#1,#2\endparsecomma{\def\page@x{#1}\def\page@y{#2}}
\tikzdeclarecoordinatesystem{page}{
\parsecomma#1\endparsecomma
\pgfpointanchor{current page}{north east}
\pgf@xc=\pgf@x%
\pgf@yc=\pgf@y%
\pgfpointanchor{current page}{south west}
\pgf@xb=\pgf@x%
\pgf@yb=\pgf@y%
\pgfmathparse{(\pgf@xc-\pgf@xb)/2.*\page@x+(\pgf@xc+\pgf@xb)/2.}
\expandafter\pgf@x\expandafter=\pgfmathresult pt
\pgfmathparse{(\pgf@yc-\pgf@yb)/2.*\page@y+(\pgf@yc+\pgf@yb)/2.}
\expandafter\pgf@y\expandafter=\pgfmathresult pt
}
\makeatother
%%%%%%%%%%% Put Personal Information Here %%%%%%%%%%%
\def\name{Allen Turing,\\
Associate Professor,\\
Department of Computer Science and Technology, \\
Tongji University
}
%%%%%%%%%%%% Additional Contact Information %%%%%%%%%%%
\def\Where{%
\textbf{\color{tongjiblue}Department of Computer Science, \\
Tongji University}
}
\def\Address{
4800 Cao'an Hwy.,\\
Jiading Dist.,
}
\def\CityZip{Shanghai, 201804}
\def\TEL{\textbf{\color{tongjiblue}Phone}: 541-555-5555}
\def\Email{\textbf{\color{tongjiblue}E-mail}: professor@tongji.edu.cn}
\def\URL{\textbf{\color{tongjiblue}URL}: https://www.tongji.edu.cn/}
%%%%%%%%%%%%%%%% Footer information %%%%%%%%%%%%%%%%%%
\def\school{\small{
Tongji Univ. $\cdot$
Dept. of Comp. Sci. \& Tech. $\cdot$
Zhixin Bldg., 4800 Cao'an Hwy. $\cdot$
Shanghai, 201804}
}
\cfoot{\school}
%%%%%%%%%%%%%%%%%%%%% Signature line %%%%%%%%%%%%%%%%%%%%%
\signature{
\vspace{-12mm}\includegraphics[scale=0.40]{signature_block.pdf}\\\vspace{-2mm}
\name
}
% This block sets up the address on the right-hand side of the header.
\address{}
\def\newaddress{%
\Where\\
\Address\\
\CityZip\\
\TEL\\
\Email\\
\URL
}
%%%%%%%%%%% DATE %%%%%%%%%%%%%%%%%%%%%%%%%
\date{\vspace{10mm} \today}
%%%%%%%%%%% Set the subject here if there is one %%%%
% \subject{Letter of Recommendation} % optional subject line
\begin{document}
\begin{letter}{
Some University\\
Some Address\\
SomeTown, SomeState SomeZip
}
\begin{tikzpicture}[remember picture,overlay,,every node/.style={anchor=center}]
\node[text width=7cm] at (page cs:0.5,0.73){\small \newaddress};
\end{tikzpicture}
\opening{Dear Application Committee,}
% Remove it if you do not want the Tongji logo watermark
\watermark{}{}{}
\lipsum[1-6]
\closing{Sincerely,}
% Comment out/in the lines below as necessary
%\encl{If an enclosure is provided, let them know what it is.}
%\ps{A postscript if that is a thing you do.}
%\cc{Someone Who Cares (and is copied).}
\end{letter}
\end{document}