Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am constructing a memorization list for the terms in a paper I am reading. What I would like to do is create a PDF with a term to be defined, and have the definition "hidden" underneath the definition, so that after I have written the definition on paper, I could check the answer was correct simply by clicking (say) a triangle underneath the term to be defined. For example,

Definition: Character of a Group Representation

And the text to unfold beneath it (but not be visible before I've attempted to memorize it):

Let $\sigma\colon G\to \mathsf{GL}(\mathbb{C}^{n})$ be a representation of a group $G$. The character of $\sigma$ to be the function $\chi_{\sigma}\colon G\to \mathbb{C}$ by $\chi_{\sigma}(x):=\mathrm{Tr}\sigma(x)$.

Does anyone know how to do this? I thank you all for your time in advance.

share|improve this question
    
I would imagine this to be possible, to some extent, using PDF/HTML forms, offered by hyperref. Specifically, read section 6 PDF and HTML forms. –  Werner Apr 18 '12 at 19:39
add comment

3 Answers

up vote 7 down vote accepted

One option would be to use the fancytooltips package. A little example follows:

First, you create the PDF file containing the tooltips (one per page). You can do this using latex; for your example, I used the following practice.tex document (mdframed was used to present the tooltips using a nice colored framed box with a shadow, but of course you can decorate the tooltips as you wish):

\documentclass{article}
\usepackage[rmargin=11cm]{geometry}
\usepackage{amsmath,amssymb,mathtools}
\usepackage[createtips]{fancytooltips}
\usepackage{xcolor}
\usepackage[framemethod=TikZ,shadow]{mdframed}
\usetikzlibrary{shadows}
\newmdenv[linecolor=olive,backgroundcolor=yellow!10,shadow=true]{infobox}

\begin{document}
\keytip{character}
\begin{infobox}
Let $\sigma\colon G\to \mathsf{GL}(\mathbb{C}^{n})$ be a representation of a group $G$. The character of $\sigma$ to be the function $\chi_{\sigma}\colon G\to \mathbb{C}$ by $\chi_{\sigma}(x):=\mathrm{Tr}\sigma(x)$.
\end{infobox}

\newpage

\end{document}

This document has to be processed to obtain practice.pdf. Now you create your main document (notice that the name used in filename= is precisely the name of the file practice.pdf containig the tooltips):

\documentclass{article}
\usepackage{xcolor}
\usepackage[filename=practice]{fancytooltips}

\begin{document}

\tooltip*{Definition: Character of a Group Representation}{character}

\end{document}

In the main document, the tooltips will now be invisible until you click on the little blue ballon.

An image of the obtained document without uncovering the tooltip:

enter image description here

And now an image of the obtained document with the tooltip:

enter image description here

This approach doesn't work in all PDF viewers, since it requires cooperation with JavaScripts; you have to use Adobe Reader or Adobe Acrobat to see the tooltips.

share|improve this answer
add comment

Check out pdfcomment.sty, I guess it does exactly what you wish. In the following example however the $sigma$is not displayed in the PDF.

\documentclass{scrartcl}
\usepackage{pdfcomment}
\begin{document}

Character of a Group Representation\pdfsquarecomment{Let $\sigma$ be a representation of a group $G$.}

\end{document}
share|improve this answer
add comment
\documentclass{scrartcl}
\usepackage{ocgtools}
\usepackage{amsfonts}
\def\answer#1{\ocgminitext[width=0.6\linewidth]{??}{#1}}
\begin{document}

Character of a Group Representation\answer{Let $\sigma\colon G\to      
\mathsf{GL}(\mathbb{C}^{n})$ be a representation of a group $G$. The 
character of $\sigma$ to be the function $\chi_{\sigma}\colon G\to 
\mathbb{C}$ by $\chi_{\sigma}(x):=\mathrm{Tr}\sigma(x)$.}

\end{document}

This is a modification of previous answers. The result looks as follows: link *Oops, I cannot post image as new user. Compile the file two or three times. You should get PDF with the text "Character of a Group Representation??" and if you click ?? in Adobe Reader (Javascripts are necessary), yellow rectangle with aditional text appears. You can close this yellow text by clicking ?? again, or clicking the red crossmark or simply press Enter (the button with red cross has keyboard focus). *

The advantage when comparing to the previous answers are that everything is in one file (in contrast to fancytooltips solution) and math is supported (in contrast to pdfcomment solution).

Hope this helps. This is my first post here, I was no able to find out how to continue the first answer (written by Uwe Ziegenhagen) and for this reason I post it here as third solution, even though it is in fact a modification of Uwe's answer.

EDIT: It has been reported in the discussion below that this solution does not work for some users. For now, I uploaded the TeX, PDF and png file with this example to http://user.mendelu.cz/marik/stack

If you need a solution which does not depend on Javascripts and works in all PDF browsers, you may have a look at Acrotex education bundle and the environments excersize and solution. Like this.

\documentclass{scrartcl}
\usepackage[pdftex]{exerquiz}
\usepackage{amsfonts}
\begin{document}

\begin{exercise}
  Character of a Group Representation
  \begin{solution} 
    Let $\sigma\colon G\to
    \mathsf{GL}(\mathbb{C}^{n})$ be a representation of a group
    $G$. The character of $\sigma$ to be the function
    $\chi_{\sigma}\colon G\to \mathbb{C}$ by
    $\chi_{\sigma}(x):=\mathrm{Tr}\sigma(x)$.
  \end{solution}
\end{exercise}
\end{document}
share|improve this answer
    
TeX-live 2011 does not include all the necessary packages for your first code, eforms.sty seems missing. As you seem to be the author of the ocgtools.sty: Why is it not in TeXlive? And how many packages are necessary, which are not included? If more than eforms: Is there a single website where I can get them? Your package seems interesting! –  Keks Dose May 4 '12 at 9:04
    
Hello, according to ctan.org/pkg/ocgtools, the ocgtools package is on Texlive. To insert javascripts you need eforms nad insdljs from Acrotex eDucation bundle - this bundle can be downloaded from CTAN or acrotex.net/aeb_index.php?page=downloads or author's page math.uakron.edu/~dpstory/webeq.html –  robert.marik.cz May 4 '12 at 9:10
    
Misunderstanding, bad question, sorry: eforms.sty is missing in TeXlive. –  Keks Dose May 4 '12 at 9:15
    
Thanks for pointing this out. I do not know why eforms.sty and insdljs.sty are not on Texlive. I think, they were few years ago. Anyway, if these packages are missing, then solution with fancytooltips also does not compile. To install these packages download acrtex education bundle, put it to the .TeX directory (on Linux) and run "pdflatex acrotex.ins" –  robert.marik.cz May 4 '12 at 9:22
    
Sorry, this is not a real solution. First, you have to run LaTeX three times, otherwise the pdf is simply black. And then Adobe Reader says, a certain module for JavaScript were missing. 'quitting. –  Keks Dose May 4 '12 at 9:52
show 1 more comment

Your Answer

 
discard

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.