Different section numbering styles for toc and body

I'm looking for a way to display section numbering differently in the text body and in the toc.

I've set up the numbering in the body as

\renewcommand*\theparagraph{\arabic{subsubsection}(\alph{paragraph})}


so I get something like 2(a) for this level (and 2(a)(i) for the next).

In the toc, I'd like this to just show as (a) or (i).

I know you can set different section headers in the toc by using, eg

\subsection[toc]{body}


but I can't find something similar for numbering.

Any help would be appreciated :)

EDIT: I've included the full context of what I'm trying to do

\ProvidesPackage{aglc}
\NeedsTeXFormat{LaTeX2e}

\RequirePackage{parskip}
\RequirePackage{chngcntr}
\RequirePackage{titlesec}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\counterwithin*{subsection}{section}
\counterwithin*{paragraph}{subsection}
\counterwithin*{subparagraph}{paragraph}

% I Section
\renewcommand\section{\@startsection {section}{1}{\z@ }%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus  .2ex}{\normalfont \centering \large \sc }}

\renewcommand*\thesection{\Roman{section}}

% A SubSection
\renewcommand\subsection{\@startsection {subsection}{2}{\z@ }%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}{\normalfont \centering \large \emph }}

\renewcommand*\thesubsection{\Alph{subsection}}

% 1 SubSubSection
\renewcommand\subsubsection{\@startsection {subsubsection}{3}{\z@ }%
{-3.25ex \@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}{\normalfont \emph }}

\renewcommand*\thesubsubsection{\arabic{subsubsection}}

% (a) Paragraph
\renewcommand\paragraph{\@startsection {paragraph}{4}{\z@ }%
{3.25ex \@plus 1ex \@minus .2ex}%
{1.5ex \@plus .2ex}{\normalsize \emph }}

\renewcommand*\theparagraph{\arabic{subsubsection}(\alph{paragraph})}

% (i) SubParagraph
\renewcommand\subparagraph{\@startsection {subparagraph}{5}{\z@ }%
{3.25ex \@plus 1ex \@minus .2ex}%
{1.5ex \@plus .2ex}{\normalsize \emph }}

\renewcommand*\thesubparagraph{\arabic{subsubsection}(\alph{paragraph})(\roman{subparagraph})}

% I tried commenting out the above \renewcommands and adding the code here, but it didn't work correctly

\newcommand{\case}[1]{\emph{#1}}
\newcommand{\caseref}[1]{[\emph{#1}]}

\newcommand{\statute}[2][Qld]{\emph{#2} (#1)}

\newcommand{\latin}[1]{\emph{#1}}

\endinput

-
Welcome to TeX.sx! –  hpesoj626 Oct 28 '12 at 22:53

The titlesec package can be used here. The modifications to the .sty file:

\ProvidesPackage{aglc}
\NeedsTeXFormat{LaTeX2e}

\RequirePackage{parskip}
\RequirePackage{chngcntr}
\RequirePackage{titlesec}

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\counterwithin*{subsection}{section}
\counterwithin*{paragraph}{subsection}
\counterwithin*{subparagraph}{paragraph}

% I Section
\renewcommand*\thesection{\Roman{section}}

\renewcommand\section{\@startsection {section}{1}{\z@ }%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus  .2ex}{\normalfont \centering \large \sc }}

% A SubSection
\renewcommand*\thesubsection{\Alph{subsection}}

\renewcommand\subsection{\@startsection {subsection}{2}{\z@ }%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}{\normalfont \centering \large \emph }}

% 1 SubSubSection
\renewcommand*\thesubsubsection{\arabic{subsubsection}}

\renewcommand\subsubsection{\@startsection {subsubsection}{3}{\z@ }%
{-3.25ex \@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}{\normalfont \emph }}

% (a) Paragraph
\renewcommand*\theparagraph{(\alph{paragraph})}

\titleformat{\paragraph}
{\normalfont\normalsize\em}
{\renewcommand*\theparagraph{%
\arabic{subsubsection}(\alph{paragraph})}\theparagraph}
{1em}{}

\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex \@plus .2ex}

% (i) SubParagraph
\renewcommand*\thesubparagraph{(\roman{subparagraph})}

\titleformat{\subparagraph}
{\normalfont\normalsize\em}
{\renewcommand*\thesubparagraph{%
\arabic{subsubsection}\theparagraph(\roman{subparagraph})}\thesubparagraph}
{1em}{}

\titlespacing*{\subparagraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex \@plus .2ex}

\newcommand{\case}[1]{\emph{#1}}
\newcommand{\caseref}[1]{[\emph{#1}]}

\newcommand{\statute}[2][Qld]{\emph{#2} (#1)}

\newcommand{\latin}[1]{\emph{#1}}

\endinput


Since titlesec was used to change the formatting for \paragraph and \subparagraph, it could also be used for the other sectional units.

Here's a simple test document using the aglc.sty file to show the desired changes in action:

\documentclass{article}
\usepackage{aglc}
\usepackage{lipsum}% just to generate text for the example

\begin{document}

\tableofcontents
\section{Test section}
\subsection{Test subsection}
\subsubsection{Test subsubsection}
\paragraph{Test paragraph}
\lipsum[2]
\subparagraph{Test subparagraph}
\lipsum[2]

\end{document}


And the resulting document:

-
@sapi I updated my answer with the modifications to the .sty file. Please let me know if things work as expected now. –  Gonzalo Medina Oct 29 '12 at 0:09
almost. The modifications fix the table of contents and the paragraph styles, but because they removed my \renewcommand\paragraph, the actual text starts on the same line as the heading (instead of having a line break). If I add that back in, it breaks as before. What should I change in your definition to preserve the space after /paragraph and /subparagraph? Thanks again :) –  sapi Oct 29 '12 at 0:19
@sapi answer updated. I hope everything is OK now. –  Gonzalo Medina Oct 29 '12 at 0:27
Thanks, that looks to work perfectly! :) –  sapi Oct 29 '12 at 0:35