1

there is the same question of mine here:the same problem i need a consistent double spacing throughout the whole thesis. i cannot use double spacing in \usepackage[doublespacing]{setspace} as it messes up the whole title part. i modified my code, but the vertical distance between the chapter 1 and The title ONE (for example) still is not double space. For abstract chapter, i had to enter the \doublespacing command in the abstract.tex file. could you tell me where is the mistake?

\documentclass[12pt,oneside,letterpaper,chapterprefix=on,numbers=noenddot]{scrbook}
%%%page set-up
\setcounter{secnumdepth}{4}
\usepackage[margin=1in,includefoot,heightrounded]{geometry}%1 inch margins
\usepackage{mathptmx} %times new roman
\usepackage{setspace}%double spacing in text, not captions or footnotes
\usepackage{indentfirst} %indent first paragraph 
\setlength{\parindent}{2em} %adjust indentation
\usepackage[document]{ragged2e} %ragged right
\setlength{\RaggedRightParindent}{\parindent}
\usepackage{comment}% a convenient package
\pagestyle{plain}%remove headers
\usepackage[justification=raggedright,singlelinecheck=false,labelsep=period]{caption}
%captions left justify
\setkomafont{captionlabel}{\bfseries}%make caption label bold
\setkomafont{caption}{\bfseries}%make caption bold
\setcapindent{0pt}%removes hanging indent from captions
\usepackage{caption}
\captionsetup{figurename=FIGURE,tablename=TABLE}


