From 24430e728dddd79e976d62e54a3f8076dbf6a29f Mon Sep 17 00:00:00 2001 From: smeyer Date: Mon, 27 Jan 2025 14:26:56 +0000 Subject: [PATCH] trim aliases in Rd2latex(), too git-svn-id: https://svn.r-project.org/R/trunk@87650 00db46b3-68df-0310-9c12-caf00c1e9a41 --- doc/NEWS.Rd | 6 +++++- src/library/tools/R/Rd2latex.R | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/NEWS.Rd b/doc/NEWS.Rd index 3509abc918..dcabc6fede 100644 --- a/doc/NEWS.Rd +++ b/doc/NEWS.Rd @@ -516,7 +516,11 @@ returns \code{srcref} entries correctly. (Note that there is also a change to the interpretation of \code{skip}; see the C-LEVEL API entry above.) - } + + \item \code{tools::Rd2latex()} now removes leading and trailing + spaces from \verb{\alias} entries as documented, fixing indexing + and linking hiccups in some PDF manuals. + } } } diff --git a/src/library/tools/R/Rd2latex.R b/src/library/tools/R/Rd2latex.R index 318f4ed2ce..97607c512b 100644 --- a/src/library/tools/R/Rd2latex.R +++ b/src/library/tools/R/Rd2latex.R @@ -1,7 +1,7 @@ # File src/library/tools/R/Rd2latex.R # Part of the R package, https://www.R-project.org # -# Copyright (C) 1995-2024 The R Core Team +# Copyright (C) 1995-2025 The R Core Team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -341,6 +341,7 @@ Rd2latex <- function(Rd, out = "", defines = .Platform$OS.type, stop("alias:\n", sQuote(paste(alias, collapse = "\n")), "\nis not one line") + alias <- trim(alias) aa <- "\\aliasA{" ## Some versions of hyperref (from 6.79d) have trouble indexing these ## |, || in base, |.bit, %||% in ggplot2 ...