The latex package "indentfirst" not working in R-markdown

I am trying to indent the first line after a section header using the indentfirst package but it is not working.

---
title: "Evaluation of Coaching Teachers by Program"
header-includes:
- \usepackage{indentfirst}
- \usepackage{booktabs}
- \usepackage{amsmath}
- \usepackage{pdflscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
author: 
- "Office of Assessment and Accreditation"
- "University of South Carolina"
date: "August 2019"
output: pdf_document
---

\newpage
\blandscape
\section{\textbf{Introduction}}
The purpose of this report is to provide an overview. 

\section{\textbf{Overview of all programs}}
\elandscape

Here is the latex output

\documentclass[]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage[margin=1in]{geometry}
\usepackage{hyperref}
\hypersetup{unicode=true,
            pdftitle={Evaluation of Coaching Teachers by Program},
            pdfauthor={Office of Assessment and Accreditation; University of South Carolina},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\[email protected]@width>\linewidth\linewidth\else\[email protected]@width\fi}
\def\maxheight{\ifdim\[email protected]@height>\textheight\textheight\else\[email protected]@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
\def\footnote{\protect\rmarkdownfootnote}

%%% Change title format to be more compact
\usepackage{titling}

% Create subtitle command for use in maketitle
\providecommand{\subtitle}[1]{
  \posttitle{
    \begin{center}\large#1\end{center}
    }
}

\setlength{\droptitle}{-2em}

  \title{Evaluation of Coaching Teachers by Program}
    \pretitle{\vspace{\droptitle}\centering\huge}
  \posttitle{\par}
    \author{Office of Assessment and Accreditation \\ University of South Carolina}
    \preauthor{\centering\large\emph}
  \postauthor{\par}
      \predate{\centering\large\emph}
  \postdate{\par}
    \date{August 2019}

\usepackage{indentfirst}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{pdflscape}
\newcommand{\blandscape}{\begin{landscape}}
\newcommand{\elandscape}{\end{landscape}}

\begin{document}
\maketitle

\newpage

\blandscape
\section{\textbf{Introduction}}

The purpose of this report is to provide an overview of in

\section{\textbf{Overview of all programs}}

\elandscape


\end{document}

I want the first line after the section header to be indented.

Answers

The indentfirst package works, but something added \setlength{\parindent}{0pt} to your code, so the indention of the first paragraph is not visible because it is zero.

To revert this try with

\usepackage{indentfirst}
\setlength{\parindent}{20pt}

in your header includes.

Posted on by samcarter_is_at_topanswers.xyz