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.
defSconcordance()
useknitr(writeMacro)
These functions are called for the side effect of writing out the LaTeX code.
logical; whether to call defSconcordance
Duncan Murdoch
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)
.