Skip to contentSkip to conversation

Fix pdflatex ToC

PATCH Applied Balbir Singh 3 participants 11 messages Sep 15, 2019 – Oct 4, 2019 1 message not in the archive Kbuild

lore
Share & tools
lore
#0 lore raw

From df15e226d96614ffbdedfd517f8a6d7afc1c0fee Mon Sep 17 00:00:00 2001
From: Balbir singh <[email protected]>
Date: Sun, 15 Sep 2019 21:14:53 +1000
Subject: [PATCH] Make hyperlinks colorful and a browsable pdf TOC

Without these changes the the PDF does not provide a browsable TOC to choose for navigation, also add a bit of color to the links to make them screen friendly.

Also add synctex=-1 to prevent pdf readers like
evince from complaining to the pdflatex command
line

---
 perfbook.tex               | 1 +
 utilities/runfirstlatex.sh | 2 +-
 utilities/runlatex.sh      | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
perfbook.tex +1 -0
index 85696333..a9a0d813 100644
@@ -70,6 +70,7 @@
 \usepackage{multirow}
 \usepackage{noindentafter}
 \NoIndentAfterCmd{\epigraph}
+\hypersetup{pdftex, colorlinks=true, allcolors=blue}
 
 % custom packages
 
utilities/runfirstlatex.sh +1 -1
index 1a2a7a58..019d60d8 100644
@@ -40,7 +40,7 @@ fi
 basename=`echo $1 | sed -e 's/\.tex$//'`
 
 echo "pdflatex 1 for $basename.pdf"
-pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+pdflatex --synctex=-1 $basename > /dev/null 2>&1 < /dev/null || :
 if grep -q '! Emergency stop.' $basename.log
 then
 	grep -B 15 -A 5 '! Emergency stop.' $basename.log
