Text FormattingParskip not functional in mainmatter section

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
joeTex
Posts: 6
Joined: Mon Sep 23, 2019 11:58 pm

Parskip not functional in mainmatter section

Post by joeTex »

Hi

I have been struggling with the following problem below: The \parskip function only works in the frontmatter section of the document, parskip does not work in the mainmatter (even if I add include same documents in both the front- and mainmatter sections). I have attached my main file's code below, I would appreciate it if somebody could help me out with a correction to my problem? Maybe a clash in the preamble? I don't know anymore. I am using Overleaf with pdfLaTeX compiler.

\documentclass[a4paper, 11pt, oneside]{scrbook}
\usepackage[utf8x]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage[parfill]{parskip}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}

\pagestyle{plain}
\pagenumbering{arabic}

\newlength\longest % added for quote


% ----- Packages needed for multiple figures -----
\usepackage{caption}
\usepackage{subcaption}
\usepackage{pdflscape}
\usepackage{natbib}
\usepackage{wrapfig}

\DeclareCaptionLabelSeparator{none}{ }
\captionsetup{margin=10pt,font=small,labelfont=bf, labelsep=none}

% ----- Additional packages, user specified -----

\usepackage{authblk}
\usepackage{comment}
\usepackage[fleqn]{amsmath}
\usepackage{nccmath}
\usepackage{float}
\usepackage{physics}

\usepackage{array}
\usepackage{tabu}
\usepackage{tabularx}

\usepackage[english]{babel}
\usepackage{array}

\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{makecell}
\usepackage{siunitx}

\usepackage{t1enc}
\usepackage[toc,page]{appendix}

\usepackage{tocloft}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} % for parts
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters

%----------------------------------------------
% Define flow diagram styles


\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{arrows.meta}
\tikzset{%
>={Latex[width=2mm,length=2mm]},
% Specifications for style of nodes:
base/.style = {rectangle, rounded corners, draw=black,
minimum width=4cm, minimum height=1cm,
text centered},
blank/.style = {rectangle, rounded corners, draw=white,
minimum width=4cm, minimum height=1cm,
text centered},
loop/.style = {ellipse, rounded corners, draw=black,
minimum width=1cm, minimum height=1cm,
text centered},
processData/.style = {base, fill=blue!30},
startstop/.style = {loop, fill=red!30},
activityRuns/.style = {base, fill=green!30},
process/.style = {blank, fill=white!15},
}

%----------------------------------------------
% Create nomenclature with groups and units
\usepackage{nomencl}
\makenomenclature

