5

Perhaps this is a dumb question.

I write a small pdf-book on coding and use there many examples using listings package.

But the amount of code expands text too much, for every 5 lines of text there is 10-20 lines of listings.

I wish there was a way to show code on demand (like spoiler).

May be there is some format supported by latex which would allow to do such thing ?

  • 3
    Hi, welcome to TeX.SX. PDF tooltips is a possibility I guess (e.g. http://tex.stackexchange.com/questions/126426/hide-image-in-pdf-reveal-with-mouseover), though I'm not sure how well it would work for code, at least large blocks. – Torbjørn T. Aug 02 '13 at 18:34
  • If you don't use tooltips as suggested by @TorbjørnT., you'd need to use Javascript for something like that. – jub0bs Mar 01 '14 at 19:25
  • An answer to http://tex.stackexchange.com/q/171898/2707 suggests using OCG layers, which work on some open-source pdf viewers (I tried evince). – Bruno Le Floch Oct 05 '16 at 12:56

0 Answers0