# Math mode in document title with R Markdown

I was trying to put $\LaTeX$ in the document title but can't find a way to do so. I suppose that this is because I can't use latex packages with the document title. Does anyone know how to solve this?

Here's what I have:

title: "Welcome to $\LaTeX$ Workshop"
output:
pdf_document:
citation_package: natbib
number_sections: yes
bibliography: sample.bib
classoption: twocolumn
- \usepackage{lscape}
- \usepackage[english]{babel}
- \usepackage{multicol}
- \setlength{\columnsep}{1cm}
- \setlength{\parindent}{1cm} # paragraph indentation
- \setlength{\parskip}{8pt} # paragraph spacing
- \usepackage{setspace}
- \doublespacing


The error I'm getting looks like this:

! Package inputenc Error: Unicode char       (U+2028)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
...

l.96 \maketitle

Try running pandoc with --latex-engine=xelatex.
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
Execution halted


• U+2028 is unicode LINE SEPARATOR an unusual end-of-line marker, you shoudl probably delete the line and retype it making sure it just has a normal U+000A end of line marker. – David Carlisle Feb 3 at 20:31
• \LaTeX isn't intended to be math mode so normally it would be \LaTeX not $\LaTeX$ unless the \$ here are part of some non-tex markdown convention? – David Carlisle Feb 3 at 20:33

You need to escape the backslash using

title: "Welcome to \\LaTeX{} Workshop"
...


Or you can use a work-around:

---
title: "Welcome to LaTeX Workshop"
output:
pdf_document

The above approach removes all formatting from the title and resets it via the traditional way using \title after pandoc's \title insertion. This effectively overwrites it without the processing used by pandoc.