2

This question already has an answer here:

I want to have an extra sectioning level under \part{}, say \subpart. It has no difference as for the location on the page or the size of the font with \part{} command.

I tried titlesec but I couldn't get it to work. I've read the documentation but no luck. This is the example:

\documentclass{book}

\usepackage{titlesec}
 \titleclass{\subpart}{page}[\part]
 \titleformat{\subpart}[block]{\centering\huge\bfseries}{}{10pt}{}[]
%\titlespacing*{\subpart}{}{}{}[]
\newcounter{subpart}
\renewcommand{\subpart}{\Alph{subpart}}
\begin{document}
        \part*{History}
    \subpart*{Before}
        \chapter*{1}
        \chapter*{2}
        \chapter*{3}
    \subpart*{After}
\part*{Evidence}
    \subpart*{Archeology}
\end{document}

Thanks.

marked as duplicate by Mike Renfro, Werner sectioning May 5 '16 at 14:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Andrew Swann's answer for Define subpart section seems to work, except for differences in subpart page formatting. And not sure why all your divisions are starred, but titlesec recommends setting the secnumdepth counter to disable numbering. \setcounter{secnumdepth}{-2} in Andrew's answer disables all numbering from parts on down. – Mike Renfro May 5 '16 at 12:05
  • Thanks, it seems a nice answer and I'll do as recommended for numbering. – nima May 5 '16 at 12:31
  • @MikeRenfro Yeah it is a duplicate question but with a slightly minor difference. I really searched the site not only today but back in a month when I had the problem and because I didn't find Andrew's answer back then I postpone dealing with the problem. By the way I want the subpart command to be printed exactly the same as part. even if one changes the page size it automatically place it at the center of the page. Bernard – nima May 5 '16 at 14:16
  • 1
    I don't treat "duplicate" as "bad question" or "should have searched better", but that the solutions are fundamentally the same. Assuming you can get subparts at all (Andrew's answer), formatting a subpart with titlesec is identical to formatting any other type of division. – Mike Renfro May 5 '16 at 14:20
2

You must ‘renewcommand’ \thesubbpart, not \subpart:

\documentclass[b5paper]{book}
\usepackage[b5paper, showframe]{geometry} \usepackage[newparttoc]{titlesec}

\titleclass{\subpart}{page}[\part]
\newcounter{subpart}
 \titleformat{\subpart}[block]{\centering\Huge\bfseries}{\thesubpart.}{10pt}{\thispagestyle{empty}}
\titlespacing*{\subpart}{0pt}{151pt}{12\baselineskip}
\renewcommand{\thesubpart}{\Alph{subpart}}

\begin{document}

        \part*{History}
    \subpart{Before}
        \chapter*{One}
        \chapter*{Two}
        \chapter*{Three}
    \subpart{After}
\part*{Evidence}
    \subpart*{Archeology}

\end{document} 

enter image description here

  • thank you @bernard. my document size is b5, is there an automatic way to place in the middle of the page. I don't maybe using pagewidth and pageheight if possible. Also is there a way to retain the font attributes of the \part command. I want it to be exactly the same to part. – nima May 5 '16 at 12:24
  • @nima: I've updated my answer for the page size (with the geometry package) and the font size. To place it in the middle of the page, I would advise against it. It would be better to use the golden ratio for aesthetic reasons. Other than that, it can be done, and the simplest way to do it is by trial and errors, if you have a rule in your pdf viewer. – Bernard May 5 '16 at 13:09
  • I'm already ok, I wonder how the original \part command do it regardless of the page size, is it simple to reproduce it for a new sectioning command or not? – nima May 5 '16 at 14:06
  • 1
    It shouldn't be hard (except perhaps for some details). The layout of part for books can be found in book.cls lines 299–349 which, after some generalitiesvfor class options (openright, twocolumn), describe successively \part and part* (cf \def@part and \def@spart). – Bernard May 5 '16 at 14:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.