7

When I use \ref to cross reference a \subsubsection, I get the output IV-B4 (at least using the IEEEtran document class).
Can I change the output to something like IV-B.4)?

9

Be careful with redefining such things. There are most likely good reasons why the default form is like it is.

You can change the reference text by redefining the \thesubsubsection macro. However, this will also affect the Table-of-Contents and – in normal classes – also the number in the \section itself. The IEEEtran class does these numbers differently and normally you don'y need a ToC, so you could simply do it like this.

Example:

\documentclass{IEEEtran}

\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection})}

\begin{document}
See~\ref{test}

\section{TEST}
\subsection{Test}
\subsubsection{test}\label{test}

\end{document}

This gives: See I-A.1)


To only change the reference text but not the ToC entry or sectioning number using any class you can redefine the reference prefix macro \p@subsubsection macro which is normally empty and added before the \thesubsubsection macro when the label is created. You could define it to hold the correct value and then gobble the \thesubsubsection part (actually \csname thesubsubsection\endcsname):

\makeatletter
\renewcommand{\p@subsubsection}{\thesubsection.\arabic{subsubsection})\expandafter\@gobble}
\makeatother

Note that this might conflict with packages which change the reference text as well, like hyperref (especially its \autoref macro).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.