mchlmchl
mchlmchl

Reputation: 23

use character from latex package in rmarkdown with html_output

I'm trying to use symbols from a latex package loaded in the yaml preamble (e.g. musicography in this example). It works with output set to pdf, but not with hmtl output. How can I access commands/symbols from the loaded package with output set to html_document?

---
title: test
output:
  html_document
header-includes:
  - \usepackage{musicography}
---
  
$\musHalf$

Upvotes: 0

Views: 73

Answers (1)

canovasjm
canovasjm

Reputation: 513

Edit: Not all Latex packages will work with output: html_document. Quoting user cderv here: You need to see if MathJax support the Tex package as an extension


This answer on Mathematics Meta SE suggests a workaround using Unicode characters, if you find the corresponding one. For a complete list of musical symbols, see the Unicode Standard, Version 13.0. Once you have the Unicode, you next need the HTML Entity. Finally, place the HTML Entity in the document and knit.

From your example, I think you are trying to represent a half note, for which I found the Unicode to be 1D15E. The corresponding HTML Entities are 𝅗𝅥 and 𝅗𝅥 which I found here:

enter image description here

The code would be:

---
title: test
output:
  html_document
---

𝅗𝅥  
𝅗𝅥

Finally, this Wikipedia entry offers links to Western Musical Symbols, Byzantine Musical Symbols and Ancient Greek Musical Notation, in case you need any of these.

Upvotes: 2

Related Questions