5

This question already has an answer here:

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 ?

marked as duplicate by Stefan Kottwitz Oct 9 '16 at 12:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    Hi, welcome to TeX.SX. PDF tooltips is a possibility I guess (e.g. tex.stackexchange.com/questions/126426/…), though I'm not sure how well it would work for code, at least large blocks. – Torbjørn T. Aug 2 '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 1 '14 at 19:25
  • An answer to 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 5 '16 at 12:56

Browse other questions tagged or ask your own question.