2016-02-19 19 views
5

Co to jest oznaczenie R równoważne LaTeX \texttt?Co to jest oznaczenie R równoważne LaTeX texttt?

Dzięki tej 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)`. 

otrzymuję ten PDF:

enter image description here

Chociaż chciałbym dostać wyjście z tego .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

Odpowiedz

4

Nie ma natywnego sposobu obniżania wartości. Ale gdy format jest pdf_document, odpowiednik rmarkdown od \texttt jest sama \texttt:

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

Rmarkdown wykorzystuje lateks pod maską skompilować do pdf, więc komenda najbardziej surowe lateks powinny działać zgodnie z oczekiwaniami.

To samo odnosi się do wyjścia html:

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