为 Friggeri 简历/履历中的某个部分添加另一种颜色

为 Friggeri 简历/履历中的某个部分添加另一种颜色

所以我使用无用的简历模板来写我的简历。它看起来像这样:

在此处输入图片描述

可以在这里找到:

http://www.latextemplates.com/template/friggeri-resume-cv

如您所见,所有部分都以漂亮的颜色的前三个字母开头。但是,文件中.cls只有六种定义的颜色。我希望有七个部分,并且希望第七个部分也有颜色。我尝试使用以下代码添加深蓝色:

\definecolor{darkblue}{HTML}{0000FF}

在开始处,并在此处添加深蓝色:

\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{darkblue}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}

并在此处添加深蓝色:

\newcounter{colorCounter}
\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        darkblue\or%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}

但当我尝试添加一个部分时,出现错误,提示未定义颜色深蓝色。我做错了什么?除了这种方式之外,没有其他颜色被声明。

答案1

颜色列表由控制\@sectioncolor,这只是使用\ifcase;这是原始定义:

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

您可以简单地定义颜色并将其添加到列表中。在下面的示例中,我使用以下代码定义了两种新颜色:青色和黄色

\definecolor{teal}{HTML}{008080}
\definecolor{yellow}{HTML}{FFFF00}
\makeatletter
\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\or%
        teal\or%
        yellow\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}
\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{teal}{gray}
  \colorlet{yellow}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}
\else
  \colorlet{fillheader}{gray}
  \colorlet{header}{white}
\fi
\makeatother

代码:

\documentclass[]{friggeri-cv} % Add 'print' as an option into the square bracket to remove colors from this template for printing

\addbibresource{bibliography.bib} % Specify the bibliography file to include publications

\definecolor{teal}{HTML}{008080}
\definecolor{yellow}{HTML}{FFFF00}

\makeatletter
\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\or%
        teal\or%
        yellow\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}
\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{teal}{gray}
  \colorlet{yellow}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}
\else
  \colorlet{fillheader}{gray}
  \colorlet{header}{white}
\fi
\makeatother

\begin{document}

\header{john}{smith}{junior business analyst} % Your name and current job title/field

%----------------------------------------------------------------------------------------
%   SIDEBAR SECTION
%----------------------------------------------------------------------------------------

\begin{aside} % In the aside, each new line forces a line break
\section{contact}
123 Broadway
City, State 12345
Country
~
+0 (000) 111 1111
+0 (000) 111 1112
~
\href{mailto:[email protected]}{[email protected]}
\href{http://www.smith.com}{http://www.smith.com}
\href{http://facebook.com/johnsmith}{fb://jsmith}
\section{languages}
english mother tongue
spanish \& italian fluency
\section{programming}
{\color{red} $\varheartsuit$} JavaScript
Python, C++, PHP
CSS3 \& HTML5
\end{aside}

\section{education}

\section{experience}

\section{awards}

\section{communication skills}

\section{interests}

\section{publications}

\section{another section}

\section{yet another section}

\end{document}

输出:

在此处输入图片描述

如果要在中进行修改.cls file,请复制一份friggeri-cv.cls,将其另存为myfiggeri-cv.cls,然后在这个新文件中更改行

\ProvidesClass{friggeri-cv}[2012/04/30 CV class]

\ProvidesClass{myfriggeri-cv}[2012/04/30 CV class]

下一个更改

\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}{gray}
  \colorlet{header}{white}
\fi

\definecolor{teal}{HTML}{008080}
\definecolor{yellow}{HTML}{FFFF00}

\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{teal}{gray}
  \colorlet{yellow}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}
\else
  \colorlet{fillheader}{gray}
  \colorlet{header}{white}
\fi

最后,改变

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

\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\or%
        teal\or%
        yellow\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}

保存更改并将myfriggeri-cv.cls其放置在 TeX 可以找到的地方(最简单的是当前工作目录);.tex现在在你的文档中说

\documentclass{myfriggeri-cv}

相关内容