# Section roman and section cross-reference arabic

I want to change just the section cross-reference from roman to Arabic numbers in a paper using the IEEE template. An MWE of my problem is

\documentclass[journal]{IEEEtran}
\begin{document}
Section~\ref{sec-test} is incorrect.
\section{My Test}\label{sec-test}
\end{document}


The text showed in the phrase must be: "Section 1 is incorrect." (Arabic number) But the displayed text is "Section I is incorrect." (Roman number) The section title must remain "Section I" (Roman number).

Does someone know how to set this up?

• why do you want to confuse your readers like that? – Ulrike Fischer Jun 20 at 15:29
• It is a requirement from the journal in which I'm publishing it – tnas Jun 20 at 15:30
• Then why don't they provide the code for it? – Ulrike Fischer Jun 20 at 15:57

The following minimal example updates \refstepcounter in a way that re-stores \@currentlabel using \arabic rather than \Roman specifically when the section counter is being stepped. Both \subsections and \subsubsections require similar treatment and have been added as well.

\documentclass[journal]{IEEEtran}

\makeatletter
\let\oldrefstepcounter\refstepcounter
\renewcommand{\refstepcounter}[1]{%
\oldrefstepcounter{#1}% Regular \refstepcounter
\ifnum\pdfstrcmp{#1}{section}=0
% Update \@currentlabel for \section to be \arabic
\edef\@currentlabel{\arabic{section}}%
\else
\ifnum\pdfstrcmp{#1}{subsection}=0
% Update \@currentlabel for \subsection to match default + \arabic section counter
\edef\@currentlabel{\arabic{section}-\Alph{subsection}}%
\else
\ifnum\pdfstrcmp{#1}{subsubsection}=0
% Update \@currentlabel to match default for \subsubsection + \arabic for section
\edef\@currentlabel{\arabic{section}-\Alph{subsection}\arabic{subsubsection}}%
\fi
\fi
\fi
}
\makeatother

\begin{document}

Section~\ref{sec-test} is correct.

\section{My Test}\label{sec-test}

\end{document}


This has not been extensively tested and therefore comes with no guarantee.

The specification is quite bizarre: if a section is numbered “I” (with a Roman numeral), also cross-references should follow the scheme.

Anyway, it is quite easy to provide the required numbering scheme, because IEEEtran detaches title numbering from the related counter's representation: for the numbering of \section it uses \thesectiondis. Thus the following works.

\documentclass[journal]{IEEEtran}

\renewcommand\thesection{\arabic{section}}
\renewcommand\thesectiondis{\Roman{section}.}

\begin{document}

Section~\ref{sec-test} is incorrect.

\section{My Test}\label{sec-test}

\end{document}