[texhax] Hyperref and print

Paul Gessler pdgessler at gmail.com
Tue Jul 14 14:02:04 CEST 2015


The option is undocumented (at least as far as I have seen). And it
must be used when loading hyperref (when used with \hypersetup as you
have tried, a warning is issued that the option will have no effect).

With the following file:

\documentclass{article}

\usepackage{color}
\definecolor{testc}{rgb}{.9,.9,.9}

\usepackage[ocgcolorlinks]{hyperref}
\hypersetup{allcolors=testc}

\begin{document}

\section{test section}\label{test}

This a test to see whether the label \ref{test} prints correctly.

\end{document}

You will see that the color shows up on screen, but it is black when
printed (either virtually to another PDF file or physically to a
printer).

PG


On Tue, Jul 14, 2015 at 6:53 AM, Michael Barr <barr at math.mcgill.ca> wrote:
> I experimented with this:
>
> \documentclass{article}
>
> \usepackage{color}
>
> \usepackage{hyperref}
> \hypersetup{ocgcolorlinks=true,allcolors=testc}
> \definecolor{testc}{rgb}{.9,.9,.9}
> \begin{document}
>
> \section{test section}\label{test}
>
> This a test to see whether the label \ref{test} prints correctly.
>
>
> \end{document}
>
>
> and got the same result as without the option line, a red box around the reference.  When I replaced the option line by
>
> \hypersetup{ocgcolorlinks=true,colorlinks=true,allcolors=testc}
>
> I got the same result as without the ocgcolorlinks=true.  That is, the reference showed on the screen in the very light color that I chose to heighten the effect and printed in exactly the same way.  So the net effect of ocgcolorlinks appears to be nil.  Incidentally it apparently doesn't appear at all in the hyperlinks documentation.  I am using TeXLive 2014 with Win 7, but that doesn't matter because anything we use will have to work for everybody.
>
> The journal, Theory and Applications of Categories is distributed online and primarily read that way (I assume) but some will want to print it out.
>
> Michael
>
>
> ----- Original Message -----
> From: "Paul Gessler" <pdgessler at gmail.com>
> To: "Michael Barr" <barr at math.mcgill.ca>
> Cc: "<Unknown>" <texhax at tug.org>
> Sent: Monday, July 13, 2015 8:32:37 PM
> Subject: Re: [texhax] Hyperref and print
>
> Hi Michael,
>
> You can also use the ocgcolorlinks option when loading hyperref. This
> puts the link colors in Optional Content Groups (OCGs) inside the PDF.
> When viewed on-screen, the color is shown, but when printed, the link
> appears black. I've used it with success in many documents.
>
> The disadvantage is that the package code does not support linebreaks
> within URLs when this option is set. A workaround for this limitation
> was devised by Ben Lerner; the code for which is available at TeX
> Stack Exchange if you require it:
> http://tex.stackexchange.com/a/47309/21344 . Please take note of the
> caveats mentioned in the answer if you decide to use the code. They
> could prove to be a serious drawback in a high-volume production
> environment such as a journal.
>
> Good luck with the experiments!
>
> PG
>
> On Mon, Jul 13, 2015 at 7:11 PM, Reinhard Kotucha
> <reinhard.kotucha at gmx.de> wrote:
>> On 2015-07-13 at 19:00:17 -0400, Michael Barr wrote:
>>
>>  > The journal I do some of the TeXnical editing for is experiment
>>  > with \hyperref.  We like the colorlinks=true option and have
>>  > experiment with different colors.  But if the link is in a color,
>>  > B&W printers, at least the ones we have experimented with, print it
>>  > lighter than the surrounding text.  Is there any of doing it so
>>  > that the hyperref code displays onscreen, but is suppressed in the
>>  > print?
>>
>> There are at least two solutions:
>>
>>  1. avoid colorlinks=true for printing
>>
>>  2. use darker colors
>>
>> It'a a matter of fact that most colors defined by hyprerref are too
>> bright.  They are even much too bright for display on screen.
>>
>> The best thing you can do is to replace hyperref's default colors by
>> darker ones.
>>
>> Dark colors are handled more gracefully by B&W printers.
>>
>> Regards,
>>   Reinhard
>>
>> --
>> ------------------------------------------------------------------
>> Reinhard Kotucha                            Phone: +49-511-3373112
>> Marschnerstr. 25
>> D-30167 Hannover                    mailto:reinhard.kotucha at web.de
>> ------------------------------------------------------------------
>> _______________________________________________
>> TeX FAQ: http://www.tex.ac.uk/faq
>> Mailing list archives: http://tug.org/pipermail/texhax/
>> More links: http://tug.org/begin.html
>>
>> Automated subscription management: http://tug.org/mailman/listinfo/texhax
>> Human mailing list managers: postmaster at tug.org



More information about the texhax mailing list