I'm attempting to set up a boilerplate report using parameters. One parameter is a species name, which I would like to have italicized in the report title. I can get the parameter into the title, but I've tried every combination of pasting "*", bquote(italics()), expression(italics()), and substitute(italics()) I can think of.
This works but doesn't italicize:
---
params:
TargetTaxon: "Peromyscus maniculatus"
UnitName: "Yosemite National Park"
title: |
| Species Occurrence Report for
| `r params$TargetTaxon\
| in `r params$UnitName\
author: "tp"
date: "\
r format(Sys.time(), '%d %B, %Y')`"
output: html_document
---
These have not worked:
| `r paste0('*', params$TargetTaxon, '*')`
| `r bquote(~italic(.(params$TargetTaxon)))`
| `r expression(italic(params$TargetTaxon))`
with or without the tilde ~ and .() wrapping.
Most combinations throw errors about
Error in vapply(x, format_sci_one, character(1L), ..., USE.NAMES = FALSE) :
values must be length 1,
but FUN(X[[2]]) result is length 2
Calls: ... paste -> hook -> .inline.hook -> format_sci -> vapply
Execution halted
| `r bquote(italic(.(params$TargetTaxon)))`
returns: "italic, Peromyscus maniculatus" as the second line of the title.
I suspect I could use explicit html or LaTeX tags for italics, but this Rmd will be rendered to both output formats.