You can have LaTeX draw frames around things that are placed inside boxes.
You use \fbox for this.

How can you have LaTeX draw lines, e.g., frames around things, which are visible when viewing the resulting pdf-file on screen but which do not get printed on paper?

This would be nice in the process of creating printable labels where in the pdf-file you would like on the screen to see squares denoting the borders of single labels while there is no need to have these squares/borders printed.

More general: How can you have LaTeX place things into the pdf-file which are visible when viewing the resulting pdf-file on screen but which are invisible when the resulting pdf-file is printed on paper/which do not get printed on paper?

Can you have color specifications for colors which are shown on screen but not printed on paper?

  • ocgx package? – coffeetable Jun 2 at 11:33
  • @coffeetable ocgx does not work with pdf viewers like okular. Prints buttons with Adobe reader which i don't like. – Jevdokija Jun 2 at 11:50
  • You should clarify your questions if you have restrictions like ocgx. Idea: Comments are not printed in Adobe Reader per default, maybe that's a angle. – Dr. Manuel Kuehner Jun 2 at 13:46

Using the package ocgx2 you can introduce two "Optional Content Groups".

One of them is always viewable and never printable. It contains the toggle button for the other.

The other one is both viewable and printable only when toggled to "visible", e.g., by means of the toggle button. It contains whatever you don't necessarily wish to be printed.

I tested with the result of compiling the minimal example below on a system where Adobe Reader DC 2019.012.20034 is installed:

With that pdf viewer the toggle button is always visible and never printed.
The example is both visible and printed only if toggled to "visible".

By the way: There are a lot of features which are not fully implemented in other pdf viewers.

\begin{ocg}[viewocg=ifvisible, printocg=ifvisible]{First example}{ocg1}{1}%
first example.
\begin{ocg}[viewocg=always, printocg=never]{Toggle show/hide example}{ocg2}{1}%
\switchocg{ocg1}{\fcolorbox{blue}{blue}{\textbf{\textsf{\textcolor{white}{Toggle show/hide example}.}}}}%
  • +1: I have read about the ocgx(2) package but never used since :). – Dr. Manuel Kuehner Jun 2 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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