0

So this is like a part 2 to my initial question here.

So pretty much, I'm recreating a thesis written in the 70's and want to maintain the bizarre sectioning practices that were used. The answer to my first post helped me solve the issue in the body text using titlesec, however I didn't get any help with the TOC as I didn't directly state it. Essentially, I want the following TOC; ignoring the indentation, this is exactly how the section titles appear correctly in the text.

I. INTRODUCTION ................................................. 1
    A. Prairie Raspberry ........................................ 1
    B. Research Objectives ...................................... 4

II. LITERATURE REVIEW ........................................... 6
    A. Fruit Structure and Composition .......................... 6
        1. Raspberry fruit structure ............................ 6
        2. Raspberry fruit composition .......................... 6

III. MATERIALS AND METHODS ..................................... 29
    A. Investigation of Juice Extraction ....................... 29
        1. Materials ........................................... 29
            a. Raspberry fruit ................................. 29
            b. Enzymes ......................................... 30
        2. Experimental Objectives.............................. 31
            a. Enzyme, temperature and time .................... 31
            b. Maceration, water dilution enzymes .............. 32

But what I'm getting is the following, with the chapters bolded.

1  INTRODUCTION                                                   1
   1.1  Prairie Raspberry ....................................... 1
   1.2  Research Objectives ..................................... 4

2  LITERATURE REVIEW                                              6
   2.1  Fruit Structure and Composition ......................... 6
        2.1.1  Raspberry fruit structure ........................ 6
        2.1.2  Raspberry fruit composition ...................... 6

3  MATERIALS AND METHODS                                         29
   3.1  Investigation of Juice Extraction ...................... 29
        3.1.1  Materials ....................................... 29
               3.1.1.1  Raspberry fruit ........................ 29
               3.1.1.2  Enzymes ................................ 30
        3.1.2  Experimental Objectives.......................... 31
               3.1.2.1  Enzyme, temperature and time ........... 31
               3.1.2.2  Maceration, water dilution enzymes ..... 32

So what I need to figure out is

  1. Make the number formatting a different style on a level basis, either Roman, Alph, arabic, or alph.

  2. Get rid of the "tab" alignment. I want each section to have a uniformly increasing left indent, say 3em per level, and then a simple dot and space following the numbering.

This is proving very difficult. I have tried many combinations of options using titletoc's \titlecontents and \dottedcontents but I haven't been able to do this, especially the number formatting.

I'm not sure if I like the dotted system with the chapter entries even though this is how the original looked. The bolded look without dots could be nicer so I'd like to know how to keep that if I decide to as well.

Can anyone help me out?

p.s. the documentation for titlesec and titletoc is really confusing...

EDIT:

The above TOC is without any of my attempts at modifying the TOC. Here are some attempts I've made.

The following is how I solved the section titles in the body of the text itself using titlesec, thanks to the answer in my previous topic.

\titleformat{\chapter} % command
[hang] % shape
{\bfseries\huge} % format
{\Roman{chapter}.} % label
{0.5em} % sep
{} % before-code
[] % after-code

So I figured the following could work in the TOC...

\titlecontents*{chapter} % <section-type>
[0pt] % <left>
{\addvspace{1em}} % <above-code>
{\Roman{chapter}. } % <numbered-entry-format>
{} % <numberless-entry-format>
{} % <filler-page-format>

This one gives the dot and space correctly, but no character is printed where the roman rumerals should go and the page number is dropped. See the image below.

TOC using first method

I also tried

\titlecontents*{chapter}%
[0pt]% left indent
{\addvspace{1em}}% stuff before
{\contentslabel{1em} }% before if there's a number
{}% before if there's no number
{\hfill\contentspage}% dots and page number
%[]% stuff after

This one doesn't have a working space or number formatting, but does get rid of the bold. All other examples I've had just do weird indenting, like the following.

\titlecontents{chapter}%
[3em]% left indent
{\addvspace{1em plus 0pt}\bfseries}% stuff before
{\contentslabel{3em}}% before if there's a number
{\hspace{-3em}}% before if there's no number
{\hfill\contentspage}% dots and page number
[\addvspace{0pt}]% stuff after

\dottedcontents{section}%
[5em]% left indent
{\addvspace{0pt}}% stuff before
{3.5em}% spacing of \contentslabel
{0.75em}% space between the dots
[\addvspace{0pt}]% stuff after

\dottedcontents{subsection}%
[7.5em]% left indent
{\addvspace{0pt}}% stuff before
{4.25em}% spacing of \contentslabel
{0.75em}% space between the dots
[\addvspace{0pt}]% stuff after

None of these work correctly, but I haven't been able to find any examples of people trying to do what I am.

I have received some success using the following, without any titletoc commands.

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\Alph{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}
\renewcommand{\thesubsubsection}{\alph{subsubsection}}

These do change the numbering to the right numbering format, but does not fix the indentation issue, see the image below.

TOC after using simple renewcommands

  • Please post a minimal example: code we can compile to reproduce the problem i.e. it should produce the output you show in your question which you want to change. – cfr Dec 13 '17 at 1:31
  • @cfr I added some example code that I had found by searching my issue. None of them work, but I think the first one is the closest to what I want. – Graham Dec 13 '17 at 1:37
1

Like this?

\documentclass[12pt]{report}
\usepackage{titlesec}
\usepackage{amssymb}
\usepackage[showframe]{geometry}
\usepackage{chngcntr}
\counterwithin*{subsubsection}{subsection}
\usepackage{titletoc}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{3}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\Alph{section}}
\renewcommand{\thesubsection}{\arabic{subsection}. }
\renewcommand{\thesubsubsection}{\alph{subsubsection})}
\titleformat{\chapter} % command
[hang] % shape
{\bfseries\huge} % format
{\thechapter.} % label
{0.5em} % sep
{} % before-code
[] % after-code

\titleformat{\section} % command
[hang] % shape
{\bfseries\LARGE} % format
{\thesection.} % label
{0.5em} % sep
{} % before-code
[] % after-code

\titleformat{\subsection} % command
[hang] % shape
{\bfseries\Large} % format
{\thesubsection.}% label
{0.5em} % sep
{} % before-code
[] % after-code

\titleformat{\subsubsection} % command
[hang] % shape
{\bfseries\large} % format
{\thesubsubsection.} % label
{0.5em} % sep
{} % before-code
[] % after-code
  \titlecontents{chapter}[2.5em]{\smallskip\bfseries}%\vspace{1cm}%
  {\contentslabel[\thecontentslabel]{2em}}%
  {}%numberless%
  {\hfill\contentspage}[\medskip]%
%
 \titlecontents{section}[3.8em]{\smallskip}%
  {\contentslabel[\thecontentslabel]{1.3em}}%numbered
  {\hspace*{-1.3em}}%numberless
  {\hspace{0.25em}\titlerule*[6pt]{.}\contentspage}[\smallskip]%
%
 \titlecontents{subsection}[5em]{}%
  {\contentslabel[\thecontentslabel]{1.25em}}%numbered
  {\hspace*{-1.25em}}%numberless
  {\hspace{0.25em}titlerule*[6pt]{.}\contentspage}[\smallskip]

 \titlecontents{subsubsection}[6.25em]{}%
  {\contentslabel[\thecontentslabel]{1.25em}}%numbered
  {\hspace*{-1.25em}}%numberless
  {\hspace{0.25em}\titlerule*[6pt]{.}\contentspage}[\smallskip]

\usepackage{lipsum}
\begin{document}

\tableofcontents

\chapter{INTRODUCTION}
\section{Prairie Raspberry}
\lipsum[1-10]
\section{Research Objectives}
\lipsum[11-20]
\chapter{LITERATURE REVIEW }
\section{Fruit Structure and Composition}
\subsection{Raspberry fruit structure}
\lipsum[21-28]
\subsection{Raspberry fruit composition}
\lipsum[29-36]

\chapter{MATERIALS AND METHODS}
\section{Investigation of Juice Extraction}
\subsection{Materials}
\subsubsection{Raspberry fruit}
\lipsum[37-39]
\subsubsection{Enzymes}
\lipsum[40-42]
\subsection{ Experimental Objectives}
\subsubsection{Enzyme, temperature and time}
\lipsum[43-45]
\subsubsection{Maceration, water dilution enzymes}
\lipsum[46-48]

\end{document} 

enter image description here

  • Thanks! Using your example I was able to make my own system. Unfortunately I couldn't get there to be a simple space between the period and the name of the section, so I played with the numbers myself until I found a nice and even solution. See my posted answer for a photo and code sample. – Graham Dec 13 '17 at 3:21
  • @Graham: lad to see you get exactly what you want. As you've discovered, this rest on the first optional-mandatory which sets the distance from the page left margin. Actually, my first trial led to a similar result, but I thought that for all levels, and not only the section level, the label should start at the left margin of the upper level. – Bernard Dec 13 '17 at 9:50
0

Thanks to @Bernard, I was able to achieve the following.

enter image description here

Code is as follows.

\renewcommand{\thechapter}{\Roman{chapter}. }
\renewcommand{\thesection}{\Alph{section}. }
\renewcommand{\thesubsection}{\arabic{subsection}. }
\renewcommand{\thesubsubsection}{\alph{subsubsection}. }

\titleformat{\chapter} % command
    [hang] % shape
    {\bfseries\huge} % format
    {\thechapter} % label
    {0.5em} % sep
    {} % before-code
    [] % after-code

\titleformat{\section} % command
    [hang] % shape
    {\bfseries\LARGE} % format
    {\thesection} % label
    {0.5em} % sep
    {} % before-code
    [] % after-code

\titleformat{\subsection} % command
    [hang] % shape
    {\bfseries\Large} % format
    {\thesubsection} % label
    {0.5em} % sep
    {} % before-code
    [] % after-code

\titleformat{\subsubsection} % command
    [hang] % shape
    {\bfseries\large} % format
    {\thesubsubsection} % label
    {0.5em} % sep
    {} % before-code
    [] % after-code

\titlespacing*{\chapter}{0pt}{10pt}{5pt}
\titlespacing*{\section}{0pt}{10pt}{5pt}
\titlespacing*{\subsection}{0pt}{10pt}{5pt}
\titlespacing*{\subsubsection}{0pt}{10pt}{5pt}

\titlecontents{chapter}[24pt]{\addvspace{1em}\bfseries}%\vspace{1cm}%
    {\contentslabel[\thecontentslabel]{24pt}}%
    {}%numberless%
    {\hfill\contentspage}[\smallskip]%

\titlecontents{section}[40pt]{}%
    {\contentslabel[\thecontentslabel]{16pt}}%numbered
    {\hspace*{-1.3em}}%numberless
    {\hspace{0.25em}\titlerule*[6pt]{.}\contentspage}[\smallskip]%

\titlecontents{subsection}[64pt]{}%
    {\contentslabel[\thecontentslabel]{16pt}}%numbered
    {\hspace*{-1.25em}}%numberless
    {\hspace{0.25em}\titlerule*[6pt]{.}\contentspage}[\smallskip]

\titlecontents{subsubsection}[88pt]{}%
    {\contentslabel[\thecontentslabel]{16pt}}%numbered
    {\hspace*{-1.25em}}%numberless
    {\hspace{0.25em}\titlerule*[6pt]{.}\contentspage}[\smallskip]

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.