%%% bibliography modifications
\usepackage[square,sort,comma,numbers]{natbib}
\setlength{\bibsep}{\baselineskip}%line spacing between citations
\setlength{\bibhang}{2em}%%%hanging identation
\makeatletter
\renewcommand\NAT@bibsetnum[1]{\settowidth\labelwidth{\@biblabel{#1}}%
   \setlength{\leftmargin}{\bibindent}\addtolength{\leftmargin}%
{\dimexpr\labelwidth+\labelsep\relax}%
 \setlength{\itemindent}{-\bibindent}%
 \setlength{\listparindent}{\itemindent}

   \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}%
   \ifNAT@openbib
     \addtolength{\leftmargin}{\bibindent}%
     \setlength{\itemindent}{-\bibindent}%
     \setlength{\listparindent}{\itemindent}%
     \setlength{\parsep}{0pt}%
   \fi
}
\makeatother

%%% extra code for getting the correct line spacing after references title
\let\oldbibliography\bibliography %store \bibliography in \oldbibliography
\renewcommand{\bibliography}[1]{{ %
 \let\chapter\section %copy\ section over\ chapter
 \oldbibliography{#1}}} %old\ bibliography

%%% uppercase chapters
\makeatletter
%\renewcommand\sectionlinesformat[4]{%
% \@hangfrom{\hskip#2 #3}{\MakeUppercase{#4}}%
%}
\renewcommand\chapterlinesformat[3]{%
 \@hangfrom{#2}{\MakeUppercase{#3}}%
}
\makeatother
\renewcommand\chapterlineswithprefixformat[3]{%
 \MakeUppercase{#2#3}%
}
%%% continuous table and figure numbering
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}

%%% chapter titles%%% THIS PART HAS BEEN MODIFIED TO ADJUST VERTICAL DISTANCE TO DOUBLE
\let\raggedchapter\centering
\RedeclareSectionCommand[
  beforeskip=0pt,
  afterskip=0pt]{chapter}
\renewcommand*{\chapterheadstartvskip}{\vspace*{-\baselineskip}}
\renewcommand*{\chapterheadendvskip}{\vspace*{0in}}
\renewcommand*{\chapterformat}{\chapappifchapterprefix{\nobreakspace}\thechapter}
\setkomafont{disposition}{\bfseries\normalsize}
\setkomafont{chapter}{\normalsize}
\makeatletter
\renewcommand*{\@@makechapterhead}[1]{\chapterheadstartvskip
  {%
    \setlength{\parindent}{\z@}\setlength{\parfillskip}{\fill}%
    \normalfont\sectfont\nobreak\size@chapter{}%
    \if@chapterprefix
      \let\@tempa\raggedsection
    \else
      \let\@tempa\@hangfrom
    \fi
    \@tempa{\ifnum \c@secnumdepth >\m@ne%
        \if@mainmatter
          \if@chapterprefix
            \expandafter\size@chapterprefix
          \else
            \expandafter\size@chapter
          \fi
          {\chapterformat}%
          \if@chapterprefix
            \size@chapterprefix{}\endgraf\nobreak%\vskip\baselineskip
          \fi
        \fi
      \fi
    }%
    {\raggedsection \interlinepenalty\@M\size@chapter{#1}\par}}%
  \nobreak\chapterheadendvskip
}
\makeatother
%%% section titles
\let\raggedsection\centering
\setkomafont{section}{\normalsize}
\RedeclareSectionCommand[
  beforeskip=0pt,
  afterskip=0.01pt]{section}
%%% subsection title
\let\raggedsubsection\centering
\setkomafont{subsection}{\normalsize}
\RedeclareSectionCommand[
  beforeskip=0pt,
  afterskip=0.01pt]{subsection}
%%% subsubsection titles
\let\raggedsubsubsection\centering
\setkomafont{subsubsection}{\normalsize}
\RedeclareSectionCommand[
  beforeskip=0pt,
  afterskip=0pt]{subsubsection}
%%% remove identation from captions
\usepackage{etoolbox}
\AtBeginEnvironment{figure}{\setlength{\RaggedRightParindent}{0em}}
\AtBeginEnvironment{table}{\setlength{\RaggedRightParindent}{0em}}
\patchcmd{\thebibliography}{\chapter*}{}{}


%%%modify table of contents 
\usepackage{tocloft}
\renewcommand{\cftchapaftersnum}{.} %place a period after chapter numbers
\setlength{\cftbeforetoctitleskip}{0pt} %keep at 1 inch margin
\setlength{\cftaftertoctitleskip}{0pt} % keep the double spacing
\renewcommand*\contentsname{TABLE OF CONTENTS} % rename contents
\renewcommand{\cfttoctitlefont}{\hspace*\fill}{\normalsize\bfseries}%keep consistent font size
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}} %center title
\KOMAoptions{toc=chapterentrydotfill} %dotted chapter entries
\setkomafont{chapterentry}{} %make chapter titles not bold
\addtokomafont{chapterentrypagenumber}{\mdseries} %make page numbers not bold
%%% indents numbered chapters
\RedeclareSectionCommand[tocnumwidth=3.5em]{chapter}
\renewcommand\addchaptertocentry[2]{%
  \ifstr{#1}{}{%
    \addtocentrydefault{chapter}{#1}{#2}%
  }{%
    \addtocentrydefault{chapter}{\hspace*{2em}#1}{#2}%
}}

%%% list of tables
\setlength{\cftbeforelottitleskip}{0pt} % keep at 1 inch margin
\setlength{\cftafterlottitleskip}{0pt} %keep the double spacing
\renewcommand*\listtablename{LIST OF TABLES} %rename contents
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\normalsize\bfseries} %keep consistent font size
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}%center title
\setlength{\cfttabindent}{0pt} % remove indentation from tables in lot 

%%% list of figures
\setlength{\cftbeforeloftitleskip}{0pt} % keep at 1 inch margin
\setlength{\cftafterloftitleskip}{0pt} %keep the double spacing
\renewcommand*\listfigurename{LIST OF FIGURES} % rename contents
\renewcommand{\cftloftitlefont}{\hspace*{\fill}\normalize\bfseries}% keep consistent font size
\renewcommand{\cftafterloftitle}{\hspace*{\fill}} %center title
\setlength{\cftfigindent}{0pt} % remove identation from figures in 1of


%%% set up appendix
%\ usepackage[page,toc,title]{appendix}
%\renewcommand{\appendixtocname}{APPENDICES}
\usepackage[toc,title]{appendix}
\renewcommand{\appendixtocname}{APPENDIX: EXAMPLE OF AN APPENDIX}
\renewcommand{\appendixpagename}{\vspace*{\fill}\centering\normalsize
APPENDICES\vspace*{\fill}}



%%% Figure packages
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{wrapfig}
\usepackage{pdfpages}
\usepackage{subcaption} % allows side by side figures

\usepackage{amsmath}
\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    linkcolor=black,
    urlcolor=black}
%%%---------------------------------------------------------------------

%%%-----------------------------------------------------------

%%%------------------------------------------------------------
\title{Cognitive}
\author{
A THESIS
Committe Members:\\
First Last, Ph.D.\\
First Last, Ph.D.\\
First Last, Ph.D.\\
College Designee:\\

}
\date{June 2017}
\begin{document}
\frontmatter
\maketitle
\setcounter{page}{2} % start page number with 2
\chapter{ABSTARCT}
\input{chapters/abstract}
\chapter{Acknowledgement}
\input{chapters/acknowledgements}
\clearpage
\tableofcontents
\mainmatter
\clearpage
\chapter{ONE}
\input{chapters/chapter01}
\chapter{TWO}
\input{chapters/chapter02}

\end{document}

THANK YOU

  • 2
    Off-Topic: There are several issues with your code, e.g., you use \RedeclareSectionCommand to change the skips of \chapter, but then you redefine the commands, that should use these values to not use them; you use tocloft but also redefine \l@chapter using \RedeclareSectionCommand. BTW: If you redefine \@@makechapterhead, all distances in the chapter head are because of your definition. So maybe first of all you should cleanup your code. BTW: Your example is not working. – Schweinebacke Jun 8 '17 at 6:06
  • thank you. this template is provided by the University and I could not believe at first I need to modify it. Now, i know it is a must – Bahar Jun 8 '17 at 19:20
  • Are you sure, you did not misinterpret the author rules? I cannot believe that you have to remove all vertical distances but the line separation in the document. This would result in an ugly, hard to read mess. Usually doublespacing means only to adapt the inter line space of the main text, but e.g. not to remove extra space before and after all headings, equations, figures, tables, and even no extra space in table of contents, list of figures, footnotes etc. – Schweinebacke Jun 9 '17 at 6:28
4

I have already cleaned up your code a bit here. With this example you could use \usepackage[doublespacing]{setspace} and add innerskip=0pt for the chapters to remove the additional vertical space between the chapter prefix and the chapter title:

\RedeclareSectionCommand[
  beforeskip=0pt,
  innerskip=0pt,% <- added
  afterskip=0pt,
  font=\normalsize,
  tocnumwidth=3.5em,
  tocentrynumberformat=\tocchapnumformat,
  toclinefill=\TOCLineLeaderFill
  ]{chapter}

enter image description here

Code still without packages and code not related to the question:

\documentclass[12pt,oneside,letterpaper,chapterprefix=on,numbers=noenddot,
  listof=leveldown% if lists like LoF and LoT should be on section level
]{scrbook}
\setuptoc{toc}{leveldown}% if ToC should be on section level

\usepackage[english]{babel}
\renewcaptionname{english}{\figurename}{FIGURE}
\renewcaptionname{english}{\tablename}{TABLE}
\renewcaptionname{english}{\listtablename}{List of Tables}
\renewcaptionname{english}{\listfigurename}{List of Figures}
\renewcaptionname{english}{\contentsname}{Table of Contents}

%%%page set-up
\usepackage[margin=1in,includefoot,heightrounded]{geometry}
\usepackage{mathptmx}
\usepackage[doublespacing]{setspace}% <- changed

\setlength{\parindent}{2em}
\usepackage[document]{ragged2e}
\setlength{\RaggedRightParindent}{\parindent}

\pagestyle{plain}

\usepackage[justification=raggedright,singlelinecheck=false,labelsep=period]{caption}
\usepackage{subcaption}
\setkomafont{captionlabel}{\bfseries}
\setkomafont{caption}{\bfseries}
\setcapindent{0pt}

\usepackage{xpatch}%
\AtBeginEnvironment{figure}{\setlength{\RaggedRightParindent}{0em}}
\AtBeginEnvironment{table}{\setlength{\RaggedRightParindent}{0em}}

%%% no indent for the list entries in LoT and LoF
\DeclareTOCStyleEntry[indent=0pt]{tocline}{table}
\DeclareTOCStyleEntry[indent=0pt]{tocline}{figure}

%%% continuous table and figure numbering
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}

% settings for chapters and other section levels
\setcounter{secnumdepth}{4}
\let\raggedsection\centering
\setkomafont{disposition}{\bfseries\normalsize}
%%% chapter titles
\RedeclareSectionCommand[
  beforeskip=0pt,
  innerskip=0pt,% <- added
  afterskip=0pt,
  font=\normalsize,
  tocnumwidth=3.5em,
  tocentrynumberformat=\tocchapnumformat,
  toclinefill=\TOCLineLeaderFill
  ]{chapter}
\newcommand*\tocchapnumformat[1]{\hspace*{2em}#1\autodot\hfil}
\addtokomafont{chapterentry}{\mdseries}
\addtokomafont{chapterentrypagenumber}{\mdseries}

%%% uppercase chapters
\makeatletter
%\renewcommand\sectionlinesformat[4]{%
% \@hangfrom{\hskip#2 #3}{\MakeUppercase{#4}}%
%}
\renewcommand\chapterlinesformat[3]{%
 \@hangfrom{#2}{\MakeUppercase{#3}}%
}
\makeatother
\renewcommand\chapterlineswithprefixformat[3]{%
 \MakeUppercase{#2#3}%
}
\xpatchcmd{\addchaptertocentry}
  {\addtocentrydefault{chapter}{#1}{#2}}
  {\addtocentrydefault{chapter}{#1}{\protect\chaptertocentryformat{#2}}}
  {}{\PatchFailed}
\newcommand*\chaptertocentryformat[1]{#1}
\AfterTOCHead[toc]{\renewcommand*\chaptertocentryformat[1]{\MakeUppercase{#1}}}

%%% section, subsection, subsubsection titles
\RedeclareSectionCommands[
  beforeskip=0pt,
  afterskip=0.01pt,
  font=\normalsize
  ]{section,subsection,subsubsection}

\usepackage{blindtext}% only for dummy text
\begin{document}
\frontmatter
\begin{titlepage}
Title
\end{titlepage}
\chapter{Abstract}
\blindtext
\chapter{Acknowledgement}
\blindtext
\tableofcontents
\listoffigures

\mainmatter
\blinddocument
\blinddocument
\begin{figure}
  \rule{2cm}{1cm}
  \caption{\blindtext}
\end{figure}
\end{document}
  • thank you. Unfortunately, there is no double space consistency through all the blind text. For instance, the vertical distance between the table of contents and abstract or abstract and acknowledgment is more than other lines. – Bahar Jun 8 '17 at 19:07
  • One more, the only way I know to add title is to write the title and use \maketitle command. If i use your code or doublesapcing command, my thesis title would be on one page and my name in other page. I am really confused ;( – Bahar Jun 8 '17 at 19:17
  • 1
    @Bahar If you want to change the vertical distances in the table of contents, you have to change the vertical distances in the table of contents. Currently only the inter line space of normal text is changed by package setspace and the vertical distances of chapter, section etc. headings are changed. There are several more vertical skips in LaTeX documents. If all of them should be 0 or a multiple of \baselineskip you have to change all of them. But in my opinion this wouldn't result in good typesetting but typewriter lookalike. In this case you wouldn't need LaTeX but an editor only. – Schweinebacke Jun 9 '17 at 6:19
  • 2
    @Bahar You can either use the predefined title pages using \maketitle or you can build title pages manually using the titlepage environment. See a LaTeX introduction for more information. The predefined title pages use variable distances. So it will not be doublespace from top to bottom and it uses different font sizes not only \normalsize so doublespace in your unusual sense wouldn't make sense. So I think, you have to make the title manually using titlepage environment. – Schweinebacke Jun 9 '17 at 6:30
2

The KOMA-Script manual states in section 16.4 that setspace is not compatible "enough" to do its full job. You have two options:

  1. Load package scrhack before setspace or
  2. Do not use setspace (e.g. \linespread{2}).
  • 1
    AFAIK the scrhack for setspace is only needed, if you use other document font sizes than 10pt, 11pt or 12pt. – Schweinebacke Jun 8 '17 at 6:13
  • @Schweinebacke "messes up the title part" seems to involve fontsizes with decimal values. scrhack is according to the documentation needed for those. – TeXnician Jun 8 '17 at 7:36
  • AFAIK only for document font sizes with decimal values, because only those influence \@ptsize and \@ptsize is the problematic macro, because setspace uses it for \ifnum choices and that will result in an error message, if \@ptsize is a non integer. – Schweinebacke Jun 8 '17 at 7:41

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.