Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

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).

share|improve this answer
    
It works. Thank you. –  Jose Apr 27 '11 at 13:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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