summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/analogclock
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/analogclock
Initial commit
Diffstat (limited to 'macros/latex/contrib/analogclock')
-rw-r--r--macros/latex/contrib/analogclock/README19
-rw-r--r--macros/latex/contrib/analogclock/analogclock-doc.pdfbin0 -> 78418 bytes
-rw-r--r--macros/latex/contrib/analogclock/analogclock-doc.tex105
-rw-r--r--macros/latex/contrib/analogclock/analogclock.sty177
-rw-r--r--macros/latex/contrib/analogclock/clock.ttfbin0 -> 13856 bytes
5 files changed, 301 insertions, 0 deletions
diff --git a/macros/latex/contrib/analogclock/README b/macros/latex/contrib/analogclock/README
new file mode 100644
index 0000000000..225ec66ed0
--- /dev/null
+++ b/macros/latex/contrib/analogclock/README
@@ -0,0 +1,19 @@
+Package name: analogclock (The LaTeX analogclock)
+Package authors: Luis Randez, Juan I. Montijano
+Version/Release: 2.0
+
+Features:
+
+The analogclock LATEX package allows the users to insert into a LATEX generated
+pdf document a ticking analog clock showing the time at the moment
+when the document is being reading.
+The clock gives dynamically hours and minutes.
+
+
+Installation:
+
+-Copy the package file analogclock.sty to a directory where LATEX can find it.
+-Install clock.ttf font (by copying this file to the windows/fonts directory)
+
+
+December 2008 \ No newline at end of file
diff --git a/macros/latex/contrib/analogclock/analogclock-doc.pdf b/macros/latex/contrib/analogclock/analogclock-doc.pdf
new file mode 100644
index 0000000000..f4909bc412
--- /dev/null
+++ b/macros/latex/contrib/analogclock/analogclock-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/analogclock/analogclock-doc.tex b/macros/latex/contrib/analogclock/analogclock-doc.tex
new file mode 100644
index 0000000000..7b30672e60
--- /dev/null
+++ b/macros/latex/contrib/analogclock/analogclock-doc.tex
@@ -0,0 +1,105 @@
+\documentclass[12pt]{article}
+\usepackage[timeinterval=29]{analogclock}
+
+\title{\texttt{analogclock} v1.0: An analog clock with PDF\LaTeX}
+\author{Luis R\'{a}ndez \& Juan I. Montijano}
+%\address[IUMA]{IUMA \\ Universidad de Zaragoza }
+\date{IUMA -- Universidad de Zaragoza\\[6pt] \{monti,randez\}@unizar.es\\[6pt] \today}
+
+\begin{document}
+
+\maketitle
+
+
+\initclock % This must be used one time to initialize the clock
+
+\section{The package}
+The \texttt{analogclock} \LaTeX\/ package
+allows the users to insert into a \LaTeX\/ generated pdf document
+a ticking analog clock showing the time at the moment when the document
+is being reading, such as the one next:
+
+\centerline{\Large\analogclock}
+
+The clock gives dynamically hours and minutes.
+
+The package is loaded by \texttt{$\backslash$usepackage[timeinterval=$n$]\{analogclock\}},
+$n$ being any positive integer. The clock will update its internal status every $n$ seconds. Thus, if we load
+the package with the option [timeinterval=120], the clock will change every 2 minutes.
+The default time interval is set to 29 seconds.
+
+Note that for low values of $n$ the memory used by Adobe increases while the document remains opened and can
+become very high. Then values of $n$ below 10 is not recommended.
+
+The package is based on javascript code embedded into the pdf document. It uses a special font clock.ttf obtained
+converting, with FontForge software, the metafont clock.mf by Oliver Corff (\TeX\/ Clock package).
+
+\section{Restrictions--requirements}
+The package requires hyperref, xkeyval, xcolor and tikz packages.
+
+By now, since it uses a ttf font, the package only works under windows. We have not been able to make it
+work on Linux. Any help will be welcomed.
+
+Once the pdf document is generated, in order to view the clock in another computer, the clock.ttf must be installed
+on it. Otherwise the clock will appear incomplete. We have not been able to embed the font in the pdf document
+so that it can be used by javascript code. Any help will be welcomed.
+
+The package works with PDF\LaTeX\/. The document generated through \LaTeX\/$\to$DviPs$\to$Ps2pdf or
+\LaTeX\/$\to$Dvipdfm does not display the hands of the clock.
+
+\section{Installation}
+Copy the package file analogclock.sty to a directory where \LaTeX\/ can find it.
+Install clock.ttf font (by copying this file to the windows/fonts directory)
+
+\section{Getting the package}
+
+The package can be downloaded at http://pcmap.unizar.es/numerico/software
+
+\section{Macros}
+
+The clock must be initialized with \texttt{$\backslash$initclock}, usually at the beginning of the document, after
+\texttt{$\backslash$begin\{document\}}.
+
+The main macro \texttt{$\backslash$analogclock} displays an analog clock colored with the current text color.
+The size also depends on the current font size. Thus, you can change the size and color for example with
+
+\texttt{$\backslash$centerline\{$\backslash$textcolor\{blue\}\{$\backslash$Huge $\backslash$analogclock\}\}}
+
+you get
+
+\centerline{\textcolor{blue}{\Huge \analogclock}}
+
+There is another macro, \texttt{$\backslash$clocksizefactor\{``factor''\}}, that increases the size of the clock
+by a desired factor. To set the size of the clock to its original size, use
+\texttt{$\backslash$clocksizefactor\{1\}}
+
+The macro \texttt{$\backslash$faceclock\{$m$\}\{``face color''\}} sets the type and the background color of the clock face, as shown in the table below. The type $m$ must be an integer number. If $m<0$ the clock is not framed, else it is framed. The absolute value of $m$ gives the (four) possible faces. About the face color, it can be used any color allowed in xcolor package. If it is left empty, then a transparent face color is used.
+
+\bigskip
+\centerline{Analog clock macros}
+\begin{tabular}{|l|c|l|}
+\hline
+macro & result & action \\
+\hline
+ $\backslash$initclock & & initialize clock \\ \hline
+ $\backslash$analogclock & \analogclock & clock \\ \hline
+ $\backslash$faceclock\{``face type''\}\{``face color''\} & & sets face clock \\ \hline
+ $\backslash$faceclock\{-1\}\{\} $\backslash$analogclock & \faceclock{-1}{}\analogclock & first face (no frame) \\ \hline
+ $\backslash$faceclock\{1\}\{\} $\backslash$analogclock & \faceclock{1}{}\analogclock & first face (with frame) \\\hline
+ $\backslash$faceclock\{-2\}\{red\} $\backslash$analogclock & \faceclock{-2}{red}\analogclock & second face (no frame) \\ \hline
+ $\backslash$faceclock\{2\}\{red\} $\backslash$analogclock & \faceclock{2}{red}\analogclock & second face (with frame) \\\hline
+ $\backslash$faceclock\{-3\}\{white\} $\backslash$analogclock & \faceclock{-3}{white}\analogclock & third face (no frame) \\\hline
+ $\backslash$faceclock\{3\}\{white\} $\backslash$analogclock & \faceclock{3}{white}\analogclock & third face (with frame) \\\hline
+ $\backslash$faceclock\{-4\}\{pink\}$\backslash$analogclock & \faceclock{-4}{pink}\analogclock & no face (no frame) \\\hline
+ $\backslash$faceclock\{4\}\{pink\} $\backslash$analogclock & \faceclock{4}{pink}\analogclock & no face (with frame) \\\hline
+ $\backslash$clocksizefactor\{``factor''\} & \clocksizefactor{2.5}\analogclock & amplification factor \\\hline
+\end{tabular}
+
+
+\end{document}
+
+
+
+\end{frame}
+
+
diff --git a/macros/latex/contrib/analogclock/analogclock.sty b/macros/latex/contrib/analogclock/analogclock.sty
new file mode 100644
index 0000000000..93d9426515
--- /dev/null
+++ b/macros/latex/contrib/analogclock/analogclock.sty
@@ -0,0 +1,177 @@
+\ProvidesPackage{analogclock} [2007/10/30 v1.0 analog clock accessory]
+
+%
+% Luis Randez randez@unizar.es
+% Juan I. Montijano monti@unizar.es
+%
+% This program can be redistributed and/or modified under the terms
+% of the GNU Public License, version 2.
+
+
+\RequirePackage{hyperref}
+\RequirePackage{xcolor}[2004/05/09]
+\RequirePackage{xkeyval}
+\RequirePackage{tikz}
+
+\ifdefined\clock@interval\else\def\clock@interval{15}\fi
+\DeclareOptionX{timeinterval}{\renewcommand{\clock@interval}{#1}}
+\ProcessOptionsX
+
+\newdimen\clock@fontsize
+\def\clock@setfontcolor{\clock@temp{.}\let\clock@fontcolor=\clock@tempa}
+%\def\clock@setbgcolor{\clock@temp{.}\let\clock@fontcolor=\clock@tempa}
+
+
+\def\clock@temp#1{\def\clock@tempa##1,##2,##3\@nil{##1 ##2 ##3}%
+\extractcolorspec{#1}\clock@tempb
+ \expandafter\convertcolorspec\clock@tempb{rgb}\clock@tempb
+ \edef\clock@tempa{\expandafter\clock@tempa\clock@tempb\@nil}}
+
+%\clock@temp{black!10}\let\clock@bgcolor=\clock@tempa
+\def\clock@bgcolor{black!30}
+
+
+\def\kk{\mbox{\TextField[name=rolex0, width=2\clock@fontsize, height=2\clock@fontsize, align = 1, charsize =1.1\clock@fontsize, color =\clock@bgcolor, readonly=true, value={}]{}}}
+
+%
+\def\initclock{
+\vbox to 0pt{
+\begin{Form}
+$$
+\TextField[format=\startclock,name=resultado2, width=0truecm, height=0truecm, bordercolor= 1 1 1, backgroundcolor= 1 1 1,value={}]{}
+$$
+\end{Form}%
+\TextField[name=rolex0, hidden=true, width=0pt, height=0pt,charsize=0pt]{}%
+\TextField[name=rolex1, hidden=true, width=0pt, height=0pt,charsize=0pt]{}%
+\TextField[name=rolex2, hidden=true, width=0pt, height=0pt,charsize=0pt]{}%
+\TextField[name=rolex3, hidden=true, width=0pt, height=0pt,charsize=0pt]{}%
+\TextField[name=rolex4, hidden=true, width=0pt, height=0pt,charsize=0pt]{}%
+\TextField[name=rolex5, hidden=true, width=0pt, height=0pt,charsize=0pt]{}%
+}\vskip -\baselineskip%
+}
+%
+\newbox\sizebox
+\newdimen\uu
+%
+\def\analogclock{\clock@setfontcolor\clock@setfontsize\clock@setfontnumber%
+\uu=\f@size pt\raisebox{0.41\clock@fontsize}{\raisebox{-0.41\uu}{\mbox{%
+\vrule width 0pt height 2pt%
+\kern0.31\clock@fontsize\kern-0.31\uu%
+\begin{tikzpicture}[scale=\clock@fontnumber]%
+\useasboundingbox (-0.57 pt,-0.72 pt) rectangle (0.89 pt,1.05 pt);
+%\clockskin
+\faceframe%
+\facebg%
+\face%
+\node at (0 pt,-0.0013 pt) {\colocafield{rolex1}};
+\node at (0 pt,-0.0013 pt) {\colocafield{rolex2}};
+\end{tikzpicture}%
+\vrule width 0pt height 2pt%
+}}}%
+}%
+
+\newcount\@face
+\def\faceclock#1#2{%
+\@face=#1\def\@col{#2}%
+\ifx\@col\@empty\def\facebg{}\else\fi%
+\ifnum\@face<0\def\faceframe{}\else\fi%
+\ifnum\@face=4\def\face{}\else\fi% Esfera sin simbolos
+\ifnum\@face=-4\def\face{}\else\fi% Esfera sin simbolos
+\ifnum\@face=2\def\face@type{rolex3}\fi% Esfera con muchos simbolos
+\ifnum\@face=-1\def\face@type{rolex3}\fi% Esfera con muchos simbolos
+\ifnum\@face=2\def\face@type{rolex4}\fi% Esfera con puntos
+\ifnum\@face=-2\def\face@type{rolex4}\fi% Esfera con puntos
+\ifnum\@face=3\def\face@type{rolex5}\fi% Esfera con cuatro rayas
+\ifnum\@face=-3\def\face@type{rolex5}\fi% Esfera con cuatro rayas
+\def\clock@bgcolor{#2}%
+}
+%
+
+\def\colocafield#1{%
+\setbox\sizebox=\hbox{\mbox{\unskip\TextField[name=#1, width=2\clock@fontsize, height=2\clock@fontsize, align = 1, charsize =\clock@fontsize, color =\clock@fontcolor, readonly=true, value={}]{}}}%
+\kern-\wd\sizebox\kern 2\clock@fontsize%
+\box\sizebox%
+}
+%
+\def\clock@setfontsize{\clock@fontsize=\f@size pt\clock@fontsize=\fac@font\clock@fontsize}
+\def\fac@font{1.0}
+\def\clocksizefactor#1{\def\fac@font{#1}}
+
+
+\def\facebg{\fill[fill=\clock@bgcolor] (0,0) circle (0.75 pt);}
+\def\faceframe{\draw[color=., thick] (0.00,0.00) circle (0.77 pt);}
+\def\face{\node at (0 pt,-0.0013 pt) {\colocafield{\face@type}};\font\peque=cmr5 at 0.12\clock@fontsize \draw (0pt,-0.34 pt) node {\peque M\&R};}
+\def\face@type{rolex3}
+\def\clockskin{%
+\filldraw[rotate=22, fill=black!10!white] (0.2 pt,0.83 pt) arc (0:180:0.2 pt) -- cycle;
+\filldraw[rotate=-22, fill=black!10!white] (0.2 pt,0.83 pt) arc (0:180:0.2 pt) -- cycle;
+\draw[very thick] (0 pt, 0.75 pt) -- (0pt,0.92pt) circle (0.05pt);
+\draw[very thick] (-65:0.75 pt) -- (-65:0.90 pt);
+\draw[very thick] (-115:0.75 pt) -- (-115:0.90 pt);
+}
+%\def\clockskin{}
+
+\def\@p{p}
+\def\extract@number#1{\edef\clock@tempb{#1 pp}\def\clock@tempa##1##2\@nil{\if##1\@p\else ##1\clock@tempa##2\@nil\fi}
+\edef\clock@fontnumber{\expandafter\clock@tempa\clock@tempb\@nil}}
+\def\clock@setfontnumber{\extract@number{\the\clock@fontsize}}
+
+
+
+%
+\def\startclock{%
+%
+fecha1 = reloj();
+run = app.setInterval("reloj();",\clock@interval000);
+%
+%
+function reloj()
+{
+%
+var fObj = new Date();
+var horas = fObj.getHours();
+var minutos = fObj.getMinutes(); minutos1 = minutos+0.0;
+%
+horaa=horas+0.0;
+if (horaa >= 12) {horaa=horaa-12.0; };
+%
+%
+%this.getField("rolex0").textColor=color.red;
+this.getField("rolex0").strokeColor=color.transparent;
+this.getField("rolex0").fillColor=color.transparent;
+%this.getField("rolex1").textColor=color.red;
+this.getField("rolex1").strokeColor=color.transparent;
+this.getField("rolex1").fillColor=color.transparent;
+%this.getField("rolex2").textColor=color.red;
+this.getField("rolex2").strokeColor=color.transparent;
+this.getField("rolex2").fillColor=color.transparent;
+this.getField("rolex3").strokeColor=color.transparent;
+this.getField("rolex3").fillColor=color.transparent;
+this.getField("rolex4").strokeColor=color.transparent;
+this.getField("rolex4").fillColor=color.transparent;
+this.getField("rolex5").strokeColor=color.transparent;
+this.getField("rolex5").fillColor=color.transparent;
+this.getField("rolex0").textFont="clock";
+this.getField("rolex1").textFont="clock";
+this.getField("rolex2").textFont="clock";
+this.getField("rolex3").textFont="clock";
+this.getField("rolex4").textFont="clock";
+this.getField("rolex5").textFont="clock";
+var str = new String();
+numero=Math.floor(192.0 + horaa*5.0 + minutos1/12.0);
+str = String.fromCharCode(48);
+this.getField("rolex0").value=str;
+str = String.fromCharCode(numero);
+this.getField("rolex1").value=str;
+str = String.fromCharCode(64+minutos1);
+this.getField("rolex2").value=str;
+str = String.fromCharCode(49);
+this.getField("rolex3").value=str;
+str = String.fromCharCode(50);
+this.getField("rolex4").value=str;
+str = String.fromCharCode(51);
+this.getField("rolex5").value=str;
+}
+%
+}
+% \ No newline at end of file
diff --git a/macros/latex/contrib/analogclock/clock.ttf b/macros/latex/contrib/analogclock/clock.ttf
new file mode 100644
index 0000000000..e0a4b40464
--- /dev/null
+++ b/macros/latex/contrib/analogclock/clock.ttf
Binary files differ