From murdoch@dunc@n @end|ng |rom gm@||@com  Sat Nov 26 14:54:02 2022
From: murdoch@dunc@n @end|ng |rom gm@||@com (Duncan Murdoch)
Date: Sat, 26 Nov 2022 08:54:02 -0500
Subject: [Rd] Concordances in R Markdown
Message-ID: <a07f82a4-17c1-c64b-15a9-4155b4504ee5@gmail.com>

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



[Rd] Concordances in R Markdown
Duncan Murdoch