GeneralHow to set \subsubsubsection in my document

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
chandangiri
Posts: 20
Joined: Thu Sep 06, 2007 7:31 pm

How to set \subsubsubsection in my document

Post by chandangiri »

I am preparing one document as follows:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\newcounter{subsubsubsection}[subsubsection]
\def\subsubsubsectionmark#1{}
\def\thesubsubsubsection {\thesubsubsection
.\arabic{subsubsubsection}}
\def\subsubsubsection{\@startsection
{subsubsubsection}{4}{\z@} {-3.25ex plus -1
ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\def\l@subsubsubsection{\@dottedtocline{4}{4.8em}
{4.2em}}
\begin{document}
\section{AAA}
\subsection{BBB}
\subsubsection{cccc}
\subsubsubsection{dddd}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The file is not comiling correctly. Can't I use \subsubsubsection like that? Please help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Re: How to set \subsubsubsection in my document

Post by Juanjo »

In addition to \part, \section, \subsection and \subsubsection, in the article document class, there exist the predefined commands \paragraph and \subparagraph. Give them a try before defining new sectioning commands.
spiegboy
Posts: 120
Joined: Thu Dec 06, 2007 9:58 am

How to set \subsubsubsection in my document

Post by spiegboy »

you can get a subsubsubsec by defining a new list environment.

Code: Select all

Code, edit and compile here:
\newcounter{subcount}
\newenvironment{mysub}
{\begin{list}
{\textbf{\thesubsubsection.\arabic{subcount}}}
{\setlength{\itemindent}{2.2em}
\setlength{\rightmargin}{.6in}
\setlength{\labelwidth}{1in}
\setlength{\labelsep}{.2in}
\setlength{\parsep}{.5ex plus .2ex minus .1ex}
\setlength{\itemsep}{0ex plus .2ex minus 0ex}
\usecounter{subcount}}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

How to set \subsubsubsection in my document

Post by Juanjo »

The code in the first post does not work since all the subsubsubsection stuff should be in between the \makeatletter and \makeatother commands. By the way, the \bf command is obsolete and \subsubsubsectionmark is not needed, since no pagestyle contains that command (not at least the standard ones).

Before introducing a new sectioning command in an article, in my opinion, one should consider other alternatives:

1) Move to the book or report classes. The \chapter command provides a new level.
2) Use \part.
3) Try \paragraph.
4) Reorganize the document.

If finally one really needs a new numbered level behaving like \section and like, the simplest approach is to redefine \paragraph and increment the counters secnumdepth and tocdeph, as the following example shows:

Code: Select all

Code, edit and compile here:
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\makeatletter
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{0ex}%
{-3.25ex plus -1ex minus -0.2ex}%
{1.5ex plus 0.2ex}%
{\normalfont\normalsize\bfseries}}
\makeatother
\stepcounter{secnumdepth}
\stepcounter{tocdepth}
\begin{document}
\tableofcontents
\section{Section title}
\subsection{Subsection title}
\subsubsection{Subsubsection title}
\paragraph{Paragraph title}
\blindtext
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
psrivats
Posts: 3
Joined: Sat Apr 17, 2010 6:17 pm

Re: How to set \subsubsubsection in my document

Post by psrivats »

Juanjo, thanks for your suggestion--it works very well. I have a related issue that is driving me crazy.

I structure my report using \section, \subsection, \subsubsection and \paragraph commands. I like the paragraphs, but the paragraph numbering usually continues across sections and subsections. What is the method to "reset" this paragrapah numbering such that it starts fresh in each section or subsection?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to set \subsubsubsection in my document

Post by gmedina »

Hi,

you could use the \counterwithin command provided by the chngcntr package.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
psrivats
Posts: 3
Joined: Sat Apr 17, 2010 6:17 pm

How to set \subsubsubsection in my document

Post by psrivats »

gmedina wrote:Hi,

you could use the \counterwithin command provided by the chngcntr package.
Thanks for the suggestion. I just used this in my preamble:

Code: Select all

Code, edit and compile here:
\setcounter{secnumdepth}{6}
\renewcommand\theparagraph{\Alph{paragraph}}
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{0.0001pt \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{0.0001pt \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\counterwithin{paragraph}{subsubsection}
\counterwithin{subparagraph}{paragraph}
\makeatother
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Is this the right way to go about this?
Last edited by psrivats on Mon Apr 19, 2010 12:52 am, edited 1 time in total.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to set \subsubsubsection in my document

Post by gmedina »

SImply load the package in the preamble of your document:

Code: Select all

\usepackage{chngcntr}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
and then use

Code: Select all

\counterwithin{paragraph}{section}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
to reset the paragraph counter every time a new section is produced (replace "section" with "subsection" in the code above to reset the paragraph counter every time a new subsection is produced).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

How to set \subsubsubsection in my document

Post by Juanjo »

The code

Code: Select all

\counterwithin{paragraph}{subsubsection}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
subordinates the paragraph counter to the subsubsection one, but it also redefines \theparagraph. If you want to preserve your redefinition of \theparagraph, simply use the starred version of \counterwithin, that is, \counterwithin*.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
psrivats
Posts: 3
Joined: Sat Apr 17, 2010 6:17 pm

Re: How to set \subsubsubsection in my document

Post by psrivats »

\counterwithin*{paragraph}{section} did the trick. I removed the other line I had.

Thank you very much.
Post Reply