Change mathtt font to match code font in R Markdown

Viewed 32

I would like to use the same font for both code and when using \mathtt in equation mode (say to "Lucida Console" for both. This is straightforward when rendering to pdf, but I need to do this for html output for an entire document.

I've seen examples where you embed css code directly into an equation to change this temporarily, but I'd like to do this throughout the entire document. I tried to do this via a custom css file, but my attempts have failed miserably. How can this be done? Minimal repex below. "codetext" should use identical fonts, but they are different by default.

---
output: html_document
---

`codetext`

$\mathtt{codetext}$

I've tried something like this in the css file:

<style>
   monospace {
    font-family: "Lucida Console", "Lucida Sans Typewriter", monospace;
   }
</style>

@font-face {font-family: MJXc-TeX-type-R; src: local('Lucida'), local('MathJax_Typewriter-Regular')}
0 Answers
Related