TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The \FpEval{}{} function which can be used to do computations, and store the result in a variable, in latex. For details, kindly see How can I sum two values and store the result in other variable? .

The package tdclock contains a macro called \tdhours which can display the current system time. For details, kindly see this pdf .

I would like to read the hour from \tdhours and perform some simple computation with it. For Ex, I want to do read the hour from \tdhours and subtract it from 24, and display the time left for midnight. I tried this naive thing, which does not work:


Current time is \tdhours hours .


There is \timeLeftForMidN hours more for midnight.


This gives the error message:

! Illegal parameter number in definition of \FP@tmp.
<to be read again> 
l.8 \FPeval{\timeLeftForMidN}{clip(24-\tdhours)}

! Illegal parameter number in definition of \FP@tmp.
<to be read again> 
l.8 \FPeval{\timeLeftForMidN}{clip(24-\tdhours)}

! Illegal parameter number in definition of \FP@tmp.
<to be read again> 
l.8 \FPeval{\timeLeftForMidN}{clip(24-\tdhours)}

! Undefined control sequence.
\clock@temp ...\def \clock@tempa ##1,##2,##3\@nil 
                                                  {##1 ##2 ##3}\extractcolor...
l.8 \FPeval{\timeLeftForMidN}{clip(24-\tdhours)}

Just to emphasize the difference between what I am saying and a question that already exists in stack-exchange called How to make time-dependent code? : There the question is about making the pdf text compilation-time dependent. It is equivalent to manually adding in the current time each time the pdflatex file is compiled. The datetime package is the solution in that case.

However, in my case, I need a pdf that is dependent on the time at which the pdf file is being viewed.

share|improve this question

closed as off-topic by Joseph Wright Aug 10 '13 at 7:52

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

\tdhours is a set of instructions for printing the hour, not simply the current hour. – egreg Mar 11 '13 at 23:20
\tdhours doesn't hold the value of the hours but intiates a JS textfield which is populated by Acrobat's javascript abilities. Hence it's not possible in the way you have proposed. – percusse Mar 11 '13 at 23:21
Is there anyway that hour information can be manipulated using Acrobat's javascript abilities. Can we instruct acrobat to read 24-\tdhours instead of reading \tdhours ? Does that make sense ? I understand that having the computation in the tex file alone is not sufficient, as once it is compiled, computed value is fixed and cannot change dynamically while viewing the pdf. Maybe my question can be answered by knowing how to use javascript abilities of Acrobat Reader from pdfLaTeX . – Pavithran Iyer Mar 11 '13 at 23:32
@PavithranIyer These are all off-topic questions for this forum unfortunately. TeX is not responsible for the Javascript part it only places the required code (which you should have written to place it) inside the PDF file. The rest is Acrobat's internals not TeX. By the way the value is not fixed I can see that it updates every 10 seconds or so. – percusse Mar 11 '13 at 23:36
This question appears to be off-topic because it is about JavaScript control of PDF files. – Joseph Wright Aug 10 '13 at 7:52