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

Is it possible to have an interactive PDF Document using LaTeX? For example, I want to make a PDF document (math exercise sheets) such that:

  • The user could fold/unfold parts of the document (i.e., the user could press a plus to see the answers)
  • The user could tick some field to submit an answer and see his/her score
  • Print the resulting PDF document or save it
share|improve this question
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. – Andrey Vihrov Feb 20 '12 at 9:22
related question/partial duplicate: tex.stackexchange.com/questions/19673/… – doncherry Feb 20 '12 at 9:29
This would be limited to acrobat and acrobat reader. Some of this is probably not yet possible even so. Documents with this amount of dynamic content are better suited to web pages with javascript. This would be better for the submission process as well, if you use a dose of CGI. – qubyte Feb 20 '12 at 9:36
tex.stackexchange.com/questions/8918/hello-world-in-pdflatex (talking pdf!) and interactive tex.stackexchange.com/questions/7869/…. Only work with acrobat. – Yiannis Lazarides Feb 20 '12 at 12:22
I like this animated Tikz texample of a Wankel motor: texample.net/tikz/examples/wankel-motor – matth Mar 19 '12 at 14:39

It is possible to have an interactive PDF document, but will only probably work in Acrobat Reader. Some examples can be found at Hello World in pdfLaTeX and How do you say Happy New Year with LaTeX?.

There are a number of ways to create them but the simpler so far is to use the insdljs package from the AcroTeX Education Bundle.

To create the interactive part one needs to use PFD Forms and to insert the appropriate JavaScript code, which like in web pages is used to script the interactive part.

The insdljs package provides an environment, similar to file contents for writing a JavaScript file. In the minimal it defines a function to calculate the area and diameter of a circle given its radius.

function doCalculation()
var radius=0.0 + this.getField("radius").value;
 this.getField("areacircle").value=  Math.PI * Math.pow(radius, 2);

The Textfields and push button are also defined accordingly. The MWE illustrates the application. Please view it with a compatible reader.

\usepackage[scaled =.92]{helvet}
\lhead{A Sample Calculation}\chead{}
\rhead{Area of Circle}
pdftitle={Wishing you a happy year},pdfsubject={Invest your new year improving your TeX skills}%

function doCalculation()
var radius=0.0 + this.getField("radius").value;
 this.getField("areacircle").value=  Math.PI * Math.pow(radius, 2);

%% Short hand commands
\TextField[name={#1}, value={#2}, width=9em,align=2,%
               bordercolor={0.990 .980 .85},%

%% Define the heading

\textbf{\Huge Calculations\\ with JavaScript\\*[4pt] and pdfLateX!}



\heading{Area of Circle}

%%% Input field radius

\TextField[name=radius,width=10em, bordercolor={0.650 .790 .94}]{}%

%% Push button is defined here
\textforlabel{l02}{Press to calculate}  
\PushButton[name=start,onclick={doCalculation();},bordercolor={0.650 .790 .94}%


%% Diameter
Diameter :} \TextField[name=diameter,width=10em,bordercolor={0.650 .790 .94},%

bordercolor={0.650 .790 .94},readonly=true]{}~m$^2$\\*[-0.8em]

The AcroTeX Education Bundle provides numerous other functions, which can be useful in an Academic environment for quizzes and tutorials.

Personally I am not very convinced, as such facilities can better be provided in web pages with better interactivity and opening other opportunities.

share|improve this answer
Several viewers support enough of the Adobe object model to support Interactive PDF, including Apple's Preview application and Safari browser. Interactive PDFs are quite useful for adding navigation support to documents, e.g. having pop-ups in the index that show the context of the references listed for each entry. – Charles Stewart Feb 25 '13 at 10:23
@CharlesStewart Very true. – Yiannis Lazarides Feb 25 '13 at 13:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.