utilities/runlatex.sh +1 -1
index 289364d7..2a168a8d 100644
@@ -51,7 +51,7 @@ identical_warnings () {
 }
 
 iterate_latex () {
-	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+	pdflatex --synctex=-1 $basename > /dev/null 2>&1 < /dev/null || :
 	if grep -q '! Emergency stop.' $basename.log
 	then
 		grep -B 15 -A 5 '! Emergency stop.' $basename.log
Signature · 1 line
2.20.1
#1 lore raw

(CC to Paul's current address)
Hi Balbir,

Quoted 9 lines · Balbir Singh

From df15e226d96614ffbdedfd517f8a6d7afc1c0fee Mon Sep 17 00:00:00 2001
From: Balbir singh <[email protected]>
Date: Sun, 15 Sep 2019 21:14:53 +1000
Subject: [PATCH] Make hyperlinks colorful and a browsable pdf TOC

Without these changes the the PDF does not provide a browsable TOC to choose for navigation, also add a bit of color to the links to make them screen friendly.

Well, it may not be obvious, but hyperlinks have been there in the TOC. You mean you want them colored blue?

For TOC, they may be OK.

But I'm afraid that to color all the hyperlinks in the whole textbook could be too aggressive, as can be seen for example in Section 5.2.4 (below Listing 5.5). Frequent colored line numbers can look too fancy/noisy for some people.

Does adding an experimental target to make hyperlinks colored work with you (similar to -1csf, -msnt, and the like)? If so, which layout do you prefer, 1c or 2c?

Quoted 4 lines

Also add synctex=-1 to prevent pdf readers like
evince from complaining to the pdflatex command
line

As for SyncTeX support, how about the approach in the patch below?

Thanks, Akira

Quoted 3 lines

---

-----8<-------------------------------
From 6a509df0aef50309d8ec1ae5e709b7cee29df3ad Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 16 Sep 2019 18:20:05 +0900
Subject: [PATCH] Add optional flag 'LATEX_OPT' in run{first}latex.sh

Balbir reported that SyncTeX-aware viewers complain in opening perfbook.pdf [1].

Instead of always generating .synctex{.gz} files, add an optional flag to pdflatex commands in run{first}latex.sh scripts.

.synctex files can be generated by defining an environment variable "LATEX_OPT", e.g.:

    $ export LATEX_OPT="--synctex=-1"

, and run "make".

Update .gitignore and "claen" in Makefile as well to ignore/remove SyncTeX files.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html

---
 .gitignore                 | 1 +
 Makefile                   | 1 +
 utilities/runfirstlatex.sh | 2 +-
 utilities/runlatex.sh      | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)
.gitignore +1 -0
index ebd5e98c..dfeb9e1b 100644
@@ -20,6 +20,7 @@
 *.ltms
 *.pdfp
 *.pdfq
+*.synctex*
 perfbook_flat.tex
 qqz.tex
 contrib.tex
Makefile +1 -0
index 13eddfc8..236b0bb2 100644
@@ -350,6 +350,7 @@ clean:
 	rm -f perfbook_flat.tex perfbook*.out perfbook-*.tex
 	rm -f $(LATEXGENERATED)
 	rm -f CodeSamples/snippets.d
+	rm -f *.synctex*
 	@rm -f $(OBSOLETE_FILES)
 
 distclean: clean
utilities/runfirstlatex.sh +1 -1
index 1a2a7a58..2b25b9f1 100644
@@ -40,7 +40,7 @@ fi
 basename=`echo $1 | sed -e 's/\.tex$//'`
 
 echo "pdflatex 1 for $basename.pdf"
-pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
 if grep -q '! Emergency stop.' $basename.log
 then
 	grep -B 15 -A 5 '! Emergency stop.' $basename.log
utilities/runlatex.sh +1 -1
index 289364d7..18dd7fd6 100644
@@ -51,7 +51,7 @@ identical_warnings () {
 }
 
 iterate_latex () {
-	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+	pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
 	if grep -q '! Emergency stop.' $basename.log
 	then
 		grep -B 15 -A 5 '! Emergency stop.' $basename.log
Signature · 1 line
2.17.1
#2 lore raw
Quoted 10 lines · Akira Yokosawa

(CC to Paul's current address)
Hi Balbir,

Quoted 5 lines · Balbir Singh

From df15e226d96614ffbdedfd517f8a6d7afc1c0fee Mon Sep 17 00:00:00 2001
From: Balbir singh <[email protected]>
Date: Sun, 15 Sep 2019 21:14:53 +1000
Subject: [PATCH] Make hyperlinks colorful and a browsable pdf TOC

Quoted 8 lines
Quoted 4 lines

Without these changes the the PDF does not provide a browsable TOC to choose for navigation, also add a bit of color to the links to make them screen friendly.

Well, it may not be obvious, but hyperlinks have been there in the TOC. You mean you want them colored blue?

Yes, but they've been a bit hidden (largely bold text between section headings and references, I have to move my mouse to get know if it is a hyperlink)

Quoted 7 lines

For TOC, they may be OK.

But I'm afraid that to color all the hyperlinks in the whole textbook could be too aggressive, as can be seen for example in Section 5.2.4 (below Listing 5.5). Frequent colored line numbers can look too fancy/noisy for some people.

I see what you mean, how about a gentler color like gray, but I am not 100% sure how that would look in print.

Quoted 4 lines

Does adding an experimental target to make hyperlinks colored work with you (similar to -1csf, -msnt, and the like)? If so, which layout do you prefer, 1c or 2c?

I prefer 1c, but I think the print will always be 2c for saving paper. But please
bear in mind, adding too many targets makes it confusing when Paul tries to release this to the world, no? I am OK skipping colors to keep the PDF uniform

Quoted 8 lines
Quoted 4 lines

Also add synctex=-1 to prevent pdf readers like
evince from complaining to the pdflatex command
line

As for SyncTeX support, how about the approach in the patch below?

Yep that work!

Balbir Singh.

Quoted 92 lines

Thanks, Akira

Quoted 3 lines

---

-----8<-------------------------------
From 6a509df0aef50309d8ec1ae5e709b7cee29df3ad Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 16 Sep 2019 18:20:05 +0900
Subject: [PATCH] Add optional flag 'LATEX_OPT' in run{first}latex.sh

Balbir reported that SyncTeX-aware viewers complain in opening perfbook.pdf [1].

Instead of always generating .synctex{.gz} files, add an optional flag to pdflatex commands in run{first}latex.sh scripts.

.synctex files can be generated by defining an environment variable "LATEX_OPT", e.g.:

    $ export LATEX_OPT="--synctex=-1"

, and run "make".

Update .gitignore and "claen" in Makefile as well to ignore/remove SyncTeX files.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html

---
 .gitignore                 | 1 +
 Makefile                   | 1 +
 utilities/runfirstlatex.sh | 2 +-
 utilities/runlatex.sh      | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)
.gitignore +1 -0
index ebd5e98c..dfeb9e1b 100644
@@ -20,6 +20,7 @@
 *.ltms
 *.pdfp
 *.pdfq
+*.synctex*
 perfbook_flat.tex
 qqz.tex
 contrib.tex
Makefile +1 -0
index 13eddfc8..236b0bb2 100644
@@ -350,6 +350,7 @@ clean:
        rm -f perfbook_flat.tex perfbook*.out perfbook-*.tex
        rm -f $(LATEXGENERATED)
        rm -f CodeSamples/snippets.d
+       rm -f *.synctex*
        @rm -f $(OBSOLETE_FILES)
 
 distclean: clean
utilities/runfirstlatex.sh +1 -1
index 1a2a7a58..2b25b9f1 100644
@@ -40,7 +40,7 @@ fi
 basename=`echo $1 | sed -e 's/\.tex$//'`
 
 echo "pdflatex 1 for $basename.pdf"
-pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
 if grep -q '! Emergency stop.' $basename.log
 then
        grep -B 15 -A 5 '! Emergency stop.' $basename.log
utilities/runlatex.sh +1 -2
index 289364d7..18dd7fd6 100644
@@ -51,7 +51,7 @@ identical_warnings () {
 }
 
 iterate_latex () {
-       pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+       pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
        if grep -q '! Emergency stop.' $basename.log
        then
                grep -B 15 -A 5 '! Emergency stop.' $basename.log
--

2.17.1

#3 lore raw
Quoted 25 lines · Balbir Singh
Quoted 10 lines · Akira Yokosawa

(CC to Paul's current address)
Hi Balbir,

Quoted 5 lines · Balbir Singh

From df15e226d96614ffbdedfd517f8a6d7afc1c0fee Mon Sep 17 00:00:00 2001
From: Balbir singh <[email protected]>
Date: Sun, 15 Sep 2019 21:14:53 +1000
Subject: [PATCH] Make hyperlinks colorful and a browsable pdf TOC

Quoted 8 lines
Quoted 4 lines

Without these changes the the PDF does not provide a browsable TOC to choose for navigation, also add a bit of color to the links to make them screen friendly.

Well, it may not be obvious, but hyperlinks have been there in the TOC. You mean you want them colored blue?

Yes, but they've been a bit hidden (largely bold text between section headings and references, I have to move my mouse to get know if it is a hyperlink)

Quoted 2 lines

For TOC, they may be OK.

Quoted 8 lines
Quoted 5 lines

But I'm afraid that to color all the hyperlinks in the whole textbook could be too aggressive, as can be seen for example in Section 5.2.4 (below Listing 5.5). Frequent colored line numbers can look too fancy/noisy for some people.

I see what you mean, how about a gentler color like gray, but I am not 100% sure how that would look in print.

"DarkBlue" via svgnames option looks less fancy.
How it looks depends on the display/printer setting and individual color sense, though.

Quoted 9 lines
Quoted 5 lines

Does adding an experimental target to make hyperlinks colored work with you (similar to -1csf, -msnt, and the like)? If so, which layout do you prefer, 1c or 2c?

I prefer 1c, but I think the print will always be 2c for saving paper. But please
bear in mind, adding too many targets makes it confusing when Paul tries to release this to the world, no?

Actually speaking, I was the one who added all those experimental targets.

As 1c is mainly for PDF viewers, I think coloring hyperlinks in 1c layout should be acceptable. It should also help those who view on tablets (without mice). 2c layouts won't be affected by the change.

So, I'll prepare a patch to do it. Please give me a short while.

Quoted 8 lines

I am OK skipping colors to keep the PDF
uniform

Quoted 5 lines
Quoted 4 lines

Also add synctex=-1 to prevent pdf readers like
evince from complaining to the pdflatex command
line

Quoted 5 lines
Quoted 3 lines

As for SyncTeX support, how about the approach in the patch below?

Yep that work!

Nice!

I'll submit a v2 of the patch with a proper change log to clarify that you are the original author. I don't think the" Reported-by:" tag is good enough. To be honest, I had no idea of the -synctex option before.

Thanks, Akira

Quoted 8 lines

Balbir Singh.

Quoted 5 lines

Thanks, Akira

Quoted 3 lines

---

[...]

#4 lore raw

PATCH v2 1/1 Add optional flag 'LATEX_OPT' in run{first}latex.sh

From: Balbir Singh <[email protected]>

Add synctex=-1 to prevent pdf readers like
evince from complaining to the pdflatex command
line.

[akiyks: Split from the original patch [1].
Instead of always generating .synctex{.gz} files, add an optional flag to pdflatex commands in run{first}latex.sh scripts.

.synctex files can be generated by defining the environment variable "LATEX_OPT", e.g.:

$ export LATEX_OPT="--synctex=-1"

, and run "make".

Update .gitignore and "claen" in Makefile as well to ignore/remove SyncTeX files.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html
]

---
 .gitignore                 | 1 +
 Makefile                   | 1 +
 utilities/runfirstlatex.sh | 2 +-
 utilities/runlatex.sh      | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)
.gitignore +1 -0
index ebd5e98c..dfeb9e1b 100644
@@ -20,6 +20,7 @@
 *.ltms
 *.pdfp
 *.pdfq
+*.synctex*
 perfbook_flat.tex
 qqz.tex
 contrib.tex
Makefile +1 -0
index 13eddfc8..236b0bb2 100644
@@ -350,6 +350,7 @@ clean:
 	rm -f perfbook_flat.tex perfbook*.out perfbook-*.tex
 	rm -f $(LATEXGENERATED)
 	rm -f CodeSamples/snippets.d
+	rm -f *.synctex*
 	@rm -f $(OBSOLETE_FILES)
 
 distclean: clean
utilities/runfirstlatex.sh +1 -1
index 1a2a7a58..2b25b9f1 100644
@@ -40,7 +40,7 @@ fi
 basename=`echo $1 | sed -e 's/\.tex$//'`
 
 echo "pdflatex 1 for $basename.pdf"
-pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
 if grep -q '! Emergency stop.' $basename.log
 then
 	grep -B 15 -A 5 '! Emergency stop.' $basename.log
utilities/runlatex.sh +1 -1
index 289364d7..18dd7fd6 100644
@@ -51,7 +51,7 @@ identical_warnings () {
 }
 
 iterate_latex () {
-	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+	pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
 	if grep -q '! Emergency stop.' $basename.log
 	then
 		grep -B 15 -A 5 '! Emergency stop.' $basename.log
Signature · 1 line
2.17.1
#5 lore raw

Re: [PATCH v2] Add optional flag 'LATEX_OPT' in run{first}latex.sh

Quoted 17 lines · Akira Yokosawa

From: Balbir Singh <[email protected]>

Add synctex=-1 to prevent pdf readers like
evince from complaining to the pdflatex command
line.

[akiyks: Split from the original patch [1].
Instead of always generating .synctex{.gz} files, add an optional flag to pdflatex commands in run{first}latex.sh scripts.

.synctex files can be generated by defining the environment variable "LATEX_OPT", e.g.:

$ export LATEX_OPT="--synctex=-1"

, and run "make".

Quoted 8 lines

Update .gitignore and "claen" in Makefile as well to ignore/remove SyncTeX files.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html
]

Queued and pushed, thank you both!

Thanx, Paul

Quoted 61 lines
---
 .gitignore                 | 1 +
 Makefile                   | 1 +
 utilities/runfirstlatex.sh | 2 +-
 utilities/runlatex.sh      | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)
.gitignore +1 -0
index ebd5e98c..dfeb9e1b 100644
@@ -20,6 +20,7 @@
 *.ltms
 *.pdfp
 *.pdfq
+*.synctex*
 perfbook_flat.tex
 qqz.tex
 contrib.tex
Makefile +1 -0
index 13eddfc8..236b0bb2 100644
@@ -350,6 +350,7 @@ clean:
 	rm -f perfbook_flat.tex perfbook*.out perfbook-*.tex
 	rm -f $(LATEXGENERATED)
 	rm -f CodeSamples/snippets.d
+	rm -f *.synctex*
 	@rm -f $(OBSOLETE_FILES)
 
 distclean: clean
utilities/runfirstlatex.sh +1 -1
index 1a2a7a58..2b25b9f1 100644
@@ -40,7 +40,7 @@ fi
 basename=`echo $1 | sed -e 's/\.tex$//'`
 
 echo "pdflatex 1 for $basename.pdf"
-pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
 if grep -q '! Emergency stop.' $basename.log
 then
 	grep -B 15 -A 5 '! Emergency stop.' $basename.log
utilities/runlatex.sh +1 -1
index 289364d7..18dd7fd6 100644
@@ -51,7 +51,7 @@ identical_warnings () {
 }
 
 iterate_latex () {
-	pdflatex $basename > /dev/null 2>&1 < /dev/null || :
+	pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
 	if grep -q '! Emergency stop.' $basename.log
 	then
 		grep -B 15 -A 5 '! Emergency stop.' $basename.log
Signature · 1 line
2.17.1
#6 lore raw

PATCH 1/1 Make hyperlinks colorful and browsable in PDF viewer

In reply to Akira Yokosawa

From: Balbir Singh <[email protected]>

Without these changes the PDF does not provide a browsable TOC to choose for navigation, also add a bit of color to the links to make them screen friendly.

[akiyks: Split from patch [1].
As 2c layouts are supposed to be for printing, enable coloring of hyperlinks only in 1c layout. To do this, add a boolean variable "colorlinks" and set it true for 1c layout. This would make it easy to change the condition to enable "colorlinks".

Select "DarkBlue" via xcolor's "svgnames" option as it looks less distracting than the pure "blue".

Redundant framing of links in bibliography is disabled when "colorlinks" is effective.

Also make the page numbers in TOC hyperlinks as well.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html
]

---
Hi Paul and Balbir,

This is an experimental patch.
Does the links in "DarkBlue" acceptable (in 1c layout) to you? Any suggestion of color choice is welcome!

Thanks, Akira
--

 appendix/appendix.tex |  8 ++++++--
 perfbook.tex          | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)
appendix/appendix.tex +6 -2
index d246a7f7..7b0d5c76 100644
@@ -14,9 +14,13 @@
 }{
   \bibliographystyle{alphapf} % Use alpha style customized by urlbst with --inlinelinks option
 }
-\hypersetup{pdfborder=0 0 1,urlbordercolor=0.4 1 1}
+\IfColorLinks{}{
+  \hypersetup{pdfborder=0 0 1,urlbordercolor=0.4 1 1}
+}
 \bibliography{bib/RCU,bib/WFS,bib/hw,bib/os,bib/parallelsys,bib/patterns,bib/perfmeas,bib/refs,bib/syncrefs,bib/search,bib/swtools,bib/realtime,bib/TM,bib/standards,bib/OSS,bib/maze,bib/energy,bib/QC,bib/NP}
-\hypersetup{pdfborder=0 0 0}
+\IfColorLinks{}{
+  \hypersetup{pdfborder=0 0 0}
+}
 \IfTwoColumn{
   \end{adjustwidth*}\twocolumn
 }{
perfbook.tex +14 -2
index 85696333..a0805831 100644
@@ -42,7 +42,7 @@
 \setlist[description]{style=unboxed}
 %\usepackage{enumerate}
 \usepackage{ifthen}
-\usepackage[table]{xcolor}
+\usepackage[table,svgnames]{xcolor}
 \usepackage[shortcuts]{extdash}
 \usepackage{changepage}
 \usepackage{listings}
@@ -58,7 +58,7 @@
 \usepackage{tabularx}
 \usepackage[hyphens]{url}
 \usepackage{threeparttable}
-\usepackage[bookmarks=true,bookmarksnumbered=true,pdfborder={0 0 0}]{hyperref}
+\usepackage[bookmarks=true,bookmarksnumbered=true,pdfborder={0 0 0},linktoc=all]{hyperref}
 \usepackage{footnotebackref} % to enable cross-ref of footnote
 \usepackage[all]{hypcap} % for going to the top of figure and table
 \usepackage{epigraph}
@@ -100,6 +100,18 @@
 \setboolean{nimbusavail}{false}
 \newcommand{\IfNimbusAvail}[2]{\ifthenelse{\boolean{nimbusavail}}{#1}{#2}}
 
+\newboolean{colorlinks}
+\setboolean{colorlinks}{false}
+\newcommand{\IfColorLinks}[2]{\ifthenelse{\boolean{colorlinks}}{#1}{#2}}
+
+\IfTwoColumn{}{
+\setboolean{colorlinks}{true}
+}
+
+\IfColorLinks{
+\hypersetup{colorlinks=true,allcolors=DarkBlue}
+}{}
+
 \IfNimbusAvail{
 \usepackage{nimbusmononarrow}
 }{}
Signature · 1 line
2.17.1
#7 lore raw

Re: [EXP PATCH] Make hyperlinks colorful and browsable in PDF viewer

Quoted 23 lines · Akira Yokosawa

From: Balbir Singh <[email protected]>

Without these changes the PDF does not provide a browsable TOC to choose for navigation, also add a bit of color to the links to make them screen friendly.

[akiyks: Split from patch [1].
As 2c layouts are supposed to be for printing, enable coloring of hyperlinks only in 1c layout. To do this, add a boolean variable "colorlinks" and set it true for 1c layout. This would make it easy to change the condition to enable "colorlinks".

Select "DarkBlue" via xcolor's "svgnames" option as it looks less distracting than the pure "blue".

Redundant framing of links in bibliography is disabled when "colorlinks" is effective.

Also make the page numbers in TOC hyperlinks as well.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html
]

Quoted 7 lines

---
Hi Paul and Balbir,

This is an experimental patch.
Does the links in "DarkBlue" acceptable (in 1c layout) to you?

Oops, obviously I meant "Do the links ...".

Quoted 4 lines

Any suggestion of color choice is welcome!

Thanks, Akira
--

[...]

#8 lore raw

Re: [EXP PATCH] Make hyperlinks colorful and browsable in PDF viewer

In reply to Akira Yokosawa
Quoted 23 lines · Akira Yokosawa

From: Balbir Singh <[email protected]>

Without these changes the PDF does not provide a browsable TOC to choose for navigation, also add a bit of color to the links to make them screen friendly.

[akiyks: Split from patch [1].
As 2c layouts are supposed to be for printing, enable coloring of hyperlinks only in 1c layout. To do this, add a boolean variable "colorlinks" and set it true for 1c layout. This would make it easy to change the condition to enable "colorlinks".

Select "DarkBlue" via xcolor's "svgnames" option as it looks less distracting than the pure "blue".

Redundant framing of links in bibliography is disabled when "colorlinks" is effective.

Also make the page numbers in TOC hyperlinks as well.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html
]

Quoted 8 lines

---
Hi Paul and Balbir,

This is an experimental patch.
Does the links in "DarkBlue" acceptable (in 1c layout) to you? Any suggestion of color choice is welcome!

Being as I am red-green colorblind, I must defer to the two of you on color choices. Looks just fine to me, but... ;-)

Thanx, Paul

Quoted 71 lines

Thanks, Akira
--

 appendix/appendix.tex |  8 ++++++--
 perfbook.tex          | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)
appendix/appendix.tex +6 -2
index d246a7f7..7b0d5c76 100644
@@ -14,9 +14,13 @@
 }{
   \bibliographystyle{alphapf} % Use alpha style customized by urlbst with --inlinelinks option
 }
-\hypersetup{pdfborder=0 0 1,urlbordercolor=0.4 1 1}
+\IfColorLinks{}{
+  \hypersetup{pdfborder=0 0 1,urlbordercolor=0.4 1 1}
+}
 \bibliography{bib/RCU,bib/WFS,bib/hw,bib/os,bib/parallelsys,bib/patterns,bib/perfmeas,bib/refs,bib/syncrefs,bib/search,bib/swtools,bib/realtime,bib/TM,bib/standards,bib/OSS,bib/maze,bib/energy,bib/QC,bib/NP}
-\hypersetup{pdfborder=0 0 0}
+\IfColorLinks{}{
+  \hypersetup{pdfborder=0 0 0}
+}
 \IfTwoColumn{
   \end{adjustwidth*}\twocolumn
 }{
perfbook.tex +14 -2
index 85696333..a0805831 100644
@@ -42,7 +42,7 @@
 \setlist[description]{style=unboxed}
 %\usepackage{enumerate}
 \usepackage{ifthen}
-\usepackage[table]{xcolor}
+\usepackage[table,svgnames]{xcolor}
 \usepackage[shortcuts]{extdash}
 \usepackage{changepage}
 \usepackage{listings}
@@ -58,7 +58,7 @@
 \usepackage{tabularx}
 \usepackage[hyphens]{url}
 \usepackage{threeparttable}
-\usepackage[bookmarks=true,bookmarksnumbered=true,pdfborder={0 0 0}]{hyperref}
+\usepackage[bookmarks=true,bookmarksnumbered=true,pdfborder={0 0 0},linktoc=all]{hyperref}
 \usepackage{footnotebackref} % to enable cross-ref of footnote
 \usepackage[all]{hypcap} % for going to the top of figure and table
 \usepackage{epigraph}
@@ -100,6 +100,18 @@
 \setboolean{nimbusavail}{false}
 \newcommand{\IfNimbusAvail}[2]{\ifthenelse{\boolean{nimbusavail}}{#1}{#2}}
 
+\newboolean{colorlinks}
+\setboolean{colorlinks}{false}
+\newcommand{\IfColorLinks}[2]{\ifthenelse{\boolean{colorlinks}}{#1}{#2}}
+
+\IfTwoColumn{}{
+\setboolean{colorlinks}{true}
+}
+
+\IfColorLinks{
+\hypersetup{colorlinks=true,allcolors=DarkBlue}
+}{}
+
 \IfNimbusAvail{
 \usepackage{nimbusmononarrow}
 }{}
Signature · 1 line
2.17.1
#9 lore raw

Re: [EXP PATCH] Make hyperlinks colorful and browsable in PDF viewer

Quoted 29 lines · Paul E. McKenney
Quoted 28 lines · Akira Yokosawa

From: Balbir Singh <[email protected]>

Without these changes the PDF does not provide a browsable TOC to choose for navigation, also add a bit of color to the links to make them screen friendly.

[akiyks: Split from patch [1].
As 2c layouts are supposed to be for printing, enable coloring of hyperlinks only in 1c layout. To do this, add a boolean variable "colorlinks" and set it true for 1c layout. This would make it easy to change the condition to enable "colorlinks".

Select "DarkBlue" via xcolor's "svgnames" option as it looks less distracting than the pure "blue".

Redundant framing of links in bibliography is disabled when "colorlinks" is effective.

Also make the page numbers in TOC hyperlinks as well.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html
]

---
Hi Paul and Balbir,

Quoted 6 lines
Quoted 3 lines

This is an experimental patch.
Does the links in "DarkBlue" acceptable (in 1c layout) to you? Any suggestion of color choice is welcome!

Being as I am red-green colorblind, I must defer to the two of you on color choices. Looks just fine to me, but... ;-)

Hi Balbir,

Have you tried this patch and seen the resulting PDF (-1c)? If it looks good enough to you, I'd like this patch applied.

Looking forward to hearing from you.

Thanks, Akira

Quoted 74 lines

Thanx, Paul

Quoted 71 lines

Thanks, Akira
--

 appendix/appendix.tex |  8 ++++++--
 perfbook.tex          | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)
appendix/appendix.tex +6 -2
index d246a7f7..7b0d5c76 100644
@@ -14,9 +14,13 @@
 }{
   \bibliographystyle{alphapf} % Use alpha style customized by urlbst with --inlinelinks option
 }
-\hypersetup{pdfborder=0 0 1,urlbordercolor=0.4 1 1}
+\IfColorLinks{}{
+  \hypersetup{pdfborder=0 0 1,urlbordercolor=0.4 1 1}
+}
 \bibliography{bib/RCU,bib/WFS,bib/hw,bib/os,bib/parallelsys,bib/patterns,bib/perfmeas,bib/refs,bib/syncrefs,bib/search,bib/swtools,bib/realtime,bib/TM,bib/standards,bib/OSS,bib/maze,bib/energy,bib/QC,bib/NP}
-\hypersetup{pdfborder=0 0 0}
+\IfColorLinks{}{
+  \hypersetup{pdfborder=0 0 0}
+}
 \IfTwoColumn{
   \end{adjustwidth*}\twocolumn
 }{
perfbook.tex +14 -2
index 85696333..a0805831 100644
@@ -42,7 +42,7 @@
 \setlist[description]{style=unboxed}
 %\usepackage{enumerate}
 \usepackage{ifthen}
-\usepackage[table]{xcolor}
+\usepackage[table,svgnames]{xcolor}
 \usepackage[shortcuts]{extdash}
 \usepackage{changepage}
 \usepackage{listings}
@@ -58,7 +58,7 @@
 \usepackage{tabularx}
 \usepackage[hyphens]{url}
 \usepackage{threeparttable}
-\usepackage[bookmarks=true,bookmarksnumbered=true,pdfborder={0 0 0}]{hyperref}
+\usepackage[bookmarks=true,bookmarksnumbered=true,pdfborder={0 0 0},linktoc=all]{hyperref}
 \usepackage{footnotebackref} % to enable cross-ref of footnote
 \usepackage[all]{hypcap} % for going to the top of figure and table
 \usepackage{epigraph}
@@ -100,6 +100,18 @@
 \setboolean{nimbusavail}{false}
 \newcommand{\IfNimbusAvail}[2]{\ifthenelse{\boolean{nimbusavail}}{#1}{#2}}
 
+\newboolean{colorlinks}
+\setboolean{colorlinks}{false}
+\newcommand{\IfColorLinks}[2]{\ifthenelse{\boolean{colorlinks}}{#1}{#2}}
+
+\IfTwoColumn{}{
+\setboolean{colorlinks}{true}
+}
+
+\IfColorLinks{
+\hypersetup{colorlinks=true,allcolors=DarkBlue}
+}{}
+
 \IfNimbusAvail{
 \usepackage{nimbusmononarrow}
 }{}
Signature · 1 line
2.17.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw

Re: [PATCH RESEND] Make hyperlinks colorful and browsable in PDF viewer

Quoted 19 lines · Akira Yokosawa
Quoted 1 line

From 8b1a3e2402b12c99a36844c642f1ce2bafdd7277 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Wed, 18 Sep 2019 19:40:14 +0900
Subject: [PATCH v2] Make hyperlinks colorful and browsable in PDF viewer

Balbir suggested coloring hyperlinks to make them easier to recognize [1].

As 2c layouts are supposed to be for printing, enable coloring of hyperlinks only in 1c layout. To do this, add a boolean variable "colorlinks" and set it true for 1c layout. This would make it easy to change the condition to enable "colorlinks".

Select "MediumBlue" via xcolor's "svgnames" option as it looks less distracting than the pure "blue", but still distinguishable.

Redundant framing of links in bibliography is disabled when "colorlinks" is effective.

Quoted 6 lines

Also make the page numbers in TOC hyperlinks as well.

[1]: https://www.spinics.net/lists/perfbook/msg02350.html

Queued and pushed, thank you both!

Thanx, Paul

Quoted 89 lines

---
Hi Paul,

As I couldn't get Balbir's ack for a week or so, I'm resending this patch as the author.

Changes from EXP PATCH:

o Color of links is changed to MediumBlue. Depending on display settings/resolution, DaukBlue is sometimes hard to distinguish especially with serif font. For bold "Quick Quiz", DarkBlue could be a better choice. Such an optimization can be done in the future.

o Substitute Balbir's Suggested-by: for his Signed-of-by:.

o Edit change log to reflect the circumstances.

Thanks, Akira
--

 appendix/appendix.tex |  8 ++++++--
 perfbook.tex          | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)
appendix/appendix.tex +6 -2
index d246a7f7..7b0d5c76 100644
@@ -14,9 +14,13 @@
 }{
   \bibliographystyle{alphapf} % Use alpha style customized by urlbst with --inlinelinks option
 }
-\hypersetup{pdfborder=0 0 1,urlbordercolor=0.4 1 1}
+\IfColorLinks{}{
+  \hypersetup{pdfborder=0 0 1,urlbordercolor=0.4 1 1}
+}
 \bibliography{bib/RCU,bib/WFS,bib/hw,bib/os,bib/parallelsys,bib/patterns,bib/perfmeas,bib/refs,bib/syncrefs,bib/search,bib/swtools,bib/realtime,bib/TM,bib/standards,bib/OSS,bib/maze,bib/energy,bib/QC,bib/NP}
-\hypersetup{pdfborder=0 0 0}
+\IfColorLinks{}{
+  \hypersetup{pdfborder=0 0 0}
+}
 \IfTwoColumn{
   \end{adjustwidth*}\twocolumn
 }{
perfbook.tex +14 -2
index 42f39e77..6eae887c 100644
@@ -42,7 +42,7 @@
 \setlist[description]{style=unboxed}
 %\usepackage{enumerate}
 \usepackage{ifthen}
-\usepackage[table]{xcolor}
+\usepackage[table,svgnames]{xcolor}
 \usepackage[shortcuts]{extdash}
 \usepackage{changepage}
 \usepackage{listings}
@@ -58,7 +58,7 @@
 \usepackage{tabularx}
 \usepackage[hyphens]{url}
 \usepackage{threeparttable}
-\usepackage[bookmarks=true,bookmarksnumbered=true,pdfborder={0 0 0}]{hyperref}
+\usepackage[bookmarks=true,bookmarksnumbered=true,pdfborder={0 0 0},linktoc=all]{hyperref}
 \usepackage{footnotebackref} % to enable cross-ref of footnote
 \usepackage[all]{hypcap} % for going to the top of figure and table
 \usepackage{epigraph}
@@ -100,6 +100,18 @@
 \setboolean{nimbusavail}{false}
 \newcommand{\IfNimbusAvail}[2]{\ifthenelse{\boolean{nimbusavail}}{#1}{#2}}
 
+\newboolean{colorlinks}
+\setboolean{colorlinks}{false}
+\newcommand{\IfColorLinks}[2]{\ifthenelse{\boolean{colorlinks}}{#1}{#2}}
+
+\IfTwoColumn{}{
+\setboolean{colorlinks}{true}
+}
+
+\IfColorLinks{
+\hypersetup{colorlinks=true,allcolors=MediumBlue}
+}{}
+
 \IfNimbusAvail{
 \usepackage{nimbusmononarrow}
 }{}
Signature · 1 line
2.17.1