r-universe-org / help

Support and bug tracker for R-universe
https://docs.r-universe.dev/
9 stars 2 forks source link

Pdf manual fail to build with TinyTex: Unicode character not set up for use with LaTeX #336

Closed jeroen closed 3 months ago

jeroen commented 9 months ago

PDF manuals fail to build if a help page contains utf-8 characters for which it doesn't have a fond?

Is there a way for latex to just replace this with a tofu?

Piggyback fails with:

LaTeX errors:
! LaTeX Error: Unicode character ℹ (U+2139)
               not set up for use with LaTeX.

Which seems to be inserted by cli here

#' @return Writes file to release and returns github API response
#' @examples \donttest{
#' \dontshow{if (interactive()) \{}
#'   pb_write(mtcars, "mtcars.rds", repo = "tanho63/piggyback-tests")
#'   #> ℹ Uploading to latest release: "v0.0.2".
#'   #> ℹ Uploading mtcars.rds ...
#'   #> |===============================================================| 100%
#' \dontshow{\}}
#'}

And gt fails with:

LaTeX errors:
! LaTeX Error: Unicode character ⁠ (U+2060)
               not set up for use with LaTeX.

In the case of gt it seems to be

\if{html}{\out{<div class="sourceCode r">}}\preformatted{reactions |>
  dplyr::filter(cmpd_type == "nitrophenol") |>
  dplyr::select(cmpd_name, OH_k298, Cl_k298) |>
  dplyr::filter(!(is.na(OH_k298) & is.na(Cl_k298))) |>
  gt(rowname_col = "cmpd_name") |>
  tab_spanner(
    label = "Rate constant at 298 K, in \{\{cm^3 molecules^–1 s^–1⁠<0x2060>\}\}",
    columns = ends_with("k298")
  ) |>

Latex is such a headache. We have html manuals now, maybe let's just get rid of the pdf ones?

roaldarbol commented 7 months ago

Agree on this. The HTML documentation is a far better user experience anyways. (Landed here as I currently have source build failing solely because it cannot render the PDF due to LaTeX errors - for reference: https://github.com/r-universe/roaldarbol/actions/runs/7879432188/job/21499673403)

jeroen commented 3 months ago

Using the xelatex fixes the issue, however it is very slow. So maybe we can only fall back on it if regular pdflatex fails.