与LaTeX \texttt
相当的R降价是什么?
有了这个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:
虽然我想从此.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}
答案 0 :(得分:10)
这样做没有本地降价方式。但是当输出格式为pdf_document
时,等同于\texttt
的rmarkdown本身就是\texttt
:
Product names are: \texttt{`r sort(d$product_name)`}.
Rmarkdown在引擎盖下使用乳胶编译为pdf,因此大多数原始乳胶命令应该按预期工作。
html输出也是如此:
Product names are: <tt>`r sort(d$product_name)`</tt>.