I cannot use some fonts in Rmarkdown

Asked

Viewed 57 times

5

Guys you could help me?

This is my example of Rmarkdown code:

---
title: "My Title"
header-includes:
      - \usepackage{calligra}
      - \usepackage[T1]{fontenc}
output:
  pdf_document:
  latex_engine: xelatex    

---

# Section 1

  This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

The pdf is generated normally. But the source is not the one I want that is the calligra. Even when I don’t use the header-includes and use mainfont: calligra the pdf is generated but the source does not match calligra

When I go on Texlive I see that the package is installed but even with these straining the Rmarkdown does not pull this source.

This happens to some fonts. I see that the font is in Tex Live and Rmarkdown does not pull. What I need to do?

Thank you very much!

Laura

1 answer

5


The font definition for the specific use of Calligra is not done in the usual way. As it is defined from a package, it is necessary to explicitly determine an Environment, so that this source is restricted to it. Below I put a CMR showing how to do this in Rmarkdown.

---
title: "My Title"
header-includes:
      - \usepackage{calligra}
      - \usepackage[T1]{fontenc}
output:
  pdf_document:
  latex_engine: xelatex
---

# Section 1

\begin{calligra}

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, 
PDF, and MS Word documents. For more details on using R Markdown see
<http://rmarkdown.rstudio.com>.

\end{calligra}

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, 
PDF, and MS Word documents. For more details on using R Markdown see
<http://rmarkdown.rstudio.com>.

inserir a descrição da imagem aqui

  • speechless! Thank you again. One question: Voce says q As it is defined from a package, it is necessary to explicitly determine an Environment, so that this source is restricted to itNão entendi. Eu consegui mudar outras fontes sem colocar no enviroment do Rmarkdown. somente com:header-includes: - usepackage{Calligra} - usepackage[T1]{fontenc}`

Browser other questions tagged

You are not signed in. Login or sign up in order to post.