4

I have a list of sections in my document...

\section{animals}
\section{places}

etc..

I need to organize the contents within each section. To do this I decided to use subsubsections instead of subsections in order to save some space...

\section{animals}
\subsubsection{cats}
\subsubsection{dogs}
\section{places}
\subsubsection{muntains}
\subsubsection{lakes}

My problem is that the numbering of the subsubsections does not restart with the new section...how do I fix this?

Thanks

gabboshow
  • 143
  • 5

3 Answers3

5

Rather than distort the document markup, you can just specify that subsections are styled like subsubsections, just copying the relevant line from article.cls

\documentclass{article}

% copy from subsubsection
\makeatletter
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}}
\makeatother
\begin{document}
\tableofcontents
  \section{animals}
  \subsection{cats}
  \subsection{dogs}
  \section{places}
  \subsection{muntains}
  \subsection{lakes}
\end{document}
David Carlisle
  • 757,742
3

Is it like this?

\documentclass{article}
\usepackage{etoolbox}
\renewcommand{\thesubsubsection}{\thesection.\arabic{subsubsection}}
\preto{\section}{\setcounter{subsubsection}{0}}
\begin{document}
  \section{animals}
  \subsubsection{cats}
  \subsubsection{dogs}
  \section{places}
  \subsubsection{muntains}
  \subsubsection{lakes}
\end{document}

enter image description here

With numbers:

\documentclass{article}
\usepackage{etoolbox}
\usepackage{fmtcount}
\renewcommand{\thesubsubsection}{\thesection.\Numberstring{subsubsection}}
\preto{\section}{\setcounter{subsubsection}{0}}
\begin{document}
  \section{animals}
  \subsubsection{cats}
  \subsubsection{dogs}
  \section{places}
  \subsubsection{muntains}
  \subsubsection{lakes}
\end{document}
3

You also can do that with the chngcntr package and its counterwithin command. If you want the label be typed as, say, 1 rather than 1.1, use \counterwithin*:

\documentclass[12pt]{article}% http://ctan.org/pkg/amsproc

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{chngcntr}

\counterwithin{subsubsection}{section}
\begin{document}

\section{animals}
\subsubsection{cats}
\subsubsection{dogs}
\section{places}
\subsubsection{mountains}
\subsubsection{lakes}

\end{document} 

enter image description here

Bernard
  • 271,350