0

For my current project I need my document to have three parts. In the first and last part, I want the default sectioning, but in the middle part I need to apply a different style to the section level below \part. Since this style needs to have a separate page similar to that of \part, I considered using titlesec's \titleclass like this:

\titleclass{\mysection}{page}[\part]

However, that shifts the section levels of \chapter etc., which I need to work as normal for the other parts of the document. Is there a way to reset the section levels to their previous values? Or another way to achieve my goal?

I did consider using \titleformat{\chapter}..., but that leaves me with the issue of resetting several settings at the end, including the running chapter number (that should continue from the first part), and I'm not entirely sure how to do that either.

1 Answer 1

1

Not sure if I am misunderstanding the question, but there is no problem with redefining the format of section headings within the body of the document. Here I do it with \section, but you can do the same for chapters, parts etc.

The headings after the redefinition will take the new format (until you redefine again).

I am just using tcolorbox as an example to format -- you can use whatever you like.

\documentclass[10pt]{article}
\usepackage[explicit]{titlesec}
\usepackage[most]{tcolorbox}

%original definition
\titleformat{\section}
  {\normalfont\bfseries\itshape\fontsize{12.8}{14}\selectfont}
  {}{0pt}
  {\begin{tcolorbox}[]\thesection\hskip0.7em#1\end{tcolorbox}}
%end of original definition

\begin{document}

\section{A section}

Bla bla

\section{Another section}

\subsection{A Subsection}

%another definition
\titleformat{\section}
  {\normalfont\bfseries\itshape\fontsize{12.8}{14}\selectfont}
  {}{0pt}
  {\begin{tcolorbox}[
      enhanced,
      boxrule=0pt,
      arc=0pt,
      outer arc=0pt,
      interior code={\fill[overlay,cyan!30] (frame.north west) rectangle (frame.south east);},
    ]\thesection\hskip0.7em#1\end{tcolorbox}}
%end of other definition

\section{Another section with a difference}

\subsection{Another subsection}

\end{document}

enter image description here

2
  • Yes, but how would I store/reset the chapter counter? I basically want a set of sections that work on the same level as \chapter, but with a completely different style, and numbering. Here, chapters are different than sections, as chapter number carry on across part boundaries.
    – Vidar
    Feb 6, 2016 at 14:43
  • That's a different question but easy to do see tex.stackexchange.com/a/71174/15886 and add something like that Feb 6, 2016 at 16:05

You must log in to answer this question.

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