[Rd] Concordances in R Markdown
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Sat Nov 26 14:54:02 CET 2022
I submitted some code to support concordances to R-devel, and wrote this
blog article about it:
https://blog.r-project.org/2022/10/20/concordances/index.html
(Concordances are links from a source file to pre-processed output from
Sweave or knitr.)
In the article I said "as far as I know, Pandoc doesn’t support any way
to relate input lines to output lines", and asked to be corrected if
that was wrong. I was corrected! Heather Turner pointed me in the
direction of this:
https://github.com/jgm/pandoc/issues/4565#issuecomment-749294039
She also worked out the initial details of how to make use of it.
Thanks Heather!
I have now put together a package called RmdConcord (see
https://github.com/dmurdoch/RmdConcord) which exports R Markdown drivers
that incorporate concordances. This means that previewers like TeXworks
that support Synctex will now synchronize the output with the true
input, which makes editing a lot easier. If you have complaints from
HTML Tidy about your vignettes, they should also refer to the original
source now.
The package requires changes to the knitr package to support
concordances in R Markdown documents, and to the backports package to
support the R-devel concordance additions in earlier versions of R.
I've submitted pull requests to both packages to include these changes,
but in the meantime, you will need to install my devel versions of them:
devtools::install_github("dmurdoch/backports")
devtools::install_github("dmurdoch/knitr")
devtools::install_github("dmurdoch/RmdConcord")
If anyone is interested in testing this, I'd appreciate bug reports and
suggestions.
Duncan Murdoch
More information about the R-devel
mailing list