[OS X TeX] Re: draftcopy "weirdness"
John B. Thoo
jthoo at yccd.edu
Wed Apr 13 10:45:51 EDT 2011
On Apr 12, 2011, at 12:00 PM, in MacOSX-TeX Digest, Vol 42, Issue 11
Claus Gerhardt wrote:
> Date: Tue, 12 Apr 2011 17:01:00 +0200
> From: Claus Gerhardt <claus.gerhardt at uni-heidelberg.de>
>
> I wonder how I could get the code wrong years ago or ifthenelse is treating "<" as "â?¤"; of course it should read
>
> \ifthenelse{\value{minutes}<10}{\thehours :0\theminutes}{\thehours:\theminutes}}
>
> Anyone who wants a trailing 0 in front a single digit hour has to do it himself.
>
> Claus
>
>
> On Apr 12, 2011, at 16:32, Claus Gerhardt wrote:
>
>> 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
Claus, I modified Peter Vamos's code with suggestion and it works beautifully (i.e., after I changed \usepackage{ifthenelse} to \usepackage{ifthen}). I also added a line to put a zero in the hours < 10.
%%%%%%%%%%%%%
%% By Peter Vamos with contribution by Claus Gerhardt
\usepackage{calc}
\usepackage{ifthen}
\newcounter{hours}\newcounter{minutes}
\newcommand\printtime{%
\setcounter{hours}{\time/60}%
\setcounter{minutes}{\time-\value{hours}*60}%
\ifthenelse{\value{hours}<10}{0\thehours}{\thehours}
\ifthenelse{\value{minutes}<10}{:0\theminutes}{:\theminutes}}
%%%%%%%%%%%%%%%%%%%
\usepackage[draft]{pdfdraftcopy}
\draftstring{%
\begin{minipage}{17cm}
\begin{center}
%\ DRAFT \quad\today\ \printtime
DRAFT \\ {\fontsize{48}{17}\selectfont \today, \printtime}
\end{center}
\end{minipage}
}
Thank you very much.
---John.
-----------------------------------------------------------------------
"It is worth thinking deeply about simple things."
---Jesus De Loera, UC Davis mathematics, 12 Jan 2011
More information about the MacOSX-TeX
mailing list