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

Most of the time, we (or more conservatively, I) think of PDF as a static format fit for printing. I've been surprised in the past at how versatile it is -- how dynamic and interactive it can be -- so I've decided to ask the following.

I'd like to create a multi-lingual document where the language can be determined at run-time. That is, the user could select from a drop-down / radio button group to choose a language, and the relevant content would be appropriately substituted throughout the document.

If this is possible, my ideal interface/MWE would be:

\usepackage{mwe} % just for \kant and \lipsum

\DeclareLanguageChoices{kant={One of Kant's Books},
                psuedo-latin={Classical gibberish used in typesetting.}}






The syntax above is LaTeX, but solutions in pdfTeX, XeTeX, ConTeXt, and LuaTeX are all most welcome; just adapt it to the format of your choice. :-)

With this syntax, the produced PDF would display some sort of control at the top (at \dochoices) using the display text (that which is in {}) and, depending on the selected key, display the appropriate content.

Thoughts on Potential Solutions

  • I don't think the format can re-flow itself even vertically, so just taking the maximum box size would be necessary and sufficient.
  • More as I / the comments think of them.
share|improve this question
up vote 6 down vote accepted

I see two ways to do this with PDF:

  1. Layers/Optional Content Groups (OCGs). If you load the microtype manual in Adobe Reader you will see the effects e.g. on page 4. There are LaTeX packages for this (check the tag) and can create them easily. Note that few viewers but Adobe Reader and Acrobat support OCGs.
  2. . These effects can probably be achieved with JS, but few PDF viewers but Adobe's software support JavaScript.
share|improve this answer

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.