[Tex/LaTex] paragraph indentation does not work

indentationparagraphs

I am writing my master's thesis on Latex with TeXShop Version 3.88 on macOS Sierra. Anyone could help me as to why none of my paragraphs are indented, please?

MWE:

\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usepackage{cite} 
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath, nccmath, amsfonts, amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{trfsigns}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{datetime}
\usepackage{multirow}
\usepackage{placeins}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{relsize}
\usepackage{comment}
\usepackage{Macros_SCF}
\usepackage{mathrsfs}
\usepackage[toc]{glossaries}
\usepackage{indentfirst}



\includecomment{Graphics}

\titleformat{\section}{\normalfont\large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\paragraph}{\normalfont\bfseries}{\theparagraph}{}{}
\titlespacing{\section}{0pt}{6pt}{6pt}      
\titlespacing{\subsection}{0pt}{3pt}{3pt}
\titlespacing{\paragraph}{0pt}{3pt}{-1pt}

\newcolumntype{Y}{>{\centering\arraybackslash}X}  

\addtolength{\textwidth}{2.1cm}
\addtolength{\topmargin}{-2.4cm}
\addtolength{\oddsidemargin}{-1.1 cm}
\addtolength{\textheight}{4.5cm}
\setlength{\columnsep}{0.7cm}

\newlength{\mytocsep}
\setlength{\mytocsep}{1.5em}
\titlecontents{section}[0pt]{\addvspace{1pc}\bfseries}{\contentslabel{\mytocsep}}{}
    {\titlerule*[0.5pc]{-}\contentspage}
\newcommand{\myunnumberedsection}[1]{\addcontentsline{toc}{section}{#1}%
\section*{#1}}


\begin{document}

\setlength\parindent{30pt} 

\section{Introduction}

\begin{flushleft}
\subsection{first subsection}
\end{flushleft}

\begin{flushleft}
This is the first paragraph. This is the first paragraph. This is the first paragraph. 

\indent
This is the second paragraph, which should be indented but is not. 
This is the second paragraph, which should be indented but is not.
This is the second paragraph, which should be indented but is not. 
\end{flushleft}

\end{document}

Best Answer

enter image description here

By default latex does not indent after section headings but you had over-ridden that with \titlespacing commands, The \titlespacing* form keeps the default behaviour of not indenting, so

\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usepackage{cite} 
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath, nccmath, amsfonts, amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{trfsigns}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{datetime}
\usepackage{multirow}
\usepackage{placeins}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{relsize}
\usepackage{comment}
% not availaible\usepackage{Macros_SCF}
\usepackage{mathrsfs}
\usepackage[toc]{glossaries}




\includecomment{Graphics}

\titleformat{\section}{\normalfont\large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\paragraph}{\normalfont\bfseries}{\theparagraph}{}{}
\titlespacing*{\section}{0pt}{6pt}{6pt}      
\titlespacing*{\subsection}{0pt}{3pt}{3pt}
\titlespacing*{\paragraph}{0pt}{3pt}{-1pt}

\newcolumntype{Y}{>{\centering\arraybackslash}X}  

\addtolength{\textwidth}{2.1cm}
\addtolength{\topmargin}{-2.4cm}
\addtolength{\oddsidemargin}{-1.1 cm}
\addtolength{\textheight}{4.5cm}
\setlength{\columnsep}{0.7cm}

\newlength{\mytocsep}
\setlength{\mytocsep}{1.5em}
\titlecontents{section}[0pt]{\addvspace{1pc}\bfseries}{\contentslabel{\mytocsep}}{}
    {\titlerule*[0.5pc]{-}\contentspage}
\newcommand{\myunnumberedsection}[1]{\addcontentsline{toc}{section}{#1}%
\section*{#1}}

\setlength\parindent{30pt} 


\begin{document}



\section{Introduction}


\subsection{first subsection}



This is the first paragraph. This is the first paragraph. This is the first paragraph. 


This is the second paragraph, which should be indented but is not.
This is the second paragraph, which should be indented but is not. 


\end{document}
Related Question