0

I am writing my thesis in the report class. I am trying to indent the first paragraph after every section.

Including \usepackage{indentfirst} in the preamble only seem to indent the first paragraph after the chapter heading. It does not indent the first paragraph immediately following a section. Any suggestion to indent the first paragraph following a section will be helpful.

\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[titletoc]{appendix}
\usepackage{lipsum}
\usepackage{indentfirst}
\usepackage{graphicx}
\graphicspath{{Images/}}
\usepackage[a4paper,margin=1in]{geometry}
%%%For absolute positioning on the title page
\usepackage[absolute]{textpos}
\setlength{\TPHorizModule}{\paperwidth}
\setlength{\TPVertModule}{10in}
%%%%
\usepackage{fancyhdr}
%%%%Adding figure captions in italics and color
\usepackage[svgnames]{xcolor}
\definecolor{blue}{RGB}{101,140,191}
\usepackage{caption}
\usepackage[font={color=blue}]{caption}
%%%%%
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{hyperref}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[indentafter]{titlesec} %%%%to set the size of different headers
%%%%%Setting the spacing before and after the section titles
%%%%%
\titlespacing{\chapter}{0pt}{20pt plus 0pt minus 0pt}{20pt plus 0pt minus 0pt}
\titlespacing{\section}{0pt}{20pt plus 0pt minus 0pt}{20pt plus 0pt minus 0pt}
\titlespacing{\subsection}{0pt}{20pt plus 0pt minus 0pt}{20pt plus 0pt minus 0pt}
\titlespacing{\subsubsection}{0pt}{20pt plus 0pt minus 0pt}{20pt plus 0pt minus 0pt}
%%%%%
\usepackage{indentfirst}
\usepackage{float}  %%%% To restrict the location of figure
\usepackage{array} %%%% This is used for controlling the width of table. If left controlled, the text may span more space than permitted by the 
% command \textwidth
\usepackage{chemmacros} %%%% for representing the ions in non-italicized font
\usepackage{textgreek} %%%For printing non-italicized greek letters
\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}} %%%% This package is for writing chemical equations
\renewcommand{\chaptername}{CHAPTER}
\renewcommand{\appendixname}{APPENDIX}
%%%%%
\usepackage{titletoc}
\setcounter{tocdepth}{0}
\newcommand{\setupname}[1][\chaptername]{
\titlecontents{chapter}[0pt]{\vspace{1ex}}{#1~\thecontentslabel:\quad}{}{\mdseries\titlerule*[0.75em]{.}\contentspage}[]
}
%%%%
%%%%%
%\setlength{\intextsep}{5pt plus 1.0pt minus 2.0pt}   %%%%For controlling the spacing between figure and text
%\setlength{\floatsep}{5pt plus 1.0pt minus 2.0pt}   %%%%For controlling the spacing between figure and text
%\setlength{\textfloatsep}{5pt plus 1.0pt minus 2.0pt}   %%%%For controlling the spacing between figure and text
\usepackage{siunitx}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}   %%% New column time defined for centering columns
\titleformat*{\section}{\large}
\titleformat*{\subsection}{\large}
\titleformat*{\subsubsection}{\large}
\titleformat*{\paragraph}{\large}
\titleformat*{\subparagraph}{\large}
%%%%
%%%%
%\pagestyle{fancy}
%\fancyhead{}
%\fancyhead[RO,LE]{Thesis Title}
%\fancyfoot{}
%\fancyfoot[LE,RO]{\thepage}
%\fancyfoot[LO,CE]{Chapter\thechapter}
%\fancyfoot[CO,RE]{Vikram Kumar}
%\renewcommand{\headrulewidth}{0.4pt}
%\renewcommand{\footrulewidth}{0.4pt}
\usepackage[style=chem-acs,sorting=none]{biblatex}\addbibresource{references.bib}  %%%sorting is set equal to none for having the references appear in the order they are cited
\addbibresource{introduction.bib}
\addbibresource{characterization.bib}
\addbibresource{data.bib}
\usepackage{ragged2e} %%%For aligning the text
%%%%Adjustment of Title
\titleformat{\chapter}[hang] 
{\mdseries\large}{\chaptertitlename\ \thechapter:}{1em}{\centering}
\begin{document}
\pagenumbering{roman}
\chapter*{}
\vspace*{\fill}
\textit{To my Parents}
\vspace*{\fill}
\begin{spacing}{1.75}
\justify
\chapter*{ACKNOWLEDGMENTS}
%\par
\lipsum.%\par

\renewcommand*\contentsname{TABLE OF CONTENTS}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}
\setupname
\chapter{INTRODUCTION}\label{chap:intro}
\lipsum %\par

\lipsum %\par

\begin{flushleft}
\section{Problem Statement and Organization}\label{sec:problemstatment}
\end{flushleft}
%par
\lipsum

\begin{flushleft}
\section{Detailed Investigations}\label{sec:problemstatment}
\end{flushleft}
%par
\lipsum
%%%%
\end{spacing}
\begin{spacing}{1.5}
\overfullrule=0pt
\addcontentsline{toc}{chapter}{REFERENCES}
\printbibliography[title={REFERENCES}]
\end{spacing}
\end{document}
6
  • 2
    I can't replicate this. I think you need to write an actual (minimal) document that shows the problem you have.
    – pst
    Jun 20, 2021 at 5:14
  • 3
    We cannot help without an example of what are you doing. Since \documentclass{report} \usepackage{indentfirst} \begin{document} \chapter{foo} foo \section{foo} foo \end{document} works as expected, you are doing something else wrongly, but our clairvoyance end here.
    – Fran
    Jun 20, 2021 at 7:00
  • 1
    indentfirst affects all section headings, please always include a small complete test example so people can debug. Jun 20, 2021 at 9:14
  • @DavidCarlisle: I have included the preamble together with an example of the code that I am using. It will be helpful if you can help me figure out the problem. Jun 21, 2021 at 11:24
  • \begin{flushleft} \section{Problem Statement and Organization}\label{sec:problemstatment} \end{flushleft} breaks almost all latex's section heading control. Just remove the flushleft environment Jun 21, 2021 at 11:26

1 Answer 1

1
\begin{flushleft}
\section{Problem Statement and Organization}\label{sec:problemstatment} \end{flushleft}

breaks almost all latex's section heading control. Just remove the flushleft environment.

Apart from the particular issues with putting the heading inside a group (which prevents it affecting the following paragraph outside the group) section headings should never have fromatting inline in the document, it shoul dbe specified as part of the document design, in the documentclass, or, failing that, in the preamble.

If the intention is to have ragged right section titles, change

\titleformat*{\section}{\large}

to

\titleformat*{\section}{\raggedright\large}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .