Skip to content

Backslashes added to citations @ signs when switching to visual mode #11279

Closed

Description

@ronblum

System details

RStudio Edition : Desktop & Server
RStudio Version : RStudio-2022.02.2-485 and 2022.06.0-daily+421
OS Version      : MacOS 12.4, Ubuntu 20.04 via Chrome on MacOS 12.4
R Version       : 4.2.0

Steps to reproduce the problem

  1. Download and unzip the following: travis-main.zip
  2. Open the file README.Rmd.
  3. Switch to visual mode.
  4. Switch back to source mode.

Note that the file has to be saved. So if tried by copying the contents of README.Rmd into a new file, the new file first needs to be saved before the behavior occurs.

Describe the problem in detail

Backslashes are added to the citations, so @ becomes \@ and is no longer treated as a citation. For example,

[@wood_visualizing_2011; @vonschmidt_webbased_2019; @morgan2020; @beecham2022]

becomes

 [\@wood_visualizing_2011; \@vonschmidt_webbased_2019; \@morgan2020; \@beecham2022]

Describe the behavior you expected

Citations should remain unaffected. This looks like another variation of #10075.

Triage: Note that #10075 was backported.

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    visual markdown
    on May 24, 2022
  2. ailich commented on Jun 13, 2022

    @ailich

    I am also experiencing this when switching between source and visual editor. I have a reproducible example up on my github. I get a backslash if there is a call to equations with custom prefixes in the same sentence, or if there is no space between the closing parentheses around the figure cross reference and the citation.

    For example:
    This in source editor
    Screenshot 2022-06-13 110936

    Will properly render to this
    Screenshot 2022-06-13 110950

    However if I switch to visual editor and then back, backslashes have now been added by around the reference
    Screenshot 2022-06-13 111209

    So now it renders to this
    Screenshot 2022-06-13 111244

    I'm using R 4.2.0, Rstudio version "2022.06.0-daily+512" and quarto-version: 0.9.254

  3. jjallaire commented on Jun 14, 2022

    @jjallaire
    Member

    The README.Rmd issue is fixed here: 36db347

    Will investigate the other report now.

  4. jjallaire commented on Jun 14, 2022

    @jjallaire
    Member

    The other issue is quite complicated to untangle, and I don't think something we can fix for this release (too much risk of regression). Let's validate the first fix and then keep the bug open for the EG release.

  5. self-assigned this
    on Jun 14, 2022
  6. ronblum commented on Jun 15, 2022

    @ronblum
    ContributorAuthor

    Verified that the README behavior is now correct. Moving to next release for part 2.

  7. removed their assignment
    on Jun 15, 2022
  8. jjallaire commented on Feb 9, 2023

    @jjallaire
    Member

    The behavior in the original bug report appears to now be fixed in the latest writer code (I did some work on citation escaping a couple of months ago that likely resolved it). Not sure if there are other behaviors described here that should also be verified?

  9. self-assigned this
    on Feb 9, 2023
  10. ronblum commented on Feb 14, 2023

    @ronblum
    ContributorAuthor

    Verified that the second issue, with cross references, is now resolved as well. Tested in RStudio Desktop 2023.03.0-daily+318 on MacOS 13.2.

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

Metadata

Metadata

Labels

bugvisual markdown

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions