# My titleclass breaks subsubsection headings

I am using the titlesec package in conjunction with the ACM SIG Alternate document class to create a special kind of subsubsection as follows:

\documentclass{sig-alt-full}

% +++++ Begin Experiment Subsection ++++++
\newcommand{\subparagraph}{} % not defined in cls template
\usepackage{titlesec}
\titleclass{\experiment}{straight}[\subsection]
\newcounter{experiment}
\renewcommand{\theexperiment}{(\roman{experiment})}
\titleformat{\experiment}[hang]{\normalfont\normalsize\bfseries}
{Experiment\,(\roman{experiment}):}{.5em}{}[]
\titlespacing{\experiment}{0pt}{*2.5}{.5em}
% +++++ End Experiment Subsection ++++++

\begin{document}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\subsection{Experiments}
\experiment{Not a Subsubsection}
\end{document}


The problem is that elsewhere in my document I want to use plain old subsubsections. However, with the definition of my new titleclass, the formatting of the plain old subsubsection heading looks different than before and the numbering is also gone from the heading.

How can I get my \experiment subsubsections while leaving the regular subsubsections untouched?

-
The package titlesec is incompatible with your class: "Non standard sectioning command detected. Using default spacing and no format." Do you want that the experiments are numbered in sequence with subsubsections? –  egreg Sep 18 '12 at 10:52
@egreg No, I am looking for an alternative to the standard subsubsections and would like to have both environments numbered separately. –  janschaf Sep 18 '12 at 15:29
What should the number be on the left of the first \experiment in subsection 1.1? –  egreg Sep 18 '12 at 15:53
@egreg The number should not be on the left. As specified in the \titleformat command, the numbering should be in the heading. It should be a '1' formatted in roman letters. In the above example the output should be: "Experiment (i): Not a Subsubsection". –  janschaf Sep 19 '12 at 8:13

The easiest way is to forget about titlesec that's not compatible with the used class and to define \experiment in terms of \subsubsection:

\documentclass{sig-alt-full}

\usepackage{hyperref,bookmark}

%%% To cope with the "non standard" way the class uses
\newfont{\experimentfnt}{ptmb8t at 11pt}

\newcounter{experiment}
\renewcommand{\theexperiment}{(\roman{experiment})}
\newcommand{\experimentname}{Experiment}

\newcommand{\experiment}[1]{%
\subsubsection*{\refstepcounter{experiment}%
\experimentfnt Experiment~\theexperiment: #1}%
}

\begin{document}
\section{Section}\label{s}
\subsection{Subsection}
\subsubsection{Subsubsection}

\subsection{Experiments}
\experiment{Not a Subsubsection\label{ex1}}

In this experiment we do something; it is \autoref{ex1}.

\end{document}


The only drawback is that the label must be specified inside the argument. However, it seems that the class has many problems with hyperref, but not only: the labels are wrongly written in the .aux file, because \thepage is made equivalent to \relax.

I strongly suggest not using this class.

-
Thanks, @egreg. –  janschaf Sep 19 '12 at 11:07
@janschaf Please, have a read at the FAQ (link at the top right, just left to the search box) particularly at How do I ask questions here –  egreg Sep 19 '12 at 11:09
I am also using the hyperref package. With the above solution, \autoref{ex1} will produce the text "Section (i)". I would like this text to read "Experiment (i)". I tried \newcommand{\experimentautorefname}{Experiment}but this doesn't cut it. –  janschaf Sep 19 '12 at 11:12
Thanks, egreg. I think it should be \subsubsection*{\refstepcounter{experiment}%instead of \subsection*{\refstepcounter{experiment}%. I cannot edit your answer since this edit is smaller than 6 chars. –  janschaf Sep 24 '12 at 12:46