Skip to content

Commit

Permalink
add the ability to control coloring or bordering around hyperlinks fr…
Browse files Browse the repository at this point in the history
…om index.rmd
  • Loading branch information
ulyngs committed May 30, 2021
1 parent d1d3c40 commit ad3486c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
13 changes: 12 additions & 1 deletion index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ natbib-bibliography-style: ACM-Reference-Format #or plainnat or some .bst file y
### correction highlighting ###
corrections: true

### link highlighting ###
colored-not-bordered-links: true # true = highlight text of links - false = highlight links with border

# Set the link text/bord coloring here, in RGB.
# Comment out a variable to just use whatever the text's existing color is.
# If you wish NOT to highlight links, set colored-not-bordered-links: true,
# and comment out the colors below
urlcolor-rgb: "0,0,139"
citecolor-rgb: "0,33,71"
# linkcolor-rgb: "0,33,71" # coloring normal links looks a bit excessive, as it highlights also all links in the table of contents


### binding / margins ###
page-layout: nobind #'nobind' for equal margins (PDF output), 'twoside' for two-sided binding (mirror margins and blank pages), leave blank for one-sided binding (left margin > right margin)

Expand Down Expand Up @@ -119,7 +131,6 @@ frontmatter-linespacing: 17pt plus1pt minus1pt #spacing in roman-numbered pages

### other stuff ###
abstractseparate: false # include front page w/ abstract for examination schools?
hidelinks: true # false to highlight clickable links with a colored border
includeline-num: false #show line numbering in PDF?


Expand Down
34 changes: 32 additions & 2 deletions templates/template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,38 @@

%%%%% ADDING LATEX PACKAGES
% add hyperref package with options from YAML %
\usepackage[colorlinks=false,pdfpagelabels$if(hidelinks)$,hidelinks$endif$]{hyperref}
\usepackage[pdfpagelabels]{hyperref}
% change the default coloring of links to something sensible
\usepackage{xcolor}

$if(linkcolor-rgb)$
\definecolor{mylinkcolor}{RGB}{$linkcolor-rgb$}
$endif$
$if(urlcolor-rgb)$
\definecolor{myurlcolor}{RGB}{$urlcolor-rgb$}
$endif$
$if(citecolor-rgb)$
\definecolor{mycitecolor}{RGB}{$citecolor-rgb$}
$endif$

$if(colored-not-bordered-links)$
\hypersetup{
hidelinks,
colorlinks,
linkcolor=$if(linkcolor-rgb)$mylinkcolor$else$.$endif$,
urlcolor=$if(urlcolor-rgb)$myurlcolor$else$.$endif$,
citecolor=$if(citecolor-rgb)$mycitecolor$else$.$endif$
}

$else$
\hypersetup{
colorlinks=false,
linkbordercolor=$if(linkcolor-rgb)$mylinkcolor$else$.$endif$,
urlbordercolor=$if(urlcolor-rgb)$myurlcolor$else$.$endif$,
citebordercolor=$if(citecolor-rgb)$mycitecolor$else$.$endif$
}
$endif$


% add float package to allow manual control of figure positioning %
\usepackage{float}
Expand All @@ -44,7 +75,6 @@

% use soul package for correction highlighting
\usepackage{color, soul}
\usepackage{xcolor}
\definecolor{correctioncolor}{HTML}{CCCCFF}
\sethlcolor{correctioncolor}
\newcommand{\ctext}[3][RGB]{%
Expand Down

0 comments on commit ad3486c

Please sign in to comment.