@@ -327,13 +327,24 @@ rjournal_web_article <- function(toc = FALSE,
327327rjournal_pdf_article <- function (... , self_contained = FALSE ) {
328328 fmt <- rticles :: rjournal_article(... )
329329 post_process <- fmt $ post_processor
330- fmt $ post_processor <- function (... ) {
330+ fmt $ post_processor <- function (metadata , utf8_input , output_file , clean , verbose ) {
331+
332+ # Replace \@ref(***) with \ref{***}
333+ file <- xfun :: with_ext(output_file , ' .tex' )
334+ lines <- xfun :: read_utf8(file )
335+ # # From bookdown/R/latex.R
336+ lines = gsub(
337+ ' (?<!\\\\ textbackslash{})@ref\\ (([-/:[:alnum:]]+)\\ )' , ' \\\\ ref{\\ 1}' , lines ,
338+ perl = TRUE
339+ )
340+ xfun :: write_utf8(lines , file )
341+
331342 sty_origin <- list.files(system.file(" tex" , package = " rjdistill" ),
332343 full.names = TRUE )
333344 sty_dest <- file.path(" ." , basename(sty_origin ))
334345 copied <- file.copy(sty_origin , sty_dest )
335346 on.exit(unlink(sty_dest [copied ]))
336- post_process(... )
347+ post_process(metadata , utf8_input , output_file , clean , verbose )
337348 }
338349 # output_format(
339350 # knitr = knitr_options(),
0 commit comments