相当于LaTeX的R降价是\texttt多少?
有了这个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)`.
Run Code Online (Sandbox Code Playgroud)
我得到这个pdf:
\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}
Run Code Online (Sandbox Code Playgroud)
sco*_*coa 11
这样做没有本地降价方式.但是当输出格式是pdf_document,rmarkdown相当于\texttt它\texttt本身:
Product names are: \texttt{`r sort(d$product_name)`}.
Run Code Online (Sandbox Code Playgroud)
Rmarkdown在引擎盖下使用乳胶编译为pdf,因此大多数原始乳胶命令应该按预期工作.
html输出也是如此:
Product names are: <tt>`r sort(d$product_name)`</tt>.
Run Code Online (Sandbox Code Playgroud)