I am a college student, and use R markdown to create the reports for my assignments. Generally, I use `kable`

in `knitr`

to create tables.

In my latest project, I needed to insert the table of transformations for **Yeo - Johnson Transformation** for normality, which is given here.

I tried the following:

```
---
title: "Latex Table in R Markdown"
output: pdf_document
---
Some text
$$
\begin{table}[]
\centering
\caption{Transformations Associated with the Johnson System}
\begin{tabular}{|l|l|l|l|}
\hline
Johnson Family & Transformation & Parameter Conditions & X Condition \\ \hline
S_B & Z=\gamma + \eta ln(\frac {X - \epsilon} {\lambda + \epsilon - X}) & \eta, \lambda >0, -\infty < \gamma, \epsilon < \infty & \epsilon < X < \epsilon + \lambda \\ \hline
S_L & Z=\gamma + \eta ln(X - \epsilon) & \eta >0, -\infty < \gamma, \epsilon < \infty & X > \epsilon \\ \hline
S_U & Z=\gamma + \eta \sinh^{-1}(\frac {X - \epsilon} {\lambda}) & \eta, \lambda >0, -\infty < \gamma, \epsilon < \infty & -\infty < X < \infty \\ \hline
\end{tabular}
\end{table}
$$
Some text
```

This gives me the following error:

```
! Missing $ inserted.
<inserted text>
$
l.96 S_
B & Z=\gamma + \eta ln(\frac {X - \epsilon} {\lambda + \epsilon - X})...
Error: Failed to compile a.tex. See a.log for more info.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "a.tex"' had status 1
Execution halted
```

I generated the table code using LaTeX Table Generator. So its failure is surprising. I tried to use the same in Overleaf, but also got the same error message. If I render it to HTML instead of PDF, the compilation happens, but it does not show the table. Only the raw LaTeX code is displayed then.

Can someone please point out the mistake?

Thanks