1

I need special numbering for an article: (e.g. Part 1 should be numbered J4.1, the section below should be J4.1.1). I did this with:

\renewcommand{\thepart}{J4.\arabic{part}}
\setcounter{part}{0}
\renewcommand{\thesection}{J4.\arabic{part}.\arabic{section}}
\setcounter{section}{0}

The numbering works quite well, but now the position of the titles in the TOC is wrong. Also I get a warning message: Overfull \hbox (14.58316pt too wide) detected.

TOC

I tried using tocloft and setting the numwidth, but that didn't change anything.

Here is the complete code:

\documentclass[final]{article}

\usepackage[a4paper,left=25mm,right=25mm,top=2cm,bottom=2cm]{geometry}

\renewcommand{\thepart}{J4.\arabic{part}}
\setcounter{part}{0}
\renewcommand{\thesection}{J4.\arabic{part}.\arabic{section}}
\setcounter{section}{0}

\begin{document}

\tableofcontents

\part{Part 1}
\section{Section 1}
\section{Section 2}
\subsection{Sub 1 asasdasd}
\subsection{Sub 2 sdlkfjls}
\subsection{Sub 3 ksdfjhj}
\end{document}

Do you have any ideas? Thx!

  • Welcome to the site! It would be great if you could provide a small, complete MWE that demonstrates the problem. To get one, make a copy of your file, and then strip it down successively until you have some code that reproduces the problem; once you have that, please add it to your question. Welcome! – cmhughes Jul 11 '14 at 15:13
  • Welcome to TeX.SX! we really need a little more information, at least identification of the documentclass you're using. even better would be a minimal working example (MWE) that illustrates your problem. – barbara beeton Jul 11 '14 at 15:14
  • OK, I could fix it with using the tocstyle package. It works now! This helped: tex.stackexchange.com/questions/7415/… – Sputnik Jul 11 '14 at 18:25
  • Update: Much nicer now with tocloft: Using the \renewcommand*\cftchapnumwidth{3em} \renewcommand*\cftsecnumwidth{6em} \renewcommand*\cftsubsecnumwidth{6em} commands, I can finally change the width of the empty space! Thanks everyone! – Sputnik Jul 11 '14 at 21:24