几年前,我改编了 Overleaf 的简历模板来满足我的需求。但是,我觉得我陷入了困境。现在更改简历中的数据需要做很多工作。我看到了一些问题,但不知道如何解决:
LaTeX 代码大量使用了 TikZ:
- 流动文本需要手动水平和垂直定位、换行和斜体/强调。
- 日期需要手动定位
- 从圆圈 FontAwesome 图标向下延伸的彩色条需要手动调整长度。
- 类别和作业条目的整个样式是重复的,而不是使用某种分层命令。
main.tex
\documentclass[]{cv}
% \usepackage[dvipsnames,table,xcdraw]{xcolor}
\usepackage{tikz}
\usepackage{fontawesome}
% \usepackage{hyperref}
% \usepackage[margin=2.5cm]{geometry}
\begin{document}
\header{jack}{sparrow}{Ship Captain}
\begin{tikzpicture}
\usetikzlibrary{shapes}
% Global styling
\tikzstyle{every label}=[label distance=3pt, ]
\tikzstyle{every path}=[draw, out=90, in=-90]
% Schemes
\tikzstyle{section}=[inner sep=5pt, minimum size=20pt, circle]
\tikzstyle{endsection}=[inner sep=0pt, draw=none]
\node[section, label={0:\LARGE experience}, draw=red] (experience) at (0,0) {\LARGE \textcolor{black}{\faDesktop}};
\node[endsection] (endexperience) at (0,-7.7) {};
\path[draw=red] (experience) to[out=-90,in=90] (endexperience);
\node[
label={left:as of Oct 2003},
label={right:\large Advanced Ship Captain, \normalsize \emph{Black Pearl}}
] (blackpearl) at (3,-1) {};
\node[
label={[align=left]right:Covert intelligence operations for national security.\\Infiltration from high-risk environments.}
] (blackpearl) at (3.2,-1.7) {};
\node[
label={left:1917\,-\,1920},
label={right:\large Ship Captain, \normalsize \emph{Gray Pearl}}
] (graypearl) at (3,-3) {};
\node[
label={[align=left]right:Covert intelligence operations for national security.\\Utilization of advanced espionage techniques and gadgets.\\Surveillance, analysis, and threat prevention.}
] (graypearl2) at (3.2,-3.9) {};
\node[
label={left:Jan-May 1962},
label={right:\large Ship Captain, \normalsize \emph{White Pearl Solutions Ltd.}}]
(whitepearl) at (3,-5.2) {};
\node[
label={[align=left]right:Part of a project team;\\Trained extensively in planning and executing covert operations and infiltrating high-security areas.}]
(whitepearl2) at (3.2,-5.9) {};
\node[
label={left:1968\,-\,1973},
label={right:Working student Secret Agent, \normalsize \emph{Colorless Pearl United}}]
(colorlesspearl) at (3,-6.8) {};
\node[
label={left:1870\,-\,1980},
label={right:Tutor for Secret Operations Team, \normalsize \emph{MI6 Training Facility,}}]
(university) at (3,-7.4) {};
\end{tikzpicture}
\vspace{0.2cm}
\begin{tikzpicture}
\usetikzlibrary{shapes}
% Global styling
\tikzstyle{every label}=[label distance=3pt, ]
\tikzstyle{every path}=[draw, out=90, in=-90]
% Schemes
\tikzstyle{section}=[inner sep=5pt, minimum size=20pt, circle]
\tikzstyle{endsection}=[inner sep=0pt, draw=none]
\node[section, label={0:\LARGE education}, draw=black] (education) at (0,0) {\LARGE \textcolor{red}{\faGraduationCap}};
\node[endsection] (endeducation) at (0,-2.5) {};
\path[draw=black] (education) to[out=-90,in=90] (endeducation);
\node[
label={left:1960},
label={right:\large M.Sc. Secretive Operations, \normalsize \emph{MI6 Intelligence Agency}}]
(master) at (3,-1) {};
\node[
label={left:1950},
label={right:\large B.Sc. Secretive Operations, \normalsize \emph{MI6 Intelligence Agency}}]
(master) at (3,-2) {};
\end{tikzpicture}
\begin{tikzpicture}
\usetikzlibrary{shapes}
% Global styling
\tikzstyle{every label}=[label distance=3pt, ]
\tikzstyle{every path}=[draw, out=90, in=-90]
% Schemes
\tikzstyle{section}=[inner sep=5pt, minimum size=20pt, circle]
\tikzstyle{endsection}=[inner sep=0pt, draw=none]
\node[section, label={0:\LARGE skills}, draw=red] (skills) at (0,0) {\LARGE \textcolor{black}{\faConnectdevelop}};
\node[endsection] (endskills) at (0,-1.7) {};
\path[draw=red] (skills) to[out=-90,in=90] (endskills);
\node[
label={right:Espionage Techniques, Surveillance, Java, Combat Training, Infiltration, Adaptability, Kubernetes}]
(skill-names) at (1.5,-1) {};
\end{tikzpicture}
\vspace{0.2cm}
\begin{tikzpicture}
\usetikzlibrary{shapes}
% Global styling
\tikzstyle{every label}=[label distance=3pt, ]
\tikzstyle{every path}=[draw, out=90, in=-90]
% Schemes
\tikzstyle{section}=[inner sep=5pt, minimum size=20pt, circle]
\tikzstyle{endsection}=[inner sep=0pt, draw=none]
\node[section, label={0:\LARGE interests}, draw=black] (interests) at (0,0) {\LARGE \textcolor{red}{\faCubes}};
\node[endsection] (endinterests) at (0,-1.7) {};
\path[draw=black] (interests) to[out=-90,in=90] (endinterests);
\node[
label={right:Problem Solving, Teamwork, Adaptability, Question Asking}]
(raspi) at (1.5,-1) {};
\end{tikzpicture}
\vspace{0.2cm}
\begin{tikzpicture}
\usetikzlibrary{shapes}
% Global styling
\tikzstyle{every label}=[label distance=3pt, ]
\tikzstyle{every path}=[draw, out=90, in=-90]
% Schemes
\tikzstyle{section}=[inner sep=5pt, minimum size=20pt, circle]
\tikzstyle{endsection}=[inner sep=0pt, draw=none]
\node[section, label={0:\LARGE contact}, draw=red] (contact) at (0,0) {\LARGE \textcolor{black}{\faAt}};
\node[endsection] (endcontact) at (0,-3.7) {};
\path[draw=red] (contact) to[out=-90,in=90] (endcontact);
\node[
label={right:James Bond}]
(mail) at (1.5,-1) {};
\node[
label={right:MI6 Headquarters, London, United Kingdom}]
(mail) at (1.5,-1.5) {};
\node[
label={right:Some more text}]
(mail) at (1.5,-2) {};
\node[
label={right:\href{mailto:[email protected]}{[email protected]}}]
(mail) at (1.5,-2.5) {};
\node[
label={right:+44 2071 2345 67}]
(phone) at (1.5,-3) {};
\node[
label={right:\href{https://www.linkedin.com/profile}{linkedin} / \href{https://www.xing.com/profile/James_Bond}{xing}}]
(linkedin) at (1.5,-3.5) {};
\end{tikzpicture}
\end{document}
部分样式是在类文件中定义的。有一些死代码,尤其是关于参考书目的代码,但将其完全丢弃会破坏构建。
cv.cls
\ProvidesClass{cv}[28.11.2019 CV class]
\NeedsTeXFormat{LaTeX2e}
\DeclareOption{print}{\def\@cv@print{}}
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}%
}
\ProcessOptions\relax
\LoadClass{article}
%%%%%%%%%%
% Colors %
%%%%%%%%%%
\RequirePackage[dvipsnames,table,xcdraw]{xcolor}
\definecolor{white}{RGB}{255,255,255}
\definecolor{darkgray}{HTML}{333333}
\definecolor{gray}{HTML}{4D4D4D}
\definecolor{lightgray}{HTML}{999999}
\definecolor{futureblue}{HTML}{3A86B7}
\definecolor{green}{HTML}{C2E15F}
\definecolor{orange}{HTML}{FF7900}
\definecolor{purple}{HTML}{D3A4F9}
\definecolor{red}{RGB}{217, 24, 40}
% \definecolor{blue}{HTML}{6CE0F1}
\ifdefined\@cv@print
\colorlet{green}{gray}
\colorlet{orange}{gray}
\colorlet{purple}{gray}
\colorlet{brown}{gray}
\colorlet{red}{gray}
% \colorlet{blue}{gray}
\colorlet{fillheader}{white}
\colorlet{header}{gray}
\else
\colorlet{fillheader}{red}
\colorlet{header}{white}
\fi
\colorlet{textcolor}{gray}
\colorlet{headercolor}{gray}
%%%%%%%%%
% Fonts %
%%%%%%%%%
\RequirePackage[quiet]{fontspec}
\newfontfamily\bodyfont[]{Roboto}
\newfontfamily\thinfont[]{Roboto Thin}
\newfontfamily\headingfont[]{Roboto}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{Roboto}
%\setmathfont{XITS Math}
%%%%%%%%%%
% Header %
%%%%%%%%%%
\RequirePackage{tikz}
\newcommand{\rolefont}{%
\fontsize{14pt}{24pt}\selectfont%
\thinfont%
\color{white}%
}
\newcommand{\header}[3]{%
\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, fill=fillheader, anchor=north, minimum width=\paperwidth, minimum height=4cm] (box) at (current page.north){};
% \node[anchor=west, circle, draw=white,
% path picture={
% \node at (path picture bounding box.center) {
% \includegraphics[width=4cm]{profile}
% };
% };
% ] {asd};
\node[circle, minimum size=3cm,
path picture={
\node at (path picture bounding box.center){
\includegraphics[width=3cm]{james_bond_avatar.png}
};
}] (pic) at (0.75,0.4) {};
% \node (brush) at (12.6,0.25) {
% \includegraphics[width=3.7cm]{brush}
% };
\node [anchor=center] (name) at (box) {
\fontsize{40pt}{300pt}\color{header}
{\thinfont #1}{\bodyfont #2}
};
% \node [anchor=east] (vorname) at (box) {%
% \fontsize{40pt}\color{header}%
% {\thinfont #1}
% };
% \node [anchor=west] (nachname) at (box) {%
% \fontsize{140pt}\color{header}%
% {\takota #2}
% };
\node [anchor=north] at (name.south) {%
\fontsize{14pt}{24pt}\color{header}%
\thinfont #3%
};
\end{tikzpicture}
\vspace{2.5cm}
\vspace{-2\parskip}
}
%%%%%%%%%%%%%
% Structure %
%%%%%%%%%%%%%
\RequirePackage{parskip}
\newcounter{colorCounter}
\def\@sectioncolor#1#2#3{%
{%
\color{%
\ifcase\value{colorCounter}%
blue\or%
red\or%
orange\or%
green\or%
purple\or%
brown\else%
headercolor\fi%
} #1#2#3%
}%
\stepcounter{colorCounter}%
}
\renewcommand{\section}[1]{
\par\vspace{\parskip}
{%
\LARGE\headingfont%
% \@sectioncolor
#1%
}
\par\vspace{\parskip}
}
% \renewcommand{\subsection}[1]{
% \par\vspace{.5\parskip}%
% {\Large\headingfont\color{headercolor} #1}
% \par\vspace{.25\parskip}%
% }
% \renewcommand{\subsubsection}[2]{
% \par\vspace{.5\parskip}%
% {\Large\headingfont\color{headercolor} #2}
% \par\vspace{.25\parskip}%
% }
\pagestyle{empty}
%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%
\RequirePackage[style=verbose, maxnames=99, sorting=ydnt]{biblatex}
\DeclareFieldFormat[article]{title}{#1\par}
\DeclareFieldFormat[book]{title}{#1\par}
\DeclareFieldFormat[inproceedings]{title}{#1\par}
\DeclareFieldFormat[misc]{title}{#1\par}
\DeclareFieldFormat[report]{title}{#1\par}
\DeclareBibliographyDriver{article}{%
\printfield{title}%
\newblock%
\printnames{author}%
\par%
\newblock%
{%
\footnotesize\addfontfeature{Color=lightgray}\itshape%
\usebibmacro{journal+issuetitle}%
\setunit{\space}%
\printfield{pages}%
\newunit%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\printfield{year}%
\newunit%
}
\par\vspace{0.3\baselineskip}
}
\DeclareBibliographyDriver{book}{%
\printfield{title}%
\newblock%
\printnames{author}%
\par%
\newblock%
{%
\footnotesize\addfontfeature{Color=lightgray}\itshape%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\printfield{note}%
\setunit*{\addcomma\space}%
\printfield{year}%
\setunit{\addcomma\space}%
\printlist{location}%
\newunit%
}
\par\vspace{0.3\baselineskip}
}
\DeclareBibliographyDriver{inproceedings}{%
\printfield{title}%
\newblock%
\printnames{author}%
\par%
\newblock%
{%
\footnotesize\addfontfeature{Color=lightgray}%
\printfield{booktitle}%
\setunit{\addcomma\space}%
\printfield{year}%
\setunit{\addcomma\space}%
\printlist{location}%
\newunit%
}
\par\vspace{0.3\baselineskip}
}
\DeclareBibliographyDriver{misc}{%
\printfield{title}%
\newblock%
\printnames{author}%
\par%
\newblock%
{%
\footnotesize\addfontfeature{Color=lightgray}\itshape%
\printfield{booktitle}%
\setunit*{\addcomma\space}%
\printfield{note}%
\setunit*{\addcomma\space}%
\printfield{year}%
\setunit{\addcomma\space}%
\printlist{location}%
\newunit%
}
\par\vspace{0.3\baselineskip}
}
\DeclareBibliographyDriver{report}{%
\printfield{title}%
\newblock%
\printnames{author}%
\par%
\newblock%
{%
\footnotesize\addfontfeature{Color=lightgray}\itshape%
\printfield{type}%
\setunit{\space}%
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{year}%
\newunit%
}
\par\vspace{0.3\baselineskip}
}
\DeclareNameFormat{author}{%
\small\addfontfeature{Color=lightgray}%
}
\defbibheading{bibheading}[\bibname]{%
\subsubsection*{#1}
\markboth{#1}{#1}
}
\newcommand{\printbibsection}[2]{
\begin{refsection}
\nocite{*}
\printbibliography[sorting=chronological, type={#1}, title={#2}, heading=bibheading]
\end{refsection}
}
\DeclareSortingTemplate{chronological}{
\sort[direction=descending]{\field{year}}
\sort[direction=descending]{\field{month}}
}
%%%%%%%%%%%%%%%%
% Other tweaks %
%%%%%%%%%%%%%%%%
\RequirePackage[left=1.5cm,top=2cm,right=1.5cm,bottom=0.5cm,nohead,nofoot]{geometry}
\RequirePackage{hyperref}
% \definecolor{mycolor}{HTML}{00b5be}
% \colorlet{myurlcolor}{Aquamarine}
\hypersetup{
colorlinks=true,
urlcolor=xitasored,
filecolor=xitasored
}
% A fix for \href{}{} colors not working with fontspec
\makeatletter
\def\HyColor@@@@UseColor#1\@nil{\addfontfeatures{Color=#1}}
\makeatother
我不知道如何摆脱 TikZ 的流动文本,或者嵌入某种“普通”的 LaTeX,以便自动换行、边距等。这可能还会改善读者尝试复制粘贴时文本突出显示的方式。
欢迎任何指点。
我将其用作占位符图像,请参见\includegraphics[width=3cm]{james_bond_avatar.png}
:
https://ibb.co/cy2G3tr
我使用 VSCode/LaTeX Workshop,它运行LatexMk
并输出:
Running 'xelatex -no-pdf -synctex=1 -interaction=nonstopmode -file-line-error -recorder "...path/main.tex"'