I am trying to have 5 circles in a row filled with either darkgray or lightlightgray or half-filled (to indicate skill level on a CV).
This all works fine as long as I use rotations of (multiples of) 90 degrees, but if I use other rotation in between, different things happen.
EDIT: i updated the code to make it standalone
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\newcommand{\lc}{\tikz\draw[lightgray,fill=lightgray] (0,0) circle (.8ex); }
\newcommand{\dc}{\tikz\draw[darkgray,fill=darkgray] (0,0) circle (.8ex); }
\def\AngleA{0}
\newcommand{\hc}{\begin{tikzpicture}
\draw [lightgray, fill=lightgray] (0,0) coordinate (a) arc (\AngleA+90:\AngleA-90:.8ex) ;
\draw [darkgray, fill=darkgray] (a) arc (\AngleA+90:\AngleA+270:.8ex) ;
\end{tikzpicture}
}
\def\AngleB{45}
\newcommand{\hcb}{\begin{tikzpicture}
\draw [lightgray, fill=lightgray] (0,0) coordinate (a) arc (\AngleB+90:\AngleB-90:.8ex) ;
\draw [darkgray, fill=darkgray] (a) arc (\AngleB+90:\AngleB+270:.8ex) ;
\end{tikzpicture}
}
\def\Rotation{45}
\newcommand{\hcc}{\begin{tikzpicture}
\draw [lightgray, fill=lightgray, transform canvas={rotate=\Rotation}] (0,0) coordinate (a) arc (90:-90:.8ex) ;
\draw [darkgray, fill=darkgray, transform canvas={rotate=\Rotation}] (a) arc (90:270:.8ex);
{\rotate{45}}
\end{tikzpicture}
}
\begin{document}
aligning circles\newline
\dc\dc\hc\lc\lc hc\newline
\dc\dc\hcb\lc\lc hcb\newline
\dc\dc\hcc\lc\lc hcc
\end{document}
In this case, lc
, dc
, and hc
are my empty, full, and half-full circles. For the half-full circles, I use two arcs to make two touching semicircles. hcb
and hcc
my attempts at rotating the half-full circles, but neither is formatted as I intend.
For hcb
, I changing the beginning and end of the arcs. Here, the bounding box of the circle rotates along with the circle so that everything else gets shifted to the right. The shift is pretty small, but enough to mess up the layout (I get the same effect if I instead specify rotate=45
behind the fill-color).
For hcc
, I use transform canvas
to rotate the semicircles, but it is now shifted around some point other than the center of the circle. (I have tried using transform shape
instead, bit this did not result in any rotation at all).
I am not sure whether I am using the correct way top rotate these and forgetting to add some parameter or whether I should use a completely different way to rotate.
(In the image I drew the red boxes externally to illustrate the problem, because I don't know how to do that in tex)