Skip to content

Commit

Permalink
feat: init ncu letter of recommendation
Browse files Browse the repository at this point in the history
  • Loading branch information
1chooo committed Oct 30, 2024
1 parent d465ec2 commit f94212b
Show file tree
Hide file tree
Showing 7 changed files with 329 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.fdb_latexmk
*.fls

*.log
*.aux
*.out
*.synctex.gz
# *.pdf
*.lot
.DS_Store

.vscode
139 changes: 139 additions & 0 deletions NCULetter.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
%
% This class based on "brownletter.cls" Copyright 2003, Nesime Tatbul (tatbul@cs.brown.edu)
%
% This version modifications by Huang Weiran
% (huangweiran1998@outlook.com), 28 October 2019
%
% New version modifications by Fanchao Chen
% (chenfanchao_robin@outlook.com), 23 October 2021
%
% New version modifications by Jen-tse Huang
% (jthuang@cse.cuhk.edu.hk), 6 April 2024

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{NCULetter}
\RequirePackage{graphicx}
\RequirePackage{epstopdf}
\RequirePackage{epsfig}
\RequirePackage{ifthen}
\RequirePackage{xcolor}
\definecolor{slcolor}{HTML}{00679C}
\DeclareGraphicsExtensions {.png}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
\ProcessOptions
\LoadClass[letterpaper]{letter}

