title: Setting documentclass in Rmarkdown v2
body: <p>I would like to write my master thesis in <a href="http://rmarkdown.rstudio.com/pdf_document_format.html#advanced-customization" rel="noreferrer">RMarkdown v2</a> and I would be very glad if I could use a prepared LaTeX class.</p>
  
  <p>Also I'd like to put some lines in the header and somehow add an abstract.</p>
  
  <p>Can any1 knows how to do that?</p>
  
  <p>Lines I'd be happy to have before <code>\begin{document}</code> are typically:</p>
  
  <pre><code>\usepackage[utf8]{inputenc}
  \usepackage{polski}
  
  \usepackage{amsfonts}
  \usepackage{amsmath}
  \usepackage{amssymb}
  \usepackage{amsthm}
  
  \usepackage{tikz}
  \usepackage{float} %pakiet do obsługi obrazków
  \usepackage{graphicx} %pakiet do dodawania obrazków
  \usepackage{tabularx} %pakiet do utrzymywania szerokości tabel równo z szerokością tekstu
  \usepackage[T1]{fontenc} %przełączamy sie na fonty EC
  \usepackage{dsfont}
  % \usepackage[latin2]{inputenc} %kodowania polskich znakow ISO-8859-2  - mamy utf wyzej
  \usepackage{xcolor} %pakiet do nadawania kolorów w \definecolor
  \usepackage{listings} %pakiet do robienia tła jak w programie R
  \lstset{language=R,%    
    % numbers=left,%
     tabsize=3,%
     numberstyle=\footnotesize,%
     basicstyle=\ttfamily \footnotesize \color{black},%
     escapeinside={(*@}{@*)}}
  
  \usepackage{longtable}
  
  
  \definecolor{ListingBackground}{rgb}{0.95,0.95,0.95}
  \definecolor{ListingRule}{rgb}{0.7,0.7,0.7}
  
  \lstdefinestyle{incode}  %definiowanie stylu tła dla pisania kodu w R
  {
  basicstyle={\ttfamily\footnotesize},
  backgroundcolor={\color{ListingBackground}},
  frame={lr},
  rulecolor={\color{ListingRule}},
  framerule={2pt}
  }
  
  
  \usepackage{hyperref} %pakiet do dodawania hiperłącz
  \hypersetup{colorlinks=true,
              linkcolor=blue,
              citecolor=blue,
              urlcolor=blue}
  
  
  %------------------------------------------------------------------------------%
  \title{ o }
  \author{Marcin Kosiński}
  \supervisor{prof. dr hab. Michał Nowak}
  \type{magisters}
  \discipline{matematyka}
  \monthyear{lipiec 2015}
  \date{\today}
  \album{123456}
  </code></pre>
  
  <p>And if possible after <code>\begin{document}</code> .</p>
  
  <pre><code>\begin{abstract}
  
  some text
  \end{abstract}
  
  \tableofcontents
  \listoffigures 
  \listoftables
  </code></pre>
  
  <p>Thanks for help in advance :) ! I'm aware I'll need to specify setting somehow in the begging of the Rmarkdown v2 document</p>
  
  <pre><code>---
  title: "Magisterka"
  author: "Marcin Kosiński"
  date: "Tuesday, July 29, 2014"
  output: pdf_document
  documentclass: mini
  includes:
        in_header: headerMgr.tex
  ---
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>The soultion is good YAML specification:</p>
  
  <pre><code>---
  title: "Magisterka"
  author: "Marcin Kosiński"
  date: "Tuesday, July 29, 2014"
  output:
    pdf_document:
      includes:
        in_header: header.tex
        before_body: doc_prefix.tex
  ---
  </code></pre>