| 1 |
\documentclass{article} |
| 2 |
|
| 3 |
\usepackage{xcolor} |
| 4 |
\usepackage{hyperref} |
| 5 |
\usepackage{xkeyval} |
| 6 |
\usepackage[font=Times,timeinterval=10,timeduration=2.0, timewarningfirst=50,timewarningsecond=70, |
| 7 |
fillcolorwarningsecond=white!60!yellow, timedeath=0,resetatpages=3]{tdclock} |
| 8 |
|
| 9 |
\title{The Ticking Digital Clock \texttt{tdclock} package v2.3} |
| 10 |
\author{Luis R\'{a}ndez \& Juan I. Montijano} |
| 11 |
%\affiliation[IUMA]{IUMA \\ Universidad de Zaragoza } |
| 12 |
\date{\today} |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
\begin{document} |
| 17 |
|
| 18 |
\maketitle |
| 19 |
|
| 20 |
\initclock |
| 21 |
|
| 22 |
\section{The package} |
| 23 |
The \texttt{tdclock} package is a \LaTeX2e package that |
| 24 |
allows the users to insert into a \LaTeX\/ generated pdf document |
| 25 |
a ticking digital clock showing the date and/or time at |
| 26 |
the moment in which the document |
| 27 |
is being read, for example the one next: \quad \tdclock. |
| 28 |
|
| 29 |
\smallskip |
| 30 |
The package is loaded by \texttt{$\backslash$usepackage[``options'']\{tdclock\}} |
| 31 |
|
| 32 |
\medskip |
| 33 |
|
| 34 |
\noindent Options: |
| 35 |
|
| 36 |
\begin{itemize} |
| 37 |
\item timeinterval=$n$ |
| 38 |
\item[] |
| 39 |
$n$ can be any positive integer. The clock will update its internal status every $n$ seconds. Thus, if we load |
| 40 |
the package with \texttt{[timeinterval=120]}, the clock will update its display every 2 minutes. |
| 41 |
The default time interval is set to 29 seconds. |
| 42 |
|
| 43 |
Note that for low values of $n$ the memory used by Adobe increases during the time the document remains opened and can |
| 44 |
become very high. Then, values of $n$ below 10 are not recommended. |
| 45 |
|
| 46 |
\item font=``adobe font'' |
| 47 |
\item[] |
| 48 |
``adobe font'' is one of the following 9 adobe name fonts:\\[5pt] |
| 49 |
\begin{tabular}{llllll} |
| 50 |
Helv & HelvI & HelvBI & |
| 51 |
Times & TimesI & TimesBI \\ |
| 52 |
Cour & CourI & CourBI &&& |
| 53 |
\end{tabular} |
| 54 |
|
| 55 |
\item[]At the moment no other fonts, like \TeX\ ones, can be used. This restriction comes from the fact that the |
| 56 |
``dynamic'' clock is based on javascript code embedded into the pdf document. |
| 57 |
|
| 58 |
\item timeduration=``time (in mimutes)'' |
| 59 |
\item[] |
| 60 |
``time'' can be any integer or decimal number. This option is intended to be used in presentations (beamer for example). |
| 61 |
Its value specifies the time the presentation should last. This option has sense in conjunction with the next options. |
| 62 |
|
| 63 |
\item timewarningfirst= $n$ |
| 64 |
\item[] |
| 65 |
$n$ can be any integer between 1 and 100. With this option set, after $n$\% of the time specified in timeduration, |
| 66 |
the color and background of the tdclock time will change, according to the next options. |
| 67 |
This can be used as a first warning that you are running out time for the presentation. The default is set to 90. |
| 68 |
|
| 69 |
\item timewarningsecond= $n$ |
| 70 |
\item[] |
| 71 |
$n$ can be any integer between 1 and 100 (usually greater than timewarningfirst). With this option set, after $n$\% of the time specified in timeduration, |
| 72 |
the color and background of the tdclock time will change, according to the next options. |
| 73 |
This can be used |
| 74 |
as a second warning that you have little time to finish the presentation. The default is set to 95. |
| 75 |
|
| 76 |
\item colorwarningfirst= ``color'' |
| 77 |
\item[] |
| 78 |
This option specifies the color for the tdclock time after the time specified by |
| 79 |
timeduration and timewarningfirst options. The default is orange. |
| 80 |
|
| 81 |
\item fillcolorwarningfirst= ``color'' |
| 82 |
\item[] |
| 83 |
This option specifies the color background for the tdclock time after the time specified by |
| 84 |
timeduration and timewarningfirst options. The default is ``transparent''. |
| 85 |
This has only effect on time specified by $\backslash$crono, $\backslash$tdclock and $\backslash$tdtime |
| 86 |
time orders. |
| 87 |
|
| 88 |
\item colorwarningsecond= ``color'' |
| 89 |
\item[] |
| 90 |
This option specifies the color for the tdclock time after the time specified by |
| 91 |
timeduration and timewarningsecond options. The default is red. |
| 92 |
|
| 93 |
\item fillcolorwarningsecond= ``color'' |
| 94 |
\item[] |
| 95 |
This option specifies the color background for the tdclock time after the time specified by |
| 96 |
timeduration and timewarningsecond options. The default is ``transparent''. |
| 97 |
This has only effect on time specified by $\backslash$crono, $\backslash$tdclock and $\backslash$tdtime |
| 98 |
time orders. |
| 99 |
|
| 100 |
\item timedeath= 0 or 1 |
| 101 |
\item[] |
| 102 |
If this option is set to 1, after 110\% of the time specified in timeduration, |
| 103 |
the pdf document will be closed. The default is set to 0 (the document is not closed). |
| 104 |
|
| 105 |
\item resetatpages= ``pages where the crono is reset to zero'' |
| 106 |
\item[] |
| 107 |
\begin{tabular}{lp{6.5cm}} |
| 108 |
resetatpages= none & does nothing (the default). \\ |
| 109 |
resetatpages= all & the crono is reset to zero every time you changes the page. \\ |
| 110 |
resetatpages= $n$ & the crono is reset to zero every time you go to the page $n$. \\ |
| 111 |
resetatpages= $\{n1, n2, \ldots \}$ & the crono is reset to zero every time you go to any of the pages $n1, n2, \ldots$ |
| 112 |
\end{tabular} |
| 113 |
\item pageresetcontrol= ``The way the pages are specified'' |
| 114 |
\item[] |
| 115 |
\begin{tabular}{lp{6.5cm}} |
| 116 |
pageresetcontrol= pdfpagelabels & The pdf labels must be used (the default). You should put the page number or label LaTex puts on the page. |
| 117 |
Usually, this is the number that appears as page number in the final document. For this page for example is 3. |
| 118 |
In beamer, when overlays are used, all sub-slides have the same pdfpagelabel, the one of the frame.\\ |
| 119 |
pageresetcontrol= pdfpagenumbers & The internal pdf page number must be used. First page has page number 0, the second one has 1 and so on. |
| 120 |
In beamer, when overlays are used, every sub-slide have different pdfpagenumber, in consecutive order. The page number in the document does not |
| 121 |
coincides with the internal pdf page number. In this docunment, this page 3 has internal pdf page number 2\\ |
| 122 |
\end{tabular} |
| 123 |
\end{itemize} |
| 124 |
|
| 125 |
Some examples of using the options |
| 126 |
|
| 127 |
\begin{itemize} |
| 128 |
\item |
| 129 |
{\bf $\backslash$usepackage[font=Times, timeinterval=59]\{tdclock\} } |
| 130 |
|
| 131 |
\item[] Only the font (Times) and the time (59 seconds) for updating the clock is specified. No warning indicating |
| 132 |
that the time for the presentation is finishing will be given. |
| 133 |
|
| 134 |
\item |
| 135 |
{\bf $\backslash$usepackage[font=Times, timeinterval=30, timeduration=20, \\ |
| 136 |
timewarningfirst=85, timewarningsecond=90, \\ |
| 137 |
fillcolorwarningsecond=white!60!yellow]\{tdclock\} } |
| 138 |
|
| 139 |
\item[] In addition to the font (Times) and the time (30 seconds) for updating the clock, a duration of the presentation of 20 minutes is specified. The color of the clock font will be set to orange after 17 minutes (85\% of 20). This color will be changed to red, |
| 140 |
and the background to white!60!yellow after 18 minutes(90\% of 20). |
| 141 |
|
| 142 |
\item |
| 143 |
{\bf $\backslash$usepackage[timeduration=60, timewarningfirst=90, \\ |
| 144 |
timewarningsecond=95, colorwarningfirst=blue, \\ |
| 145 |
fillcolorwarningfirst=white!60!yellow, \\ |
| 146 |
fillcolorwarningsecond=white!10!yellow, timedeath=1]\{tdclock\} } |
| 147 |
|
| 148 |
\item[] A duration of the presentation of 60 minutes is specified. The color of the clock font will be set to blue |
| 149 |
after 54 minutes (90\% of 60) with a background white!60!yellow. The font color will be changed to red after |
| 150 |
57 minutes and the background to white!10!yellow. The document will close automatically after 66 minutes |
| 151 |
(110\% of 60). |
| 152 |
|
| 153 |
\end{itemize} |
| 154 |
|
| 155 |
\section{Restrictions--requirements} |
| 156 |
The package requires hyperref, xkeyval and xcolor packages. It works with PDF\LaTeX\/ as well as with \LaTeX\/$\to$DviPs$\to$Ps2pdf sequence. |
| 157 |
In documents generated by Dvipdfm, the clock does not work properly. |
| 158 |
|
| 159 |
Since it uses javascript code, and not all pdf readers can interpret javascript, |
| 160 |
only some of them will display the documents properly. We have tested the package with |
| 161 |
Adobe reader and Adobe acrobat under windows and Linux. |
| 162 |
|
| 163 |
\section{Installation} |
| 164 |
Copy the package file tdclock.sty to a directory where \LaTeX\/ can find it. |
| 165 |
|
| 166 |
\section{Getting the package} |
| 167 |
|
| 168 |
The package can be downloaded at http://pcmap.unizar.es/numerico/software |
| 169 |
|
| 170 |
\section{Macros} |
| 171 |
|
| 172 |
The clock must be initialized with \texttt{$\backslash$initclock}, usually at the beginning of the document, after |
| 173 |
\texttt{$\backslash$begin\{document\}}. |
| 174 |
|
| 175 |
The following macros display dynamically the current date and/or time: |
| 176 |
|
| 177 |
\begin{center} |
| 178 |
\begin{tabular}{|l|l|} |
| 179 |
\hline |
| 180 |
\bf command & \bf action \\ |
| 181 |
\hline |
| 182 |
\texttt{ $\backslash$tdclock} & displays a complete clock \\ \hline |
| 183 |
\texttt{ $\backslash$tdtime} & displays the current time \\ \hline |
| 184 |
\texttt{ $\backslash$tddate} & displays the current date \\ \hline |
| 185 |
\texttt{ $\backslash$tdday} & displays the current day \\\hline |
| 186 |
\texttt{ $\backslash$tdmonth} & displays the current month \\\hline |
| 187 |
\texttt{ $\backslash$tdyear} & displays the current year \\\hline |
| 188 |
\texttt{ $\backslash$tdhours} & displays the current hour \\\hline |
| 189 |
\texttt{ $\backslash$tdminutes} & displays the current minute \\\hline |
| 190 |
\texttt{ $\backslash$tdseconds} & displays the current second \\\hline |
| 191 |
\end{tabular} |
| 192 |
\end{center} |
| 193 |
|
| 194 |
The package also provides macros to display a stopwatch. This can be done |
| 195 |
by means of the following macros: |
| 196 |
|
| 197 |
\begin{center} |
| 198 |
\begin{tabular}{|l|l|} |
| 199 |
\hline |
| 200 |
\bf command & \bf action \\ |
| 201 |
\hline |
| 202 |
\texttt{ $\backslash$crono} & displays a stopwatch \\ \hline |
| 203 |
\texttt{ $\backslash$cronohours} & displays a crono (only hours) \\\hline |
| 204 |
\texttt{ $\backslash$cronominutes} & displays a crono (only minutes) \\\hline |
| 205 |
\texttt{ $\backslash$cronoseconds} & displays a crono (only seconds) \\\hline |
| 206 |
\end{tabular} |
| 207 |
\end{center} |
| 208 |
|
| 209 |
In addition, the package includes two macros that display buttons. With one of them, by pressing it, |
| 210 |
you reset the stopwatch to zero values. The form of the command is \texttt{$\backslash$resetcrono\{``button''\}}. |
| 211 |
For example, \texttt{$\backslash$resetcrono\{$\backslash$fbox\{reset\}\} $\backslash$crono} produces (press the button to see what happens): |
| 212 |
\resetcrono{\fbox{reset}} \crono |
| 213 |
|
| 214 |
The other lets you toggle from current time to stopwatch. For example, |
| 215 |
\texttt{$\backslash$toggleclock\{$\backslash$fbox\{toggleclock\}\} $\backslash$tdtime} produces (press the button to see what happens): |
| 216 |
\toggleclock{\fbox{toggle}} \tdtime. |
| 217 |
|
| 218 |
Note that \texttt{$\backslash$toggleclock} only has effect on \texttt{$\backslash$tdtime} command, and not on \texttt{$\backslash$crono}. |
| 219 |
|
| 220 |
\subsection{Formatting the output} |
| 221 |
|
| 222 |
\subsubsection{Size and color} |
| 223 |
The size and color of the characters forming the time or date are the \LaTeX\/ |
| 224 |
current font size and color. Thus, for example |
| 225 |
|
| 226 |
\noindent\texttt{ |
| 227 |
$\backslash$centerline\{$\backslash$textcolor\{blue\}\{$\backslash$Huge $\backslash$tdclock\}\} |
| 228 |
} gives: |
| 229 |
|
| 230 |
\centerline{\textcolor{blue}{\Huge \tdtime} } |
| 231 |
|
| 232 |
\smallskip |
| 233 |
|
| 234 |
There is another macro, \texttt{$\backslash$factorclockfont\{``factor''\}}, that increases the size of the clock |
| 235 |
by a desired factor. To set the size of the clock to its original size, use |
| 236 |
\texttt{$\backslash$factorclockfont\{1\}} |
| 237 |
|
| 238 |
\subsubsection{Formatting the display} |
| 239 |
There are two commands that change the effect of \texttt{$\backslash$time} and |
| 240 |
\texttt{$\backslash$crono}. |
| 241 |
\begin{itemize} |
| 242 |
\item \texttt{$\backslash$hhmmss} redefine the commands to show the hours,minutes and seconds (this is the default), |
| 243 |
\item \texttt{$\backslash$hhmm} redefine them so that they will only show hours and minutes. |
| 244 |
\end{itemize} |
| 245 |
|
| 246 |
Hours, minutes and seconds are separated by the character defined in the macro \texttt{$\backslash$timeseparator}. |
| 247 |
Therefore, the time separator can be set by redefining this macro. For example, |
| 248 |
|
| 249 |
\centerline{\texttt{$\backslash$renewcommand\{$\backslash$timeseparator\}\{;\}$\backslash$tdtime}} |
| 250 |
|
| 251 |
gives |
| 252 |
|
| 253 |
\centerline{\renewcommand{\timeseparator}{;}\tdtime} |
| 254 |
|
| 255 |
Different types of formats for time can be achieved by means of the macros \texttt{$\backslash$tdhours}, \texttt{$\backslash$tdminutes} and\texttt{$\backslash$seconds}. For example, |
| 256 |
|
| 257 |
\noindent\texttt{$\backslash$minutes}.\texttt{$\backslash$seconds} |
| 258 |
produces: \quad \tdminutes.\tdseconds |
| 259 |
|
| 260 |
Different types of formats for the stopwatch can be achieved by means of the macros \texttt{$\backslash$cronohours}, \texttt{$\backslash$cronominutes} and\texttt{$\backslash$cronoseconds}. For example, |
| 261 |
|
| 262 |
\noindent\texttt{$\backslash$cronominutes}.\texttt{$\backslash$cronoseconds} |
| 263 |
produces: \quad \cronominutes.\cronoseconds |
| 264 |
|
| 265 |
In fact, \texttt{$\backslash$tdtime} and \texttt{$\backslash$crono} are defined by default to \\ |
| 266 |
\texttt{$\backslash$tdhours$\backslash$timeseparator$\backslash$tdminutes$\backslash$timeseparator$\backslash$tdseconds}\\ and \\ |
| 267 |
\texttt{$\backslash$cronohours$\backslash$timeseparator$\backslash$cronominutes$\backslash$timeseparator$\backslash$cronoseconds}\\ respectively. |
| 268 |
|
| 269 |
\bigskip |
| 270 |
|
| 271 |
Regarding the date, there are two commands that change the effect of \texttt{$\backslash$tddate}. |
| 272 |
\begin{itemize} |
| 273 |
\item \texttt{$\backslash$ddmmyyyy} redefine the command to show the day,month and year (this is the default), |
| 274 |
\item \texttt{$\backslash$mmddyyyy} redefine it to show month, day and year. |
| 275 |
\end{itemize} |
| 276 |
|
| 277 |
Day, month and year are separated by the character defined in the macro \texttt{$\backslash$dateseparator}. |
| 278 |
Therefore, the date separator can be set by redefining this macro. For example, |
| 279 |
|
| 280 |
\centerline{\texttt{$\backslash$renewcommand\{$\backslash$dateseparator\}\{;\}$\backslash$tddate}} |
| 281 |
|
| 282 |
gives |
| 283 |
|
| 284 |
\centerline{\renewcommand{\dateseparator}{;}\tddate} |
| 285 |
|
| 286 |
Different types of formats for date can be achieved by means of the macros \texttt{$\backslash$tdday}, \texttt{$\backslash$tdmonth} and\texttt{$\backslash$tdyear}. For example, |
| 287 |
|
| 288 |
\noindent\texttt{$\backslash$day}--\texttt{$\backslash$month} |
| 289 |
produces: \quad \tdday--\tdmonth |
| 290 |
|
| 291 |
By default, \texttt{$\backslash$tddate} is defined by default to \\ |
| 292 |
\texttt{$\backslash$tdday$\backslash$dateseparator$\backslash$tdmonth$\backslash$dateseparator$\backslash$tdyear}. |
| 293 |
|
| 294 |
Since the font used to display the dynamic date and time is one of the adobe fonts, we have included two commands \texttt{$\backslash$pdfslash} and \texttt{$\backslash$pdfcolon} to provide the charactrers ``slash'' and ``colon'' so that defining |
| 295 |
\texttt{$\backslash$renewcommand\{$\backslash$timeseparator\}\{$\backslash$pdfcolon\}} |
| 296 |
the command \texttt{$\backslash$tdtime} will have all their characters in the same font. |
| 297 |
The same for \texttt{$\backslash$tddate} if we use \texttt{$\backslash$pdfslash} as separator. |
| 298 |
|
| 299 |
\newpage |
| 300 |
\section{Summary of macros} |
| 301 |
|
| 302 |
\bigskip |
| 303 |
\centerline{Time-Date macros} |
| 304 |
\begin{tabular}{|l|l|l|} |
| 305 |
\hline |
| 306 |
macro & result & action \\ |
| 307 |
\hline |
| 308 |
$\backslash$initclock & & initialize clock \\ \hline |
| 309 |
$\backslash$tdclock & \tdclock & complete clock \\ \hline |
| 310 |
$\backslash$tdtime & \tdtime & current time \\ \hline |
| 311 |
$\backslash$tddate & \tddate & current date \\ \hline |
| 312 |
$\backslash$tdday & \tdday & current day \\\hline |
| 313 |
$\backslash$tdmonth & \tdmonth & current month \\\hline |
| 314 |
$\backslash$tdyear & \tdyear & current year \\\hline |
| 315 |
$\backslash$tdhours & \tdhours & current hours \\\hline |
| 316 |
$\backslash$tdminutes & \tdminutes & current minutes \\\hline |
| 317 |
$\backslash$tdseconds & \tdseconds & current seconds \\\hline |
| 318 |
$\backslash$crono & \crono & stopwatch \\ \hline |
| 319 |
$\backslash$cronohours & \cronohours & crono hours \\\hline |
| 320 |
$\backslash$cronominutes & \cronominutes & crono minutes \\\hline |
| 321 |
$\backslash$tdwarningbox\{$\backslash$cronominutes\} & \tdwarningbox{\cronominutes} & warning boxed crono minutes \\\hline |
| 322 |
$\backslash$cronoseconds & \cronoseconds & crono seconds \\\hline |
| 323 |
$\backslash$resetcrono\{``button''\} & \resetcrono{\fbox{reset}} & sets crono time to zero \\\hline |
| 324 |
$\backslash$toggleclock\{``button''\} & \toggleclock{\fbox{toggle}} & toggle time-crono \\\hline |
| 325 |
\end{tabular} |
| 326 |
|
| 327 |
\bigskip |
| 328 |
|
| 329 |
\centerline{Formatting macros} |
| 330 |
\begin{tabular}{|l|l|} |
| 331 |
\hline |
| 332 |
\texttt{$\backslash$hhmm$\backslash$tdtime} & \hhmm\tdtime \\ \hline |
| 333 |
\texttt{$\backslash$hhmmss$\backslash$tdtime} & \hhmmss\tdtime \\ \hline |
| 334 |
\texttt{$\backslash$mmddyy$\backslash$tddate} & \mmddyyyy\tddate \\ \hline |
| 335 |
\texttt{$\backslash$ddmmyy$\backslash$tddate} & \ddmmyyyy\tddate \\ \hline |
| 336 |
\texttt{$\backslash$renewcommand\{$\backslash$dateseparator\}\{--\}$\backslash$tddate} & \renewcommand{\dateseparator}{--}\tddate \\ \hline |
| 337 |
\texttt{$\backslash$renewcommand\{$\backslash$timeseparator\}\{.\}$\backslash$tdtime} & \renewcommand{\timeseparator}{.}\tdtime \\ \hline |
| 338 |
\texttt{$\backslash$pdfslash} & \pdfslash \\ \hline |
| 339 |
\texttt{$\backslash$pdfcolon} & \pdfcolon \\ \hline |
| 340 |
\texttt{$\backslash$factorclockfont\{2.0\}$\backslash$tdtime} & \factorclockfont{2.0}\tdtime \\ \hline |
| 341 |
\end{tabular} |
| 342 |
|
| 343 |
\end{document} |