website/_site/cv/simplecv.sty

149 lines
4.3 KiB
Plaintext
Raw Normal View History

2022-11-19 18:57:04 +00:00
\ProvidesPackage{simplecv}
% Packages
\usepackage[cm]{fullpage} % Margins
\usepackage[hidelinks]{hyperref} % Hyperlinks
\usepackage{titlesec} % Title formatting
\usepackage{subfiles} % File importing
\usepackage{multicol} % Multiple columns
\usepackage[usenames,dvipsnames]{xcolor} % Coloring
\usepackage{enumitem} % List customization
\usepackage{lastpage} % Page numbering
\usepackage{fancyhdr} % Footers
\usepackage[russian,english]{babel} % Language styles
\usepackage{graphicx} % Importing graphics
\usepackage[export]{adjustbox} % Aligning margins
% % Chinese
% \usepackage{xeCJK}
% \setCJKmainfont{BabelStone Han}
% % Cyrillic/Russian
% \usepackage{hyphenat}
% \babelfont{rm}{Droid Sans}
% Styling
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\urlstyle{same}
\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}
% Quotes
\usepackage[autostyle,english=american]{csquotes}
\MakeOuterQuote{"}
% Hyperlinks
% \newcommand{\link}[2]{\href{#1}{\underline{\smash{#2}}}}
\newcommand{\link}[2]{\href{#1}{#2}}
% Define colors
\definecolor{color-text}{gray}{0.10} % light black
\definecolor{color-detail}{gray}{0.40} % dark gray
\colorlet{color-title}{\theme} % black
% Set text color
\makeatletter
\newcommand{\globalcolor}[1]{\color{#1}\global\let\default@color\current@color}
\makeatother
\AtBeginDocument{\globalcolor{color-text}}
% Shorthand
\newcommand{\github}[1]{\href{https://github.com/#1/}{github.com/#1}}
\newcommand{\email}[1]{\href{mailto:#1}{#1}}
\newcommand{\website}[1]{\href{https://#1/}{#1}}
\newcommand{\linkedin}[1]{\href{https://www.linkedin.com/in/#1/}{#1}}
% Dummy environment
\newenvironment*{dummyenv}{}{}
% Inline heading
\newcommand{\headinginline}[2]{
\begin{minipage}[t]{0.50\textwidth}
\vspace*{\fill}
\Huge \textcolor{color-title}{#1}
\end{minipage}
\begin{minipage}[t]{0.45\textwidth}
\begin{flushright}
#2
\end{flushright}
\end{minipage}
}
% Photo heading
\newcommand{\headingphoto}[3]{
\begin{minipage}[t]{0.60\textwidth}
\begin{dummyenv}
\vspace*{\fill}
\Huge \textcolor{color-title}{#1}
\end{dummyenv}
\vspace{5mm}\\
#2
\end{minipage}
\begin{minipage}[t]{0.35\textwidth}
\begin{flushright}
\includegraphics[width=.5\linewidth,valign=t]{#3}
\end{flushright}
\end{minipage}
}
% Two-columns
\newcommand{\sidebyside}[2]{
\begin{multicols}{2}
#1 \columnbreak
#2 \end{multicols}
}
% Section titles
\titleformat{\section}{
\scshape\raggedright\Large\color{color-title}}{}{0em}{}[\color{color-title}\titlerule
\vspace{-\smallskipamount}]
% Footer
\fancyfoot[R]{Page \thepage \hspace{1pt} of \pageref{LastPage}}
% Lists
\newcommand{\outerlist}[1]{
\begin{itemize}[leftmargin=*] #1 \end{itemize}}
\newcommand{\denseouterlist}[1]{
\begin{itemize}[leftmargin=*,itemsep=0pt] #1 \end{itemize}}
\newcommand{\innerlist}[1]{
\begin{itemize}[topsep=0pt] #1 \end{itemize}}
\newcommand{\orderedouterlist}[1]{
\begin{enumerate}[leftmargin=*] #1 \end{enumerate}}
% List items
\newcommand{\entry}[1]{\item\small{#1}}
\newcommand{\entryextra}[1]{\textcolor{color-detail}{\entry{#1}}}
\newcommand{\entrylabeled}[2][]{\item[#1]\small{#2}}
\newcommand{\entrymid}[4][]{
\item[#1] \small{#2} \hfill \small{#3}
\vspace{-\smallskipamount} \item[]\small{\textit{#4}}}
\newcommand{\entrybig}[5][]{\item[#1]
\begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r}
#2 & #3 \\ {\small#4} & {\small #5} \\ \end{tabular*}}
% Fill year
\newcommand{\fillyear}[1]{\phantom{#1}}
% Make author name bold: https://tex.stackexchange.com/a/327046
\newcommand*{\boldname}[3]{%
\def\lastname{#1}%
\def\firstname{#2}%
\def\firstinit{#3}}
\boldname{}{}{}
\renewcommand{\mkbibnamegiven}[1]{%
\ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} }
{\mkbibbold{#1}}{#1}%
}
\renewcommand{\mkbibnamefamily}[1]{%
\ifboolexpr{ ( test {\ifdefequal{\firstname}{\namepartgiven}} or test {\ifdefequal{\firstinit}{\namepartgiven}} ) and test {\ifdefequal{\lastname}{\namepartfamily}} }
{\mkbibbold{#1}}{#1}%
}