\newcommand{\subjectname}{Subject}
\newcommand{\@subject}{}
\newcommand{\subject}[1]{\renewcommand{\@subject}{\subjectname: #1}}

\newboolean{logofound}
\IfFileExists{img/logo.png}
{\setboolean{logofound}{true}}
{\setboolean{logofound}{false}}

\setlength{\textwidth}{6.875in}
\setlength{\textheight}{7.0in}
\setlength{\topskip}{0.0in}
\setlength{\footskip}{1.0in}
\setlength{\oddsidemargin}{-0.25in}
\setlength{\evensidemargin}{-0.25in}
\setlength{\topmargin}{-0.875in}

\DeclareFixedFont{\xcmrbn}{OT1}{cmr}{b}{n}{10}
\DeclareFixedFont{\xcmrmn}{OT1}{cmr}{m}{n}{10}
\DeclareFixedFont{\ixcmrmn}{OT1}{cmr}{m}{n}{9}

\newsavebox{\departmenthead}
\newsavebox{\departmentfoot}
\newsavebox{\emptyfoot}

\sbox{\departmenthead}{
\begin{tabular*}{\textwidth}
{@{}l@{\extracolsep{0.0in}}|@{\extracolsep{0.125in}}l@{}}

% HELP FOR SETTING UP PARBOXES
% \parbox[position][height][inner-pos]{width}{text}
% The \parbox has two mandatory arguments:
% width - specifies the width of the parbox, and
% text - the text that goes inside the parbox.
% LaTeX will position a parbox so its center lines up with the center of the text line. The optional position argument allows you to line up either the top or bottom line in the parbox (default is top).
% If the height argument is not given, the box will have the natural height of the text.
% The inner-pos argument controls the placement of the text inside the box. If it is not specified, position is used.
% t -- text is placed at the top of the box.
% c -- text is centred in the box.
% b -- text is placed at the bottom of the box.
\parbox{3.9in}
{\raggedright
\ifthenelse{\boolean{logofound}}
{\hspace{0.25in}\epsfig{file=img/logo.png, height=1.0in}}
{\parbox[c][2.0in][c]{3.0in}{\hfill}
\ClassWarning{CUHKletter}{logo.png COULD NOT BE FOUND!}}
} &
% DEPARTMENT OR SCHOOL
% This just sets the size of the box to the right of the logo, and the size of the vertical line. The vertical line is set by the size of the first numerical argument of the \parbox command.
%
% In the future, the "From" address might be better set using "tikz".
\parbox[c][1.0in][c]{1.0in}{{~}\\}\\
\end{tabular*}
}

\savebox{\emptyfoot}[\textwidth][c]{\ixcmrmn
\hspace*{\textwidth}
}

\renewcommand{\ps@firstpage}{
\setlength{\headheight}{1.375in}
\setlength{\headsep}{1.0in}
\renewcommand{\@oddhead}{\usebox{\departmenthead}}
\renewcommand{\@oddfoot}{\usebox{\departmentfoot}}
\renewcommand{\@evenhead}{}
\renewcommand{\@evenfoot}{}
}

\renewcommand{\ps@empty}{
\setlength{\headheight}{1.375in}
\setlength{\headsep}{0.5in}
\renewcommand{\@oddhead}{}
\renewcommand{\@oddfoot}{\usebox{\emptyfoot}}
\renewcommand{\@evenhead}{}
\renewcommand{\@evenfoot}{\usebox{\emptyfoot}}
}

\providecommand{\@evenhead}{}
\providecommand{\@oddhead}{}
\providecommand{\@evenfoot}{}
\providecommand{\@oddfoot}{}

\pagestyle{empty}

\renewcommand{\opening}[1]{\thispagestyle{firstpage}
\ifx\@empty\fromaddress
\else
{\raggedleft
\begin{tabular}{l@{}}\ignorespaces
\fromaddress \\ *[1\parskip]
\end{tabular}\par
}
\fi
\vspace{-6\parskip}
\@date \vspace{2\parskip}\\
{\raggedright \toname \\ \toaddress \par}
\vspace{1\parskip}
\ifthenelse{\equal{\@subject}{}}{}{\@subject\par}
\vspace{1\parskip}
#1\par\nobreak
}

\renewcommand{\closing}[1]{\par\nobreak\vspace{\parskip}
\stopbreaks
\noindent
\hspace*{0.6\textwidth}\parbox{0.4\textwidth}{\raggedright
\ignorespaces #1\\[4\medskipamount]
\ifx\@empty\fromsig
\fromname
\else \fromsig
\fi\strut}
\par
}
Binary file added img/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/signature_block.pdf
Binary file not shown.
Binary file added main.pdf
Binary file not shown.
178 changes: 178 additions & 0 deletions main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
% --------------------------------
% NCU Letter of Recommendation in Latex
% Author Chun-Ho (Hugo) Lin (1chooo) <hugo970217@gmail.com>
% License : MIT
% --------------------------------

\documentclass[12pt]{NCULetter}
\usepackage{fontspec}
\usepackage{tikz}
\usepackage{xcolor}
\definecolor{mycolor}{RGB}{106,36,105}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{eso-pic}

% This section is just a bunch of busywork so that the second and following pages read ``Page X of Y''
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\rhead{Page \thepage \hspace{1pt} of \pageref{LastPage}}


% Set custom font here. Comment this line out if you do not have a Cambria font (originally included with this template) installed; computer modern (or whatever your current default font is) will be substituted.
% \setmainfont{[Cambria.ttf]}[BoldFont = [CambriaBold.ttf], ItalicFont = [CambriaItalic.ttf], BoldItalicFont = [CambriaBoldItalic.ttf] ]

\newcommand{\watermark}[3]{\AddToShipoutPictureBG{
\parbox[b][\paperheight]{\paperwidth}{
\vfill
\centering
\begin{tikzpicture}
\path (0,0) -- (\paperwidth,\paperheight);
\node[opacity=.06] at (current page.center)
{\includegraphics[width=0.70\textwidth]{img/background.png}};
\end{tikzpicture}
\vfill}}}

% The material below is a whole big dang thing whose purpose is just to set up a fixed coordinate system for \tikz so that you can put the Department or School address in the upper right-hand side without it moving all around every time you change something in the page. I think it works.
% Defining a new coordinate system for the page:
%
% --------------------------
% |(-1,1) (0,1) (1,1)|
% | |
% |(-1,0) (0,0) (1,0)|
% | |
% |(-1,-1) (0,-1) (1,-1)|
% --------------------------
\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


%%%%%%%%%%%%%%%%% Personal Information %%%%%%%%%%%%%%%%%

\def\name{
{\{NAME\}},\\
{\{TITLE\}},\\
Department of {\{XXX\}}, National Central University
}

% List your degree(s), licences, etc. here if you like.
% \def\What{, Your degrees, etc.}

%%%%%%%%%%%%%%%%%% School or Department %%%%%%%%%%%%%%%

\def\Where{\hspace{-1.2mm}\textbf{\color{mycolor}
Department of Atmospheric Sciences, \\ National Central University
}}

%%%%%%%%%%%% Additional Contact Information %%%%%%%%%%%

\def\Address{No. 300, Zhongda Rd., Zhongli District}
\def\CityZip{Taoyuan City 320317}

\def\Email{\textbf{\color{mycolor}E-mail}: prof@ncu.edu.tw}

\def\TEL{\textbf{\color{mycolor}Phone}: +886 422 7151}

\def\URL{\textbf{\color{mycolor}URL}: https://www.ncu.edu.tw/}

%%%%%%%%%%%%%%%% Footer information %%%%%%%%%%%%%%%%%%

% The next line is for your college, used as a footer. If you prefer not to have this, just comment out these lines in favor of the line labeled "[[Alternate]]" below
\def\school{\small{
~Department of Computer Science $\cdot$
~Sha Tin, New Territories $\cdot$
~Hong Kong SAR} }
% \def\school{~} % [[Alternate]]

%%%%%%%%%%%%%%%%%%%%% Signature line %%%%%%%%%%%%%%%%%%%%%

% Set your signature line here.
% One can add a signature image in a PDF file using the following code; this requires a file called "signature_block.pdf" to be installed in the same folder as the .tex file. The vertical spacing (\vspace) and the scaling will have to be adjusted to get things to look correct for your particular signature image. Alternatively, comment out the following line in favor of the one labeled "[[Alternate]]" if you want to sign a paper copy of the letter.

\signature{
\vspace{-12mm}\includegraphics[scale=1.0]{img/signature_block.pdf}\\\vspace{-2mm}
\name}
% \signature{\name} % [[Alternate]]

% This block sets up the address on the right-hand side of the header.
% The following lines just compile the information you set up into the LaTex letter variable "address" for later use.
% The following command "clears out" the default address so that it can be better set using \tikz
\address{}

\def\newaddress{
\Where\\
\Address\\
\CityZip\\
\TEL\\
\Email\\
\URL
}

%%%%%%%%%%% DATE %%%%%%%%%%%%%%%%%%%%%%%%%

% If you want a date different from the current date, comment out the next line in favor of the line labeled "[[Alternate]]". The ``\vspace{10mm}'' just moves the date down a tiny bit so it doesn't interfere with the header. This can be adjusted to your preference.
\date{\vspace{10mm} \today}
% \date{\vspace{10mm} 20 September 2020} %[[Alternate]]

%%%%%%%%%%% Set the subject here if there is one %%%%
% \subject{Stuff} % optional subject line

\begin{document}

%%%%%%%% The "To" address goes here.
\begin{letter}
{
Target University\\
SomeAddresss\\
SomeTown, SomeState~~SomeZip
}
% This line sets up the return address to the right-side of the OSU logo. The location is set with absolute node addresses using ``\tikz''. It can still be a bit fussy, and you may need to alter this a little to get things to look right. The bit that changes the position are the numbers in parentheses ``at (14.2,2.7)''

\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}

%%%%%% The ``opening'' is just the method of address you would like to use at the start of the letter.

\opening{Dear Application Committee,}

%%%%%%%%%% Body of letter %%%%%%%%%%%%%%
% Remove it if you do not want watermark
\watermark{}{}{}

%%%%%%%%%%% Text %%%%%%%%%%%%%%
It's my pressure to enthusiastically recommend {\{RECOMMENDATION NAME\}} for admission to the {\{Master of PROGRAM NAME\}} at {\{UNIVERSITY NAME\}}.




%%%%%%% ``closing'' sets the sign-off line.
\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}

0 comments on commit f94212b

Please sign in to comment.