以下是一篇旧帖子: 文本中的内嵌图形表示简历中语言技能的加载栏
我尝试调整代码以得到半填充的圆形步骤,但是失败了......
我的.cls 文件代码:
\newcommand{\cvskill}[2]{%
\textcolor{emphasis}{\textbf{#1}}\hfill
\foreach \x in {1,...,5}{%
\space{\ifnumgreater{\x}{#2}{\color{body!30}}{\color{accent}}\ratingmarker}}\par%
}
我的.tex 文件代码:
\cvskill{German}{5}
\divider
\cvskill{English}{4}
\divider
\cvskill{French}{3}
\divider
\cvskill{Spanish}{1}
完整代码:https://www.overleaf.com/read/rgskjktntgdf
有人可以帮帮我吗?
谢谢,安德烈亚斯
答案1
我已经将你的链接问题概括为任意浮点值。
要将其合并到您的文档中,请将其粘贴到\begin{document}
:
\makeatletter
\newcommand*{\fsize}{\dimexpr\f@size pt\relax}
\makeatother
\newcommand{\pointslong}[6]{%
\pgfmathtruncatemacro\floored{#1}%
\pgfmathsetmacro\diff{#1-\floored}%
\newdimen\diffDim%
\diffDim = \diff pt%
\newdimen\numPointsDim
\numPointsDim = #1 pt
\newdimen\maxPointsDim%
\maxPointsDim = #2 pt%
\begin{tikzpicture}[baseline, yshift=0.5*\fsize]
\foreach \x in {1, ..., #2}{
\ifnum \x > \floored \relax%
\def\fillCol{#6}%
\else%
\def\fillCol{#5}%
\fi%
\fill[\fillCol] (#3*\x, 0) circle (#4);
}%
\ifdim \diffDim > 0 pt \relax%
\ifdim \numPointsDim > \maxPointsDim \relax%
\else%
\pgfmathsetmacro\pos{#3*(\floored+1)}%
\begin{scope}[xshift=\pos]
\clip (-#4,-#4) rectangle ++(#4*2*\diff,#4*2);
\fill[#5] (0, 0) circle (#4);
\end{scope}
\fi%
\else%
\fi%
\end{tikzpicture}%
}
\newcommand{\points}[1]{%
\pointslong%
{#1}% skill level
{5}% max number of points: 5
{12pt}% spacing between points
{4pt}% circle radius
{accent}% color for filled points
{body!30}% color for empty points
}
\renewcommand{\cvskill}[2]{%
\textcolor{emphasis}{\textbf{#1}}\hfill\points{#2}\par%
}