RStudio 2022.07.1 Build 554
OS Mac M1 Air

### Bug description

What happens depends on the document class. Described below.

If one passes in `hyperrefoptions: `

```
  pdf:
    documentclass: scrbook
    keep-tex: true
    hyperrefoptions: 
      - "colorlinks=true"
      - "linkcolor=blue"
      - "urlcolor=cyan"
```
This is correctly passed to hyperref in the tex output. At top of generated tex:
```
\PassOptionsToPackage{unicode,colorlinks=true,linkcolor=blue,urlcolor=cyan}{hyperref}
```
But below that (after line 100  in the generated tex) is this `\hypersetup` command which overrides that.

**`documentclass: scrbook` and `book`**

No hyperlink color are seen because the `\hyperref` setup is not changed and includes `hidelinks`.
```
\hypersetup{
  pdftitle={title},
  pdfauthor={author},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}
```

**`documentclass: scrarticle`, `article`, `krantz`, `svmono`, `report`, `memoir`**

Passing in any `hyperrefoptions: `, including `colorlinks=false`, triggers a change to `\hypersetup` to turn on colorlinks but none of the info in `hyperrefoptions` is used.

The code the generated tex is this
```
\hypersetup{
  pdftitle={title},
  pdfauthor={the author},
  colorlinks=true,
  linkcolor={blue},
  filecolor={Maroon},
  citecolor={Blue},
  urlcolor={Blue},
  pdfcreator={LaTeX via pandoc}}
```
whether one puts this
```
    hyperrefoptions: 
      - "colorlinks=false"
```
or this (or anything else)
```
    hyperrefoptions: 
      - "colorlinks=true"
      - "urlcolor=red"
```
in the format pdf YAML.

Note in all cases the hyperref options are passed to hyperref at the top of the tex file, it's just that they are being overridden later by `\hypersetup`

Personally as a LaTeX user, I find this preferable

```
    hyperrefoptions: 
      - "colorlinks=true"
      - "linkcolor=blue"
      - "urlcolor=cyan"
```
over this 
```
    colorlinks: true
    linkcolor: blue
    urlcolor: cyan
```
The former is what I use for `classoptions` and `geometry` and it is 100% clear what I am doing, i.e. I am setting the hyperref package options and I can look up all the possible options for that package. But the can co-exist just need the `\hyperrefoptions` commands to make it into `\hypersetup`.


### `quarto check` Output

```
[✓] Checking Quarto installation......OK
      Version: 1.0.38
      Path: /Applications/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.9.12
      Path: /opt/homebrew/opt/python@3.9/bin/python3.9
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.1.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/eli.holmes/Library/R/x86_64/4.1/library
        - /Library/Frameworks/R.framework/Versions/4.1/Resources/library
      rmarkdown: 2.14

[✓] Checking Knitr engine render......OK
```

### `quarto tools check` Output

```
[✓] Inspecting tools

Tool         Status                    Installed     Latest  
chromium     Not installed             ---           869685  
tinytex      External Installation     ---           v2022.08
```

MWE qmd
```
---
title: title
author:
  - name: the author
editor: source
format:
  pdf:
    documentclass: scrbook
    keep-tex: true
    hyperrefoptions: 
      - "colorlinks=true"
      - "linkcolor=blue"
      - "urlcolor=cyan"
---

# Intro

[Quarto](https://quarto.org/) is great.

```

### Checklist

- [x] [formatted your issue](https://yihui.org/issue/#please-format-your-issue-correctly) so it is easier for us to read?
- [x] included a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [x] documented the quarto version you're running, by pasting the output from running `quarto check` in the "Quarto Check Output" text area?
- [x] documented the version of the quarto tools you're running, by providing the output from running `quarto tools check` in the "Quarto Tools Check Output" text area?
- [x] documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [x] documented which operating system you're running? If on Linux, please provide the specific distribution as well.
- [x] upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?
dragonstyle
2022-08-20T16:48:21Z
eeholmes
bug
v1.2
closed
For PDF, hyperrefoptions being overridden by \hypersetup
https://github.com/quarto-dev/quarto-cli/issues/2017