defSconcordance: Support for non-Sweave concordances.

View source: R/knitr.R

defSconcordanceR Documentation

Support for non-Sweave concordances.

Description

Sweave automatically inserts concordances into the output file, so they will be embedded in the ‘.dvi’ or ‘.pdf’ output using the LaTeX macro ⁠\Sconcordance⁠ from the ‘Sweave.sty’ style file. Other vignette processing engines (e.g. knitr) do not use ‘Sweave.sty’, so defSconcordance defines the macro explicitly.

The useknitr function is specific to knitr documents. If writeMacro is TRUE, it calls defSconcordance to write the macro definition to the output file. If writeMacro is not specified, it guesses the value by looking for ⁠\begin{document}⁠ somewhere in the first 100 lines of the file. It always writes the ⁠\input⁠ line for the concordances into the file.

Usage

defSconcordance()
useknitr(writeMacro)

Arguments

writeMacro

logical; whether to call defSconcordance

Details

This function is not necessary when using Sweave, it is only for other vignette engines.

With knitr, the concordances would be written to a file with a name typically be of the form ‘basename-concordance.tex’, where the input file was ‘basename.Rnw’. You would insert it with code like

<<results="asis">>=
patchDVI::useknitr()
@

If the document does use the ‘Sweave.sty’ style, or if it is being included in another larger document, do not use defSconcorance: this can be forced by calling patchDVI::useknitr(writeMacro = FALSE).

Value

These functions are called for the side effect of writing out the LaTeX code.

Author(s)

Duncan Murdoch

Examples

defSconcordance()

patchDVI documentation built on March 31, 2023, 11:34 p.m.