接下来,让我们来详细解释这个自定义的.cls
文件中的代码。这个文件定义了一个用于简历的自定义LaTeX类,包含了一些自定义命令和环境,以便更好地格式化简历内容。
基本设置(\LoadClass)
% 加载`article`文档类,并设置字体大小为11pt,纸张类型为letter。
\LoadClass[11pt,letterpaper]{article}
包的导入(\usepackage)
% 启用自定义颜色
\RequirePackage[usenames,dvipsnames]{xcolor}
% 移除段落缩进
\usepackage[parfill]{parskip}
% 启用表格列的粗体
\usepackage{array}
% 启用if-then-else语句
\usepackage{ifthen}
% 取消页码
\pagestyle{empty}
% 用于创建可缩放的符号
\usepackage{scalerel}
\usepackage{bbding,pifont} % 用于创建自定义的项目符号符号
载入其他文件(\input)
使用 \input{filename} 可以将外部文件的内容载入到主文件中。例如:
\input{fleqn.clo} % Align equations to the left
颜色定义(\definecolor)
% 定义一种名为`navyblue`的颜色,RGB值为(0, 54, 123)
\definecolor{navyblue}{RGB}{0,54,123}
自定义项目符号
% Define custom bullet point symbol with scalable size
\newcommand\sbullet[1][.5]{ % Command with optional argument for scaling factor (default 0.5)
\mathbin{ % Create a binary math operator to ensure proper spacing
\ThisStyle{ % Preserve the current math style
\vcenter{ % Vertically center the content
\hbox{ % Create a horizontal box for the content
\scalebox{#1}{ % Scale the content by the specified scaling factor
$\SavedStyle\bullet$ % Preserve the current math style and insert a bullet symbol
}
}
}
}
}
}
\newcommand\sbullet[1][.5]{...}
:定义一个名为sbullet
的命令,带有一个可选参数用于缩放比例(默认值为0.5)。\mathbin
:创建一个二元数学运算符以确保适当的间距。\ThisStyle
:保留当前的数学样式。\vcenter
:垂直居中内容。\hbox
:创建一个水平盒子用于内容。\scalebox{#1}{...}
:按指定的缩放比例缩放内容。$\SavedStyle\bullet$
:保留当前的数学样式并插入一个项目符号。
自定义列表符号( \description)
自定义列表样式:可以使用 \description 环境自定义列表样式。
\def\description{\list{}{\labelwidth\z@ \leftmargin\z@ \itemindent 1em}}
在这段代码中,\labelwidth\z@ 和 \leftmargin\z@ 将左边距和标签宽度设为 0,而 \itemindent 1em 则设置了项目的缩进量。
用户名命令(\def和\gdef)
% Define name command for storing user's name
\def \name#1{\def\@name{#1}}
\def \@name {}
\def \name#1{\def\@name{#1}}
:定义一个名为name
的命令,用于存储用户的名字。\def \@name {}
:初始化@name
为空。
当然,用\gdf
也可以。\def
是局部定义,只在当前范围内有效;\gdef
是全局定义,在整个文件中有效。
\gdef\journalyear{2024}
这里定义了一个宏 \journalyear,它的内容是 2024。
打印用户名命令
% Define printname command for printing the user's name
\newcommand{\printname}{
\begingroup % Begin a group to localize settings
\hfil % Create horizontal fill to center the content
{\namesize\bfseries\textit{\@name}} % Set the name size, bold, and italic style
\hfil % Create horizontal fill to center the content
\vspace{0.5cm} % Add vertical space below the name
\endgroup % End the group to revert localized settings
}
\newcommand{\printname}{...}
:定义一个名为printname
的命令,用于打印用户的名字。\begingroup
和\endgroup
:开始和结束一个局部组,以局部化设置。\hfil
:创建水平填充以居中内容。{\namesize\bfseries\textit{\@name}}
:设置名字的大小、粗体和斜体样式。\vspace{0.5cm}
:在名字下方添加0.5cm的垂直间距。
标签和信息命令(\newcommand)
% 定义一个名为`tag`的命令,用于格式化标签,颜色为`navyblue`,斜体。
\newcommand{\tag}[1]{\textcolor{navyblue}{\textit{#1: }}}
% 定义一个名为`info`的命令,用于格式化信息文本,颜色为黑色。
\newcommand{\info}[1]{\textcolor{black}{#1}}
个人信息命令(\newcommand)
% Define personalInfo command for formatting personal information
\newcommand{\personalInfo}[1]{\centerline{#1}\par\personalInfoSkip}
% Define infoSeparator command for formatting separators in personal information
\newcommand{\infoSeparator}{{\textcolor{navyblue}{\ding{92}\hspace{0.1 cm}}}}
\newcommand{\personalInfo}[1]{\centerline{#1}\par\personalInfoSkip}
:定义一个名为personalInfo
的命令,用于格式化个人信息。\centerline{#1}
:将内容居中。\par
:结束段落。\personalInfoSkip
:添加个人信息之间的间距。
\newcommand{\infoSeparator}{{\textcolor{navyblue}{\ding{92}\hspace{0.1 cm}}}}
:定义一个名为infoSeparator
的命令,用于格式化个人信息中的分隔符,颜色为navyblue
。
打印个人信息命令
% Define printPersonalInfo command for printing personal information
\newcommand{\printPersonalInfo}[1]{ % Command with one required argument for personal information
\begin{center} % Begin center environment to center the content
#1 % Print the personal information content
\end{center} % End center environment
\vspace{-1cm} % Add negative vertical space to reduce the gap below the personal information
}
\newcommand{\printPersonalInfo}[1]{...}
:定义一个名为printPersonalInfo
的命令,用于打印个人信息。\begin{center}... \end{center}
:将内容居中。#1
:打印个人信息内容。\vspace{-1cm}
:添加负的垂直间距以减少个人信息下方的间隙。
重定义文档命令(\let和\renewcommand)
% Replace the document command with custom implementation
\let\ori@document=\document % Save the original \document command as \ori@document
\renewcommand{\document}{ % Redefine the \document command
\ori@document % Call the original \document command
\begin{center} % Begin center environment to center the content
\printname % Print the user's name using the \printname command
\end{center} % End center environment
}
\let\ori@document=\document
:保存原始的\document
命令为ori@document
。\renewcommand{\document}{...}
:重定义\document
命令。\ori@document
:调用原始的\document
命令。\begin{center}... \end{center}
定义页面样式,如页眉页脚(\def\ps@name和@oddhead和@evenhead)
\def\ps@aaaheadings
{
% 页脚定义
\def\@oddfoot{{\journalacronym}, {\journalvol}, {\journalyear} \hfill}
\def\@evenfoot{\hfill {\journalacronym}, {\journalvol}, {\journalyear}}
% 页眉定义
\def\@oddhead{\small\hfil\rightmark\the\authorrunning\hfil} % 定义奇数页的页眉
\def\@evenhead{\hfil\the\titlerunning\leftmark\hfil} % 定义偶数页的页眉
}
\@oddfoot
定义奇数页脚内容,\@evenfoot
定义偶数页脚内容。
{\journalacronym}
等是预定义的变量,显示的是期刊名、期刊卷数、年份等信息。
文本对齐控制(\hfill)
\def\@oddfoot{\hfill Left content \hfill Right content \hfill}
\hfill
会在内容之间添加空间,实现左右对齐效果。
启用双栏模式(@twocolumntrue)
\@twocolumntrue
最终cls文件内容
% This template is designed to offer an aesthetically pleasing resume that adheres to a formal and institutional tone, making it suitable for applications to companies and research centers requiring a high degree of professionalism. Navy blue has been chosen as the primary color to align with these objectives.
% The code is well-documented and annotated, allowing users to easily customize and modify it according to their needs. Please note that the template's content is meant to be humorous and should not be taken literally. We are grateful for your interest in using this template for your professional endeavors.
% Author: Christian Maria Giannetti
%----------------------------------------------------------------------------------------
% Packages And Other Document Configurations
%----------------------------------------------------------------------------------------
\documentclass[UTF8]{ctexart}
% Document margins
\usepackage[left=0.75in,top=0.6in,right=0.75in,bottom=0.6in]{geometry}
% Color and hyperlink packages
\usepackage{xcolor}
\usepackage{hyperref}
% Footnote and margin adjustment packages
\usepackage{footnote}
\usepackage{changepage}
% Fontawesome package for icons
\usepackage{fontawesome}
% Tabularx package for custom tables
\usepackage{tabularx}
% Define navyblue color
\definecolor{navyblue}{RGB}{0,54,123}
%----------------------------------------------------------------------------------------
% Customizations
%----------------------------------------------------------------------------------------
% Define italicitem, bolditem, and plainitem commands
\newcommand{\italicitem}[1]{\item{\textit{#1}}}
\newcommand{\bolditem}[1]{\item{\textbf{#1}}}
\newcommand{\plainitem}[1]{\item{#1}}
% Define user-friendly link command for hyperlinks
\newcommand{\link}[2]{{\href{#1}{#2}}}
\newcommand{\entry}[2]{#1 & #2 \tabularnewline} % Defines an entry with two arguments: #1 for the first column and #2 for the second column
%----------------------------------------------------------------------------------------
% Define envsection command for defining a new environment section
%----------------------------------------------------------------------------------------
\newcommand{\tableEnv}[2]{%
\begin{rSection}{#1} % Begin rSection with the given name
\begin{adjustwidth}{0.0in}{0.1in} % Set the left and right margins
\begin{tabularx}{\linewidth}{@{} >{\bfseries}l @{\hspace{6ex}} X @{}}
#2 % Print the content inside the tabularx environment
\end{tabularx}
\end{adjustwidth}
\end{rSection}
}
%----------------------------------------------------------------------------------------
% Begin document
%----------------------------------------------------------------------------------------
% Set name with navyblue color
\name{\color{navyblue} 闪闪 }
\begin{document}
\printPersonalInfo{
\personalInfo{\tag{Residence/domicile}\info{113, Groove Street}}
\personalInfo{\tag{E-mail}\info{pleasedonotcontactme@gmail.com} \infoSeparator\tag{Telephone number}\info{+1-202-555-0100}}
\personalInfo{\tag{Place of birth}\info{Ariccia, Italy} \infoSeparator\tag{Date of birth}\info{08-11-1968}}
}
%----------------------------------------------------------------------------------------
% Education section
%----------------------------------------------------------------------------------------
\begin{rSection}{Education}
% Master's degree entry
\begin{rSubsectionNoBullet}{\bf Master's degree in Memeology and Unicorn Analytics}{Faber College}{Master's degree program}{February 2019 - April 2020}
\italicitem{Graduated with honors}
\italicitem{Thesis title: A deep learning approach to predicting the next Brexit: Unicorns vs. White Walkers}
\end{rSubsectionNoBullet}
% Bachelor's degree entry
\begin{rSubsectionNoBullet}{\bf Bachelor's degree in Absurd Robotics Engineering}{Westeros University}{Bachelor's degree program}{May 2016 - August 2018}
\italicitem{Final grade: 9,001/10,000}
\italicitem{Capstone project: Design and implementation of a robot that makes toast using a flamethrower}
\end{rSubsectionNoBullet}
% High School diploma entry
\begin{rSubsectionNoBullet}{\bf High School Diploma}{Rydell High School}{High school's diploma program}{June 2011 - May 2015}
\italicitem{Final grade: 7/7}
\italicitem{Senior project: Applying machine learning techniques to predict students' failure rates based on their meme consumption habits}
\end{rSubsectionNoBullet}
\end{rSection}
%----------------------------------------------------------------------------------------
% Work experience section
%----------------------------------------------------------------------------------------
\begin{rSection}{Work experience}
% First work experience entry
\begin{rSubsection}{Dank Memes Inc.}{September 2019 - September 2021}{Head of "Machine Learning for Absurd Stuff" Department}{Ariccia, Italy}
\item Developed state-of-the-art predictive models for next-generation memes.
\item Applied machine learning techniques to optimize unicorn-mounted laser systems.
\item Streamlined internal meme generation pipelines.
\end{rSubsection}
% Second work experience entry
\begin{rSubsection}{Viral News Robotics Laboratory (VNRL)}{March 2019 - July 2019}{Robotics Comedian Intern}{Fries, Virginia}
\item Engineered a robotic Tyrion Lannister that repeatedly asks, "Where's the wine?"
\end{rSubsection}
% Third work experience entry
\begin{rSubsection}{Library of Alexandria 2.0}{January 2017 - April 2018}{Novelist}{Cut and Shoot, Texas}
\item Curated the "Dumb \& Dumber Guide to Classic Literature", featuring "Fifty Smudges
of Gray", "Pride and Prejudice: smart girls can always find a way to rationalize marrying for money"
\item Hosted a weekly meme reading club on "Breadxit": the debate over whether bread should be banned from Europe
\end{rSubsection}
\end{rSection}
%----------------------------------------------------------------------------------------
% Extracurricular activities section
%----------------------------------------------------------------------------------------
\begin{rSection}{Extracurricular activities}
% First extracurricular entry
\begin{rSubsectionNoBullet}{Procrastinators Anonymous: Machine Learning for Laziness}{November 2015}{Successfully delayed attending the course}{Rome, Italy}
\plainitem{Developed an AI that predicts the perfect moment to start binge-watching Dr. House episodes instead of working on important tasks.}
\end{rSubsectionNoBullet}
% Third extracurricular entry
\begin{rSubsectionNoBullet}{Dumb Literature Club: Famous Books with Ridiculous Twists}{June 2014 - Present}{Proud Member}{Popejoy, Iowa}
\plainitem{Regularly participate in discussions concerning famous literature works, such as "The Great Catsby", which is basically the Great Gatsby, but with cats.}
\end{rSubsectionNoBullet}
\end{rSection}
%----------------------------------------------------------------------------------------
% Technical skills section
%----------------------------------------------------------------------------------------
\tableEnv{Technical skills}{
\entry{Programming Languages/Tools}{C, C++, Java, Javascript, Python, Prolog, \LaTeX, PigeonScript (for bird-based memes)}
}
%----------------------------------------------------------------------------------------
% Language proficiencies section
%----------------------------------------------------------------------------------------
\tableEnv{Language proficiencies}{
\entry{English}{Fluent in Shakespearean insults}
\entry{French}{Proficient in baguette related jokes}
}
%----------------------------------------------------------------------------------------
% Most relevant projects section
%----------------------------------------------------------------------------------------
\tableEnv{Portfolio of most relevant projects}{
\entry{Survey}{Analyzing the effects of replacing office chairs with unicycles on employee morale}
\entry{Survey}{Investigation of the therapeutic effects of watching cat videos for 8 hours a day}
\entry{Paper}{The correlation between sock loss in laundry and the existence of parallel universes}
\entry{Article}{The definitive study on the impact of pineapple as a pizza topping on global diplomacy}
}
%----------------------------------------------------------------------------------------
% Memberships section
%----------------------------------------------------------------------------------------
\tableEnv{Memberships}{
\entry{Couch Potatoes Anonymous}{A support group for those addicted to binge-watching TV shows}
\entry{Procrastinators' Club}{A group that will eventually get around to doing something, someday}
}
\end{document}