我对 LaTeX 还很陌生,我用的是模板提供创建我的简历与类altacv
。为了展示我的语言技能,你提供\cvskill
如下定义:
\newcommand{\cvskill}[2]{%
\textcolor{emphasis}{\textbf{#1}}\hfill
\foreach \x in {1,...,5}{%
\space{\ifnumgreater{\x}{#2}{\color{body!30}}{\color{accent}}\ratingmarker}}\par%
}
结果如下:
我想添加我的英语水平,值为 4.5,这样最后一个圆圈就填了一半。我发现这但我无法在我的模板中成功实现它。基本上我想要的是当我输入时:
\cvskill{English}{4.5}
我得到以下信息:
提前致谢 :)
答案1
那么您可以合并链接问题中的命令\cvskill
和使用的命令\grade
来寻找可能的解决方案。
基于这两者,您可以将以下代码添加到您的序言中:
% <============================================================ new code
\renewcommand{\cvskill}[2]{%
\textcolor{emphasis}{\textbf{#1}}\hfill
\grade{#2}
}
\definecolor{frontColor}{rgb}{0.22,0.45,0.70}% light blue
\definecolor{backColor}{RGB}{200,200,200}% grey
\newcommand{\grade}[1]{%
\begin{tikzpicture}
\clip (1em-.4em,-.35em) rectangle (5em +.5em ,1em);
\foreach \x in {1,2,...,5}{
\path[{fill=backColor}] (\x em,0) circle (.35em);
}
\begin{scope}
\clip (1em-.4em,-.35em) rectangle (#1em +.5em ,1em);
\foreach \x in {1,2,...,5}{
\path[{fill=frontColor}] (\x em,0) circle (.35em);
}
\end{scope}
\end{tikzpicture}%
}
完整代码如下(MWE)
\documentclass[10pt,a4paper]{altacv}
%Layout
\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm,footskip=2\baselineskip}
%Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[default]{lato}
\usepackage{CJKutf8}
\usepackage{hyperref}
%Colors
\definecolor{accent}{HTML}{000e17}
\definecolor{heading}{HTML}{000e17}
\definecolor{emphasis}{HTML}{696969}
\definecolor{body}{HTML}{01415f}
\colorlet{heading}{heading}
\colorlet{accent}{accent}
\colorlet{emphasis}{emphasis}
\colorlet{body}{body}
\renewcommand{\itemmarker}{{\small\textbullet}}
\renewcommand{\ratingmarker}{\faCircle}
% <============================================================ new code
\renewcommand{\cvskill}[2]{%
\textcolor{emphasis}{\textbf{#1}}\hfill
\grade{#2}
}
\definecolor{frontColor}{rgb}{0.22,0.45,0.70}% light blue
\definecolor{backColor}{RGB}{200,200,200}% grey
\newcommand{\grade}[1]{%
\begin{tikzpicture}
\clip (1em-.4em,-.35em) rectangle (5em +.5em ,1em);
\foreach \x in {1,2,...,5}{
\path[{fill=backColor}] (\x em,0) circle (.35em);
}
\begin{scope}
\clip (1em-.4em,-.35em) rectangle (#1em +.5em ,1em);
\foreach \x in {1,2,...,5}{
\path[{fill=frontColor}] (\x em,0) circle (.35em);
}
\end{scope}
\end{tikzpicture}%
}
\begin{document}
\cvsection[%
% page1sidebar % <================================== not needed for demo
]{Experience}
\cvevent{COO - Chief Operating Officer}{Evoleo Technologies, Lda}{April 2016 -- Ongoing}{Porto, Portugal}
\begin{itemize}
\item Operational management in the areas of development, production and logistics;
\end{itemize}
\divider
%
\cvsection{Languages}
\cvskill{English}{5}
\divider
\cvskill{Spanish}{4.5} % <==============================================
\divider
\cvskill{German}{3}
\end{document}
得到结果:
下次请在您的问题中添加 MWE,不要使用链接!