\documentclass[a5paper,12pt]{article} \usepackage{myXsim} \date{Mars 2018} \title{Lire l'heure} \tribe{Sixième} \pagestyle{empty} \RequirePackage{contour} \newcommand{\clockA}[2]{% % colors \colorlet{minutes color}{blue!50!cyan!70!black} \colorlet{bg hours 0}{yellow} \colorlet{bg hours 1}{red!50} \colorlet{hours color}{red!80!black} % styles \tikzset{ minutes/.style={circle,inner sep=0,text width=5mm,align=center,font=\bfseries}, minutes 0/.style={fill=minutes color,text=white,minutes}, minutes 1/.style={text=minutes color,fill=white,minutes}, minutes font/.style={font=\normalsize}, hours/.style={font=\fontsize{60}{66}\selectfont\bfseries,text=hours color,align=center}, mini hours font/.style={font=\fontsize{40}{46}\selectfont\bfseries}, } % radii \def\bigradius{80mm} \def\minuteradius{75mm} \def\hourradius{60mm} \def\minihourminradius{25mm} \def\minihourmaxradius{45mm} \pgfmathsetmacro\minihourradius{(\minihourmaxradius + \minihourminradius)*.5} \def\hourwidth{2mm} \def\minutewidth{1mm} % big circle \filldraw [fill=white,draw=minutes color] (0,0) circle (\bigradius); % minutes marks \foreach \angle[count=\c from 0,evaluate={\c as \hourmark using notequal(int(mod(\c,5)),0)}] in {0,6,...,354}{ \path (-\angle:\minuteradius) node[minutes \hourmark]{\c}; } % hours marks \foreach \angle[count=\c from 1,evaluate={\c as \col using int(mod(\c,2))}] in {30,60,...,360}{ \path (-\angle:\hourradius) node[hours]{\c}; \path[fill=bg hours \col] (-\angle:\minihourminradius) -- (-\angle:\minihourmaxradius) arc(-\angle:-\angle-30:\minihourmaxradius) -- (-\angle-30:\minihourminradius) arc(-\angle-30:-\angle:\minihourminradius) -- cycle; \path (-\angle-15:\minihourradius pt) node[mini hours font]{\textcolor{white}{\contour{hours color}{\c}}}; } % hands \pgfmathsetmacro\hourangle{-#1*30-#2*.5} \pgfmathsetmacro\minuteangle{-#2*6} \fill[rotate=\hourangle,fill=hours color] ++(0,\hourwidth) arc(90:270:\hourwidth) -- ++(50mm,0) -- ++(\hourwidth,\hourwidth) -- ++(-\hourwidth,\hourwidth) -- ++(-50mm,0) -- cycle ; \fill[rotate=\minuteangle,fill=minutes color] ++(0,\minutewidth) arc(90:270:\minutewidth) -- ++(70mm,0) -- ++(\minutewidth,\minutewidth) -- ++(-\minutewidth,\minutewidth) -- ++(-70mm,0) -- cycle ; } \newcommand{\clockB}[2]{% \draw (0,0) circle (2cm); \foreach \angle / \label in {0/3, 30/2, 60/1, 90/12, 120/11, 150/10, 180/9, 210/8, 240/7, 270/6, 300/5, 330/4} { \draw (\angle:1.8cm) -- (\angle:2cm); \draw (\angle:1.4cm) node{\textsf{\label}}; } \foreach \angle[count=\c from 0] in {0,6,...,354} { \draw (\angle:1.9cm) -- (\angle:2cm); } \draw[rotate=90] (0,0) -- (-#1*30-#2*30/60:0.7cm); % hours \draw[rotate=90] (0,0) -- (-#2*6:1.2cm); % minutes \path [fill=black] (0,0) circle (3pt); \path [fill=red] (0,0) circle (1.5pt); } \begin{document} Donne les heures correspondantes à chacune des horloges. \vspace{4cm} \hspace{5cm} \begin{tikzpicture}[cap=round, rotate=90, transform canvas={scale=0.5}] \clockA{7}{30} \end{tikzpicture} \vspace{6cm} \hspace{2cm} \begin{tikzpicture}[cap=round, rotate=90, transform canvas={scale=0.3}] \clockA{15}{27} \end{tikzpicture} \hspace{6cm} \begin{tikzpicture}[cap=round, rotate=90, transform canvas={scale=0.3}] \clockA{9}{55} \end{tikzpicture} \vspace{4cm} \hspace{1cm} \begin{tikzpicture}[cap=round, transform canvas={scale=1}] \clockB{9}{5} \end{tikzpicture} \hspace{4cm} \begin{tikzpicture}[cap=round, transform canvas={scale=1}] \clockB{1}{15} \end{tikzpicture} \hspace{4cm} \begin{tikzpicture}[cap=round, transform canvas={scale=1}] \clockB{5}{30} \end{tikzpicture} \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: "master" %%% End: