# Using titlesec with mwrep class

I use mwrep class in my document and try to customize section titles with titlesec. It works OK for sections and subsections but it has no effect for chapters.

Here I read that "The mwrep class uses a non-standard manner to format their sectioning commands".

Would be still possible to use titlesec to style the chapter? Or should I forget about it and find another solution?

My MWE:

\documentclass[12pt,a4paper,polish]{mwrep}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{titlesec}

\titleformat{\chapter}[hang]
{\LARGE\scshape\bfseries}
{\thechapter}
{2pc}
{}

\titleformat{\section}[hang]
{\large\scshape\rmfamily}
{\thesection.}
{1em}
{\MakeLowercase}

\titleformat{\subsection}[hang]
{\normalsize\itshape\rmfamily}
{\thesubsection.}
{1em}
{}

\begin{document}

\chapter{Lorem}
\section{Ipsum}
\subsection*{Dolor}

\end{document}

• Welcome to TeX.SX! Just don't use the mwrep class, if it doesn't suit you. – egreg Jul 4 '15 at 18:09
• @egreg It is a report class adjusted according to Polish typographic standards so it does suit me a lot! I just have this one problem. – petru Jul 4 '15 at 18:19
• Sorry, but titlesec is not compatible with the class. There is some documentation of the class in the file mwcls.dtx that you should have in your system, but it is written in Polish. You perhaps can understand it and guess what to modify. – egreg Jul 4 '15 at 19:22

for the chapter use

\SetSectionFormatting[breakbefore,wholewidth]{chapter}
{56pt}
{24pt}


For section and subsection there are also macros so that you do not need the titlesec package

• Thanks, I've found that bypass as well. But it seems to have some limitation, e.g. I cannot use \MakeUppercase with that macro. Perhaps it has other limitation compared to titlesec. – petru Jul 4 '15 at 19:54

So, I finally read the documentation for mwrep (mwcls, actually) and found out that SetSectionFormatting is more flexible than I thought.

By having access to \HeadingNumber and \HeadingText you can write for example

\SetSectionFormatting[breakbefore,wholewidth]{chapter}
{56pt}
}
{24pt}


to get framed chapter number hanging on the margin

or

\SetSectionFormatting[breakbefore,wholewidth]{chapter}
{56pt}
{\normalfont\large{

to get the chapter title capitalized with increased letterspacing (textls from microtype package) and horizontal rule below.