2

I am writing a thesis, whose outline is a bit treelike, so I would like to have a trunk part (that contains several chapters) and several branches (also containing some chapters).

I changed the name of the parts using

\renewcommand\partname{Trunk}
\part{Polish groups}

and then

\renewcommand\partname{Branch}
\part{The first branch},

this works fine.

However, since there is only one trunk, I would like the trunk part not to be numbered Trunk 1. Also, I would like the branches to start being numbered from Branch 1 (and not Branch 2).

But when I write

\part*{Polish groups},

only the title "Polish groups" appears on the page, with no indication "Trunk" like it would do with "Part 1".

Do you know how to do this? Thanks.

Edit. Here is a (hopefully) compilable code:

 \documentclass[12pt]{amsbook}

    \usepackage[margin=2cm]{geometry}
    \usepackage[english]{babel}
    \usepackage{amsmath}
    \usepackage{amsthm}
    \usepackage{amssymb}
    \usepackage{enumerate}
    \usepackage{ucs}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{color}
    \usepackage{ stmaryrd }
    \usepackage{hyperref}
    \usepackage[retainorgcmds]{IEEEtrantools}
    \usepackage{tikz}
    \usepackage[initials, shortalphabetic]{amsrefs}
    \usepackage{footnote}

      \title{Thèse}
    \author{}

    \begin{document}

    \tableofcontents


    \renewcommand\partname{Trunk}
    \part{Polish groups}

    \renewcommand\partname{Branch}
        \part{First branch}

\part{Second branch}

    \end{document}
2
  • Hi and welcome, since you don't need numbering, you could do it manually: `{\Huge Trunk \par Polish groups\par}. But maybe i didn't understand the question correct. Can you expand the code snippets to a compilable example, so we have some code and output and can understand what you mean?
    – Johannes_B
    Commented Jan 23, 2015 at 8:55
  • Hi, thanks for your answer. The idea would be not to do it manually so that the trunk part still appears a part in the table of contents, with the only change that "Part 1. Polish groups" be replaced by "Trunk. Polish groups". I hope I am being clearer. (Also, I don't know how to add an output to the question.)
    – Didi
    Commented Jan 23, 2015 at 9:05

2 Answers 2

3

From line 867 to 897 of amsbook.cls class is where the \partname, \thepart and \part are defined. Correspond to the problem that the number is not needed for Trunk, we can redefine the \thepart to be empty. And to the problem that the next part must number from one, we just reset the counter part to 0.

\documentclass{amsbook}
\begin{document}

    \renewcommand\thepart{}
    \renewcommand\partname{Trunk}
    \part{Polish groups}

    \setcounter{part}{0}
    \renewcommand\thepart{\arabic{part}}
    \renewcommand\partname{Branch}
    \part{First branch}

    \part{Second branch}

\end{document}
5
  • 3
    Please add some explanation to your answer. Also it is a good idea providing a complete document including the sample code that people can easily run to check for correctness. Commented Jan 23, 2015 at 9:54
  • Why \edef? Neither \thepart nor partname needs expansion as it's defined (at the moment)
    – user31729
    Commented Jan 23, 2015 at 11:52
  • 1
    @ChristianHupfer yes, you are right! There is no expansion needed. Either primitive TeX command \def or the LaTeX command \renewcommand is enough :)
    – Say OL
    Commented Jan 23, 2015 at 14:52
  • @AndrewSwann Nice comment (y) I will edit it now.
    – Say OL
    Commented Jan 23, 2015 at 14:54
  • Unfortunately, with this solution the table of contents does not look correct: a spurious dot appears between “Trunk” and “Polish groups”. This calls for a patch to the \@part command (modify \addcontentsline…) which may be document-class dependent.
    – GuM
    Commented Jun 22, 2015 at 22:03
1

Special care must be taken, of course, in order to produce the correct output also in the table of contents. The \@part command, as defined in the amsbook document class, issues an \addcontentsline command as follows:

\addcontentsline{toc}{part}{\partname\ \thepart. \protect\enspace\protect\noindent#1}%

As you can see, a period is added after \thepart; thus, redefining the latter command to produce no output is not enough: a patch to the above code in \@part would also be necessary, whose details may depend on the document class.

But you can also make up for this problem with a quick trick, which is illustrated by the following MWE:

\documentclass[a4paper]{amsbook}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\begin{document}

\tableofcontents

\begingroup
    \renewcommand*\partname{}
    \renewcommand*\thepart{\unskip Trunk}
    \part{Polish groups}
\endgroup
\setcounter{part}{0}
\chapter{Aaaaaa}
\lipsum[1]
\chapter{Bbbbbb}
\lipsum[2]

\renewcommand*\partname{Branch}
\part{First branch}
\chapter{Cccccc}
\lipsum[3-4]
\chapter{Dddddd}
\lipsum[5-6]

\part{Second branch}
\chapter{Eeeeee}
\lipsum[7]
\chapter{Ffffff}
\lipsum[8]

\end{document}

This alternative is less tricky than it might seem at first sight: after all, you could actually think of the word “trunk” as the “number” of the first part, but a “number” that, being a noun in itself, and not a numeral adjective, does not require another noun on which it depends. Note that \unskip is necessary to remove the preceding space. The .toc file will contain the line

\contentsline {part}{\ \unskip Trunk. \enspace \noindent Polish groups}{3}

which shows that the spacing will look right in the table of contents too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .