In Latex, it is common to reference a label using the "~" to keep the number attached to the label such as Figure or Table.
https://tex.stackexchange.com/questions/227285/problems-with-tilde-and-line-breaking/227296 shows an example of this.
A fully working example can be found here:
http://md5.mshaffer.com/WSU_STATS419/stackoverflow/tilde/
In the Rmd file, http://md5.mshaffer.com/WSU_STATS419/stackoverflow/tilde/reference-tilde.Rmd,
I have the following:
---
title: "Untitled"
output:
pdf_document:
keep_tex: true
number_sections: true
latex_engine: pdflatex
---
\section{My Section Name}
\label{sec:my}
Below you will find Equation~\ref{eq:my-model}.
\begin{equation}
\label{eq:my-model}
Y_{jt} = \alpha + \beta X_{jt} + \upsilon_{j} + \varepsilon_{jt} ,
\end{equation}
\subsection{My sub section}
\label{sec:mysub}
For more information, please refer to Section~\ref{sec:my}.
Notice the "~" tilde being used as outlined in basic Latex usage.
When I click Knit-PDF, it outputs something I did not expect:
http://md5.mshaffer.com/WSU_STATS419/stackoverflow/tilde/reference-tilde.pdf
Since I choose "keep_tex", I can view the .TEX file
http://md5.mshaffer.com/WSU_STATS419/stackoverflow/tilde/reference-tilde.tex which can be seen online here: http://md5.mshaffer.com/WSU_STATS419/stackoverflow/tilde/reference-tilde.tex.txt
It appears to have replaced the tilde with a text version:
\begin{document}
\maketitle
\section{My Section Name}
\label{sec:my}
Below you will find Equation\textasciitilde{}\ref{eq:my-model}.
\begin{equation}
\label{eq:my-model}
Y_{jt} = \alpha + \beta X_{jt} + \upsilon_{j} + \varepsilon_{jt} ,
\end{equation}
\subsection{My sub section}
\label{sec:mysub}
For more information, please refer to
Section\textasciitilde{}\ref{sec:my}.
\end{document}
How do I rectify this situation?
How do I get the Latex to render as expected?
How do I get my tilde as a spacer back?