This page https://tex.stackexchange.com/questions/32824/show-inline-math-as-if-it-were-display-math-and-vice-versa suggests putting everymath{displaystyle}
in the preamble to achieve what you want. If I just put that into the body of the R Markdown file, it seems to work for me. For example,
---
title: "Displaystyle"
author: "Stacker"
date: "1/25/2021"
output: pdf_document
fontsize: 12pt
---
everymath{displaystyle}
$frac {1}{2}$
$displaystyle frac {1}{2}$
$sum_{i=0}^n$
$displaystyle sum_{i=0}^n$
$int_0^infty$
$displaystyle int_0^infty$
produces duplicates of each equation. To restore the default, just include everymath{}
.
Edited to add: One limitation of this approach: MathJax doesn't support everymath
, so this only works in formats like pdf_document
that use LaTeX as an intermediate. If you want the same behaviour in html_document
, you'll need to do something else.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…