I am using rmarkdown to write my thesis. I have separated the thesis into different rmarkdown documents to make my work easy. Specifically, I have an introductions document, a literature review document and a methodology document. I then use a main rmarkdown document to combine all the documents into one output. My main document is as shown in the code below.
---
title: \textbf{Examining The Effect of Paddin}
output:
pdf_document:
number_sections: TRUE
keep_tex: TRUE
fig_caption: TRUE
latex_engine: xelatex
geometry: "left = 2.54cm, right = 2.54cm, top = 2.54cm, bottom = 2.54cm"
fontsize: 12pt
header-includes:
- \usepackage{float}
- \usepackage{sectsty}
- \usepackage{paralist}
- \usepackage{setspace}
- \setstretch{2.0}
- \usepackage{fancyhdr}
- \usepackage{ragged2e}
- \usepackage{lastpage}
- \usepackage{dcolumn}
- \usepackage[nottoc, numbib]{tocbibind}
- \usepackage{amsmath}
- \setlength{\mathindent}{0pt}
- \usepackage{enumitem}
- \renewcommand{\theequation}{\thechapter.\arabic{equation}}
documentclass: report
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r intro, child = 'introduction.Rmd'}
```
\newpage
```{r litret, child = 'literature.Rmd'}
```
```{r, include=FALSE}
options(tinytex.verbose = TRUE)
```
\newpage
```{r methods, child = 'methodology.Rmd'}
```
I have a problem in the methodology section where I am trying to write a series of equations in this section. My methodology sections is as shown below.
---
title: " "
output:
pdf_document:
number_sections: TRUE
keep_tex: TRUE
latex_engine: xelatex
geometry: "left = 2.54cm, right = 2.54cm, top = 2.54cm, bottom = 2.54cm"
fontsize: 12pt
classoption: fleqn
header-includes:
- \usepackage{float}
- \usepackage{sectsty}
- \usepackage{setspace}
- \setstretch{2.0}
- \usepackage{ragged2e}
- \setlength{\mathindent}{0pt}
- \usepackage{enumitem}
---
\onehalfspacing
\normalsize
\justifying
# Chapter Three
\vspace{-1em}
# Methodology{-}
## Introduction
| This section discusses the theory behind neural networks by deriving the back propagation algorithm. The section also discusses techniques used in convolution neural networks by describing how CNNs extract data from images. Specifically, this section focuses on major techniques used in CNNs such as filtering, strides, padding, pooling and batch normalization.
\vspace{-1em}
\begin{equation}
\begin{aligned}
\frac{\partial I_j^{(3)}}{\partial W_{ji}^{(3)}} = Y_i^{(2)} \quad \text{(Obtained from the partial derivative of equation 3.5 with respect to \( W_{ji} \))}
\label{eq:equation 3.12}
\end{aligned}
\end{equation}
\vspace{-1em}
Trying t knit the document in main document raises the error ! Undefined control sequence.<argument> \mathindent
. However I can run the methodology document on its own successfully.
The methodology chapter on its own isn't using documentclass: report
. Apparently that document class doesn't support the \mathindent
setting.
To fix this, just delete the line
- \setlength{\mathindent}{0pt}
from the main document.
If that messes up your desired formatting, you might want to read this discussion: https://tex.stackexchange.com/questions/50233/positioning-of-equations . For example, you might want
documentclass: report
classoption: fleqn
to make all your equations be flushed left.
By the way, the header includes in methodology.Rmd
are ignored when you compile the main document, so you may find you need to copy some others there when you put together the full document.