0

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}
  • Use \raggedright rather than the flushleft environment. Specify it before setting the value of \parindent. – Steven B. Segletes Nov 9 '17 at 14:08
  • i want every paragraph to be flushed to the left, except for the first line of every paragraph, which should be indented (not sure if that is what you are asking). – David Nov 9 '17 at 14:10
  • It should look like this: ...\raggedright \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. This is the second paragraph, which should be indented but is not. \end{document} – Steven B. Segletes Nov 9 '17 at 14:13
  • OK so the problem was, I had a bunch of stuff between \raggedright \setlength\parindent{30pt} and the beginning of the section so it didn't work at all. When putting it right before the section it works with the indents, but now i have to put \noindent before every first paragraph or it will be indented. This is totally fine as long as the other paragraphs are indented. Thank you very much ! – David Nov 9 '17 at 14:29
  • unrelated but I would not use \usepackage[ansinew]{inputenc} use a standard encoding (ansinew is not from ANSI:-) preferably [utf8] or if you want a single byte encoding, use [latin1] – David Carlisle Nov 9 '17 at 14:31
0

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}
  • Thanks David, now it works how I wanted. Have a good day :) – David Nov 9 '17 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.