Skip to content

PDF Graph Device different between OS #594

@simonreif

Description

@simonreif

In my quest to find as many edge cases as possible: Related to #480, when I build the default.nix from the rix script below

a) On a Macboc M1, Tahoe 26.3, there is no cairo_pdf available
b) On a VM with Debian GNU/Linux 12 (bookworm), there is cairo_pdf available

I check this using capabilities()["cairo"] within R.

On both machines, the non-nix R does have cairo_pdf.

Why this matters: The way graphs in LaTeX PDF Output from Quarto look differ by whether the graph pdfs that are generated by Quarto and used by LaTeX are different dependent on whether cairo was used or not. While this is often a minor issue, page numbers in longer PDFs are different because graphs are slightly smaller or larger.

Ideal solution: The default.nix from Rix should always (or never) point to R versions / environments that work with cairo_pdf.

Workarounds: One could just use pngs. But this takes away all the advantages of vector graphs.

library(rix)

path_default_nix <- getwd()

rix(
  date = "2025-08-18",
  r_pkgs = c(
    "here",
    "data.table",
    "dplyr",
    "tidyr",
    "stringr",
    "lubridate",
    "ggplot2",
    "ggpubr",
    "europepmc",
    "fixest",
    "broom",
    "lmtest",
    "readxl",
    "jsonlite",
    "kableExtra",
    "SCtools@0.3.2",
    "Synth"
  ),
  git_pkgs = list(
    list(
      package_name = "synthdid",
      repo_url = "https://github.com/synth-inference/synthdid",
      commit = "70c1ce3eac58e28c30b67435ca377bb48baa9b8a"
    )),
  system_pkgs = c("quarto", "git", "gnumake"),
  tex_pkgs = c(
    "setspace",
    "lipsum",
    "txfonts",
    "csquotes",
    "geometry",
    "float",
    "multirow",
    "colortbl",
    "booktabs",
    "threeparttable",
    "caption",
    "xcolor",
    "fontspec",
    "amsfonts",
    "titling",
    "biblatex",
    "collection-bibtexextra",
    "hyperref",
    "placeins",
    "pdflscape",
    "framed"
  ),
  project_path = path_default_nix,
  overwrite = TRUE,
  print = FALSE
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions