0

I'm a little confused by this package when trying to do something that I would assume isn't that complicated.

I'm recreating a thesis written in the 70's and want to maintain the bizarre sectioning practices that were used. Each level has a different format. The following is a recreation of the table of contents that is in the original. Note that in the body of the thesis, there are no indents before the numbering in the section titles.

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
etc.

So, I need 4 levels of sections, which is feasible using chapters down to subsubsections, though I have to use a report style to get the chapters and the abstract to be formatted how I want. The problem lies with the numbering. Originally, I was hard typing in the "I"'s and "B"'s in the correct format like \section{B. Fruit Processing Technology} and disabled automatic numbering entirely using the following code in the preamble:

\setcounter{secnumdepth}{-2}

I would however like to use automatic numbering so that I don't accidentally make any mistakes in it. When I do this, because of the report style and using chapters, I'll get the following structure for my headers in both the text body and the table of contents (the indents are only present in the TOC, which is correct).

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

I do not want the "parent" numbering before the "child" numbering to be present. I also need to switch the numbering system to roman for chapters, captialized alpha for the sections, and lowercase alpha for subsubsections. I have titlesec installed and am trying to achieve the desired effect. So far, I've only been able to control the size and spacing of the headers using the following which I have in a separate file by \input{sectioning.tex}.

\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
{\roman{\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}

The attempt at using \roman{\thesection}. in the section label did not work as intended whatsoever. Does anyone have a solution that I can implement? I would like all the section formatting to be defined in this separate file.

So to summarize, I would like a way of using titlesec (or another, better package if it exists) to:

  1. Elimiate the printed parent section number when displaying the child number in both the text body and TOC.
  2. Change the numbering format to roman and alpha based on section depth.

Can anyone help with this?

0

This should do the trick:

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

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

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

\titleformat{\subsubsection} % command
[hang] % shape
{\bfseries\large} % format
{\alph{subsubsection}.} % label
{0.5em} % sep
{} % before-code
[] % after-code
  • Thanks for the quick reply. It seem syour solution works perfectly in the text body. However, the change is not showing up in the TOC which still has the 2.1.2.1 style. Any idea on changing that as well? – Graham Dec 12 '17 at 18:13
  • @Bernard I don't use titlesec but in your change to \chapter I think you might have put a ] where } should be in the label portion. – Peter Wilson Dec 12 '17 at 19:02
  • @Peter Wilson: Oh! yes. I'll fix that. Thanks for pointing it! – Bernard Dec 12 '17 at 19:09
  • I think I'll ask the TOC question in its own topic as it uses titletoc not titlesec. Thanks for your help, Bernard! – Graham Dec 13 '17 at 0:23
  • If you use titletoc, there should be no problem – it's a companion package of titlesec. I believe I have a similar example on my h.d. – Bernard Dec 13 '17 at 0:58

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.