Re: [Rd] Concordances in R Markdown

2022-11-28 Thread Duncan Murdoch

Two quick updates:

I will (probably) merge the Markdown support code into the patchDVI 
package (currently in the RmdConcord branch), instead of creating a new 
package.  So install instructions should be:


   devtools::install_github("dmurdoch/backports")
   devtools::install_github("dmurdoch/knitr")
   devtools::install_github("dmurdoch/patchDVI@RmdConcord")

I need to finish some integration with patchDVI and finalize my decision 
before merging that code into the main branch of patchDVI, but it's 
basically working now.


Secondly, with John Nash's help, I've identified some important 
limitations of the current Pandoc support.  Most importantly, Markdown 
citations (e.g. [@doe99]) are not handled.  Apparently this extension is 
being worked on, but there's no predicted completion date.  All the 
limitations that I know about are now documented in the patchDVI vignette.


Duncan Murdoch

On 26/11/2022 8:54 a.m., Duncan Murdoch wrote:

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


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Concordances in R Markdown

2022-11-26 Thread Duncan Murdoch
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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel