Home > Software design >  Problem knitting LaTex maths expression as Beamer Presentation
Problem knitting LaTex maths expression as Beamer Presentation

Time:11-01

I want to knit some maths expressions and also some Greek letters (in maths) as a Beamer Presentation in R. While the maths formulas were knitted successfully, I don't know why R was failed to knit all the Greek letters.
You can reproduce the result using this:

---
title: "Untitled"
author: "John Doe"
date: "11/1/2021"
output: beamer_presentation
---

## THIS WORKS

- Standalone equation.
\[
\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\]

- In an aligned environment.
$$
\begin{aligned}
e^{i\pi}   1 &= 0 \\
\frac{1}{\sigma\sqrt{2\pi}} \int^{\infty}_{-\infty}
e^{-\frac{1}{2}\left(x-\mu\right)^2/\sigma^2}\,\mathrm{d}x &= 1\\
\int^{\sqrt[3]{3}}_1 z^2 \, \mathrm{d}z \times \cos\left(\frac{3\pi}{9}\right) &= \log\left(\sqrt[3]{e}\right)
\end{aligned}
$$

## THIS DOESN'T WORK

\[H_o: \mu_1 = \mu_2 \]
\[H_1: \mu_1 \gt \mu_2 \]

Can someone suggest how I can solve this? Thanks!!!

CodePudding user response:

Nothing to do with greek letters, the \gt is the problem. Use > :

---
title: "Untitled"
author: "John Doe"
date: "11/1/2021"
output: 
  beamer_presentation:
    keep_tex: true
---

## THIS WORKS

- Standalone equation.
\[
\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\]

- In an aligned environment.
$$
\begin{aligned}
e^{i\pi}   1 &= 0 \\
\frac{1}{\sigma\sqrt{2\pi}} \int^{\infty}_{-\infty}
e^{-\frac{1}{2}\left(x-\mu\right)^2/\sigma^2}\,\mathrm{d}x &= 1\\
\int^{\sqrt[3]{3}}_1 z^2 \, \mathrm{d}z \times \cos\left(\frac{3\pi}{9}\right) &= \log\left(\sqrt[3]{e}\right)
\end{aligned}
$$

## THIS DOESN'T WORK

\[H_o: \mu_1 = \mu_2 \]
\[H_1: \mu_1 > \mu_2 \]

enter image description here

  • Related