Use this function to export your codebook specification to a PDF file. To embed it in an R Markdown file, use !!! CREATE rock::knit_codebook() !!!

codebook_to_pdf(
  x,
  file,
  author = NULL,
  headingLevel = 1,
  silent = rock::opts$get("silent")
)

Arguments

x

The codebook object (as produced by a call to codebook_fromSpreadsheet()).

file

The filename to save the codebook to.

author

The author to specify in the PDF.

headingLevel

The level of the top-most headings.

silent

Whether to be silent or chatty.

Value

x, invisibly

Examples

# \donttest{
### Use a temporary file to write to
tmpFile <- tempfile(fileext = ".pdf");

### Load an example (pre)registration specification
data("exampleCodebook_1", package = "rock");

rock::codebook_to_pdf(
  exampleCodebook_1,
  file = tmpFile
);
#> ! Font T1/cmr/m/n/10=ecrm1000 at 10.0pt not loadable: Metric (TFM) file not fou
#> nd.
#> <to be read again> 
#>                    relax 
#> l.105 \fontencoding\encodingdefault\selectfont
#> 
#> ! kpathsea: Running mktextfm ecrm1000
#> 
#> ! /usr/share/texlive/texmf-dist/web2c/mktexnam: Could not map source abbreviation  for ecrm1000.
#> 
#> ! /usr/share/texlive/texmf-dist/web2c/mktexnam: Need to update ?
#> 
#> ! mktextfm: Running mf \mode:=ljfour; mag:=1; nonstopmode; input ecrm1000
#> 
#> ! /usr/bin/mktextfm: line 106: mf: command not found
#> 
#> ! grep: ecrm1000.log: No such file or directory
#> 
#> ! mktextfm: `mf \mode:=ljfour; mag:=1; nonstopmode; input ecrm1000' failed to make ecrm1000.tfm.
#> 
#> ! kpathsea: Appending font creation commands to missfont.log.
#> Error: LaTeX failed to compile /tmp/Rtmp2hCmK5/file39254a54678df8.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See file39254a54678df8.log for more info.
# }