Search In This Website

Kamis, 09 Oktober 2025

Draw Analog Clock In Latex

1. type this in Latex editor

% !TEX TS-program=pdflatex

\documentclass{article}

\usepackage{tikz}

\usepackage{parskip}

\usepackage{fourier}

\usepackage{tgbonum}

\usepackage{bm}


\usepackage[active,tightpage,varwidth]{preview}

\PreviewEnvironment{tikzpicture}

\setlength\PreviewBorder{0.25pt}


\begin{document}

\LARGE{}

\boldmath


%% draw nine o'clock

\begin{tikzpicture}[line cap=rect,line width=3pt,scale=3]

%% draw clock face circle

\filldraw [fill=gray!30] (0,0) circle [radius=2cm];

%% draw small tick line and the hour number of time

\foreach \angle [count=\xi] in {60,30,...,-270}

{

\draw[line width=1.5pt] (\angle:1.8cm) -- (\angle:2cm);

\node[font=\Huge] at (\angle:1.36cm) {$\textsf{\xi}$};

}


%% Part III TikZ ist kein Zeichenprogramm > 13 Specifying Coordinates > 13.2 Coordinate Systems > 13.2.3 Node Coordinate System

%% /tikz/cs/angle=<degrees>

%% draw big tick line and long tick line

\foreach \angle in {0,90,180,270}

\draw[line width=4pt] (\angle:1.6cm) -- (\angle:1.98cm);


%% Part III TikZ ist kein Zeichenprogramm > 16 Arrows >

%% 16.3.1 Size

%% draw short arm clock

\draw [line width=4pt,arrows=-stealth] (0,0) -- (180:0.85cm);

%% draw long arm clock

\draw [line width=4pt,arrows=-stealth](0,0) -- (90:1.15cm);

\end{tikzpicture}


%% 17.2.3 Common Options: Separations, Margins, Padding and Border Rotation

%% /pgf/shape border rotate=<angle>

\end{document}

2. Compile or build

3. Output similar like below




<< back to Study About Draw In Latex


Tidak ada komentar:

Posting Komentar