ctex.R 1019 B

1234567891011121314151617181920212223242526272829
  1. #' A PDF format for documents based on the LaTeX package \pkg{ctex}
  2. #'
  3. #' \code{ctex()} is a wrapper function for \code{rmarkdown::pdf_document()} and
  4. #' changed the default values of two arguments \code{template} and
  5. #' \code{latex_engine} so it works better with the \pkg{ctex} package.
  6. #' @param ...,template,latex_engine Passed to
  7. #' \code{markdown::\link[rmarkdown]{pdf_document}()}
  8. #' @return \code{ctex()} returns a format that can be passed to
  9. #' \code{rmarkdown::render()}; \code{ctex_template()} returns the path to a
  10. #' LaTeX template in \pkg{rticles} for Chinese documents using the \pkg{ctex}
  11. #' package.
  12. #'
  13. #' @examples
  14. #'
  15. #' \dontrun{
  16. #' library(rmarkdown)
  17. #' draft("MyArticle.Rmd", template = "ctex", package = "rticles")
  18. #' }
  19. #'
  20. #' @export
  21. ctex <- function(..., template = ctex_template(), latex_engine = 'xelatex') {
  22. inherit_pdf_document(..., template = template, latex_engine = latex_engine)
  23. }
  24. #' @rdname ctex
  25. #' @export
  26. ctex_template <- function() find_resource('ctex', 'default.latex')