LaTex error Environment abstract undefined

I am trying to create a template for a bachelor thesis (with RMarkdown) for my students and I cannot add the "Abstract" parameter in my yaml document. More specifically, when I am trying to knit it to pdf, I am getting the following error message: " ! LaTeX Error: Environment abstract undefined. Fehler: Failed to compile _main.tex. ". In global options I have (Sweave - typeset LaTeX into Pdf: pdfLaTeX). Furthermore, I installed tinytex as follows: tinytex::install_tinytex() .
Any help will be highly appreciated.
Thnx a lot in advance

Hi @kimboGilda

Does your LaTeX template have an abstract environment defined? For this to work, the key-value pair (i.e. abstract: This is my awesome abstract.) from the YAML header will get passed to the LaTeX template and placed in the document wherever the template specifies.

As a simple test, the following code can be used to add the abstract. Add this code to your template where you want the abstract to appear:

% LaTeX code for abstract
$if(abstract)$
  $abstract$
$endif$

If the abstract is specified in the YAML header, it will be placed here, otherwise nothing will appear.

The default LaTeX template used by pandoc has an abstract environment, so it accepts an abstract argument in the YAML header. Here is the default template. Notice the following code:

$if(abstract)$
\begin{abstract}
$abstract$
\end{abstract}
$endif$

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.