2016-02-19 61 views
5

什麼是等價於乳膠\texttt的R降價?什麼是等價於LaTeX texttt的R markdown?

有了這個MWE:

--- 
title: "A test" 
author: "Alessandro" 
date: "February 19, 2016" 
output: pdf_document 
--- 
```{r, echo=FALSE} 
d<-data.frame(product_name=c('d','a','b','c')) # what to write here to get a typewriter font? 
``` 

Product names are: `r sort(d$product_name)`. 

我得到這個PDF:

enter image description here

雖然我想從這個.tex file

\documentclass[a4paper]{article} 

\usepackage[english]{babel} 
\usepackage[utf8x]{inputenc} 
\usepackage{amsmath} 
\usepackage{graphicx} 
\usepackage[colorinlistoftodos]{todonotes} 

\title{A test} 
\author{Alessandro} 

\begin{document} 
\maketitle 
Product names are: \texttt{a, b, c, d}. 

\end{document} 

enter image description here

得到的輸出

回答

4

這樣做沒有本地降價方式。但是,當輸出格式爲pdf_document,該rmarkdown相當於\texttt\texttt本身:

Product names are: \texttt{`r sort(d$product_name)`}. 

Rmarkdown使用乳膠引擎蓋下編譯爲PDF格式,從而預期大部分原材料乳膠命令應該工作。

同樣是真實的HTML輸出:

Product names are: <tt>`r sort(d$product_name)`</tt>. 
相關問題