Last active
December 2, 2019 02:30
-
-
Save wmay/c7c68a5cb385c56ff61582a15a0a88c6 to your computer and use it in GitHub Desktop.
Simple Latex knitr engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Latex engine test" | |
author: "William May" | |
date: "December 1, 2019" | |
output: pdf_document | |
--- | |
```{r setup, include=FALSE} | |
library(knitr) | |
opts_chunk$set(echo = TRUE) | |
# a simple Latex engine | |
eng_latex <- function(options) { | |
# the original latex code is also the output | |
out <- c("\\bigskip", options$code) | |
# don't process the latex output | |
options$results <- "asis" | |
engine_output(options, options$code, out) | |
} | |
knitr::knit_engines$set(latex = eng_latex) | |
``` | |
We should see the output of this latex code: | |
```{latex test} | |
\begin{enumerate} | |
\item Cat | |
\item Dog | |
\end{enumerate} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment