[OS X TeX] Re: draftcopy "weirdness"
Claus Gerhardt
claus.gerhardt at uni-heidelberg.de
Tue Apr 12 10:32:53 EDT 2011
I remembered that we had this discussion some time ago, I guess Alain brought up this question, and my solution was
\usepackage{ifthenelse}
\newcounter{hours}\newcounter{minutes}
\newcommand{\printtime}{%
\setcounter{hours}{\time/60}%
\setcounter{minutes}{\time-\value{hours}*60}%
\ifthenelse{\value{minutes}<9}{\thehours :0\theminutes}{\thehours:\theminutes}}
At least I assume that this was my solution, based of course on the Latex Companion, since the above code is part of my personal package.
Claus
On Apr 12, 2011, at 15:43, Claus Gerhardt wrote:
> Why don't you try Google
>
> \ xxivtime (for 24-hour time)
>
> Claus
> On Apr 12, 2011, at 15:29, John B. Thoo wrote:
>
>> Peter,
>>
>> On Apr 11, 2011, at 4:37 AM, Peter Vamos wrote:
>>
>>> At 05:03 +0100 11/4/11, John B. Thoo wrote:
>>>
>>>> Date: Sun, 10 Apr 2011 16:32:27 +0100
>>>> From: Peter Vamos <P.Vamos at exeter.ac.uk>
>>>>
>>>>> Additionally, if you want the time on a new line then you have to
>>>>> enclose the draftstring in a parbox or the minipage environment. For
>>>>> example, to approximate what you originally wanted, try this:
>>>>>
>>>>> \usepackage[draft]{pdfdraftcopy}
>>>>> \draftstring{%
>>>>> \begin{minipage}{17cm}
>>>>> \begin{center}
>>>>> \ DRAFT \quad\today
>>>>> \end{center}
>>>>> \end{minipage}
>>>>> }
>>>>
>>>> That puts the date on a new line very nicely; however, there is no time.
>>>
>>> To get a time stamp you have to use TeX's \time register, this is the number of minutes since midnight. There is an example in The LaTeX Companion 2nd ed (TLC2) Example A.3.2 page 871, on how to turn this into an hour : Minutes representation; this code is between the rows of %%%%%% below, I only changed their `h' and `min' to a colon `:'; you can modify this to other representations. I think that there is also a datetime package which would do this and probably more.
>>>
>>> So try the code below. You may also experiment with the package suggested by Juan Luis Varona (I haven't tried) but again you'll need the time stamp code from TLC2 below (or the package).
>>>
>>> %%%%%%%%%%%%%
>>> \usepackage{calc}
>>> \newcounter{hours}\newcounter{minutes}
>>> \newcommand\printtime{\setcounter{hours}{\time/60}%
>>> \setcounter{minutes}{\time-\value{hours}*60}%
>>> \thehours :\theminutes}
>>> %%%%%%%%%%%%%%%%%%%
>>> \usepackage[draft]{pdfdraftcopy}
>>> \draftstring{%
>>> \begin{minipage}{17cm}
>>> \begin{center}
>>> \ DRAFT \quad\today\ \printtime
>>> \end{center}
>>> \end{minipage}
>>> }
>>>
>>>
>>> Hope this now does (roughly) what you wanted but now compatible with pdfLATEX.
>>
>> That's very nice. I like it. In fact, I saved your code into a file named "vamosdraft.sty". :-) My only further question is how can I get the time to print in four digits, viz., "hh:mm"? Now, if the time is 6:04, e.g., it prints 6:4. See
>>
>> <http://ms.yccd.edu/~jb2/PickUp/ast_draft.pdf>
>>
>> Thanks very much for your help.
>>
>> ---John.
>>
>> -----------------------------------------------------------------------
>> "It is worth thinking deeply about simple things."
>> ---Jesus De Loera, UC Davis mathematics, 12 Jan 2011
>>
>> ----------- Please Consult the Following Before Posting -----------
>> TeX FAQ: http://www.tex.ac.uk/faq
>> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
>> List Archive: http://tug.org/pipermail/macostex-archives/
>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>
More information about the MacOSX-TeX
mailing list