\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{A}{Abbreviations}{%
\ifstrequal{#1}{V}{Variables}{%
\ifstrequal{#1}{C}{Physics Constants}{}}}%
]}

\newcommand{\nomunit}[1]{\renewcommand{\nomentryend}{\hspace*{\fill}#1}}

%----------------------------------------------
% Create column type
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}

%----------------------------------------------
% Change the numbering of the figures and tables to match the chapters
\renewcommand\thefigure{\thechapter-\arabic{figure}}
\renewcommand\thetable{\thechapter-\arabic{table}}

\usepackage{scrhack}


% ------------------- Begin the document -----------------------------
\begin{document}


% ------------------- Title and Author -----------------------------
% Modify the details in the separate titlepage file

\include{Front_Matter/titlepage}

% ------------------- Rest of frontmatter -----------------------------

\frontmatter

\include{Front_Matter/abstract}\addcontentsline{toc}{chapter}{Abstract}
\include{Front_Matter/dedication}\addcontentsline{toc}{chapter}{Dedication}
\include{Front_Matter/declaration}\addcontentsline{toc}{chapter}{Declaration}
\include{Front_Matter/acknowledgements}\addcontentsline{toc}{chapter}{Acknowledgements}

\tableofcontents

\listoffigures \addcontentsline{toc}{chapter}{List of figures}
\listoftables \addcontentsline{toc}{chapter}{List of tables}

\include{Front_Matter/nomenclature}


% ------------------- Mainmatter -----------------------------
\mainmatter

\include{Body/1.Introduction}
\include{Body/2.Literature_survey}
\include{Body/3.Verification}
\include{Body/4.Validation}

% ------------------- Bibliography -----------------------------

\bibliographystyle{agsm}
\bibliography{ZoteroLibrary.bib}

% ------------------- Appendices -----------------------------
\begin{appendix}
%\addtocontents{toc}{\protect\contentsline{chapter}{Annexures}{}}
%\addtocontents{toc}{\protect\setcounter{tocdepth}{1}}
\makeatletter

\addtocontents{toc}{%
\begingroup
\let\protect\l@chapter\protect\l@section
\let\protect\l@section\protect\l@subsection
}
\makeatother

\include{Annexures/AnnexureA}

\end{appendix}



\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Parskip not functional in mainmatter section

Post by Ijon Tichy »

I cannot reproduce the problem. If I add two paragraphs using blindtext to the mainmatter there is a parskip between them. So please don't show us large document preambles but always a Infominimal working example.

However, the shown main document is a mess! To tell you only some of the issues:
  • You should not use \usepackage[utf8x]{inputenc} but \usepackage[utf8]{inputenc}. Option utf8x loads package ucs that is known to be incompatible with other packages (and maybe even with upcomming LaTeX releases). With LaTeX from 2018/04/01 you even do not need to load inputenc with option utf8 (but the outdated Overleaf installation still needs it).
  • You should not use package parskip with a KOMA-Script class, but use KOMA-Script option parskip. See the KOMA-Script manual for more information.
  • You should load hyperref as last package, because it has to redefine commands of several other packages. Only some packages have to be loaded after hyperref if there is a note about this in the package manual.
  • Usually you do not need float if you use a KOMA-Script class or package caption. Just use \captionof to have captions for non-floating objects and either \DeclareNewTOC or \DeclareFloatingEnvironment.
  • You should not load package colortbl after xcolor. Just load package xcolor with option table.
  • You should never use \addcontentsline after \include, because \include already finishes the current page, so the \addcontentsline mostly will add the wrong page to the table of contents. For not numbered chapters in the frontmatter you can simply use \chapter, because in the frontmatter these are not numbered but added to the table of contents. Alternatively and in the mainmatter you can use \addchap (or \addsec). See the KOMA-Script manual for more information.
  • You should not use \addcontentsline after \listoffigures or \listoftables because it will add the last page or even the page after the list to the table of contents. Use option listof=totoc of toc=listof. See the KOMA-Script manual for more information.
  • You should not use package tocloft with a KOMA-Script class. Use either \DeclareTOCStyleEntry or \RedeclareSectionCommand to modify the ToC entries. See the KOMA-Script manual for more information.
  • You should not make the chapter entries to the ToC the same like section entries. Use either \DeclareTOCStyleEntry or \RedeclareSectionCommand to modify the chapter ToC entries. See the KOMA-Script manual for more information.
If you understand German, please also read »Minimale Vorlage vs. maximale Probleme«.

BTW: Using natbib was nice and very recommended some years ago. But meanwhile biblatex (with biber) has many advantages not only because they support UTF8 encoding.
Last edited by Ijon Tichy on Thu Sep 26, 2019 10:24 am, edited 2 times in total.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
joeTex
Posts: 6
Joined: Mon Sep 23, 2019 11:58 pm

Parskip not functional in mainmatter section

Post by joeTex »

@Ijon Tichy, thank you so much for your assistance!

I am not very experienced with LaTeX (as you no doubt have seen), so forgive my ignorance.

I have implemented your suggestions (in the order mentioned, from top to bottom) and I am pleased to say that I have isolated the problem - it seems to be the tocloft package that causes all my misfortune. I have removed that package from the preamble and replaced it with \DeclareTOCEntryStyle{dottedtocline}{} ... It works very well.

All parskip instances are now fully functional.

Thanks once more! :D
Post Reply