Skip to content

Option to force \code{} #975

Closed
Closed

Description

@yutannihilation

I see this diff using roxygen2 7.0

- \code{axis.line.y.left}, \code{axis.line.y.right}). \code{axis.line.*.*} inherits from
- \code{axis.line.*} which inherits from \code{axis.line}, which in turn inherits
+ \code{axis.line.y.left}, \code{axis.line.y.right}). \verb{axis.line.*.*} inherits from
+ \verb{axis.line.*} which inherits from \code{axis.line}, which in turn inherits

(https://github.com/tidyverse/ggplot2/pull/3630/files#diff-9f5c5fab9e6d56acc2a036749a3fb531L70-R145)

I think \code{} should be used here because axis.line.* is a symbol, not a part of code snippet. Though this doesn't seem a big issue (and I don't know well about what \verb{} is), I'm filing this issue just for notice. Please feel free to close if this is not a problem.

Activity

  1. lionel- commented on Nov 18, 2019

    @lionel-
    Member

    See also #971.

  2. gaborcsardi commented on Nov 18, 2019

    @gaborcsardi
    Member

    I think \code{} should be used here because axis.line.* is a symbol

    \code{} must be valid R code, and axis.line.* is not, so according to the Rd rules, it has to be \verb{}. Not that it matters much for the output, because both \verb{} and \code{} are displayed the same exact way AFAIK.

  3. yutannihilation commented on Nov 18, 2019

    @yutannihilation
    ContributorAuthor

    \code{} must be valid R code

    I'm not sure if Writing R Extension explicitly says so. In my understanding, the R code on Rd is not necessarily valid except when it's intended to run as it says about \examples{}:

    Text included in \dontrun is indicated by comments in the processed help files: it need not be valid R code but the escapes must still be used for %, \ and unpaired braces as in other ‘verbatim’ text.

    I'm also not sure if this applies \code{} or not, though.

  4. gaborcsardi commented on Nov 18, 2019

    @gaborcsardi
    Member

    I'm not sure if Writing R Extension explicitly says so. In my understanding, the R code on Rd is not necessarily valid except when it's intended to run as it says about \examples{}:

    It is in Table 3: https://developer.r-project.org/parseRd.pdf

  5. yutannihilation commented on Nov 18, 2019

    @yutannihilation
    ContributorAuthor

    Thanks, probably it's just I don't understand the terminologies. Sorry for the noise...

  6. gaborcsardi commented on Nov 18, 2019

    @gaborcsardi
    Member

    Basically in that document "R-like" means syntactically valid R code. This holds for \examples{}, \usage{}, etc., and \code{} as well. But R CMD check does not enforce it for \code{} because many packages misuse it. That is my understanding. :)

  7. yutannihilation commented on Nov 18, 2019

    @yutannihilation
    ContributorAuthor

    But R CMD check does not enforce it for \code{} because many packages misuse it

    Ah, got it! I was wondering why R CMD check didn't bite us if it's not valid... Then I totally agree with you. Closing this now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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