[Tex/LaTex] Cross Referencing numbers missing for the Sections only, of a document prepared in latex

cross-referencing

I am using cross reference for a document prepared in latex. The document gets compiled and all the included figures, tables and equations gets proper cross reference. Unlikely, before I am using `label{a}for the label and for referencing I am using\ref{a}`.

The problem is there when I need cross reference for the sections and subsections. The file gets compiled with no errors, but the number used as a reference for a particular section is missing, like this:

\section{intro}\label{s1}
Referring to section~\ref{s1}.

After compiling it's showing a message somewhat, like this

Referring to section . 

It doesn't displayed the referenced numbers. Do I need to add any package or what? The template is prepared according to the guidelines of Rinton Press Publishers.

EDIT – complete code:

\documentclass[twoside]{article}
\usepackage{jwe}
\begin{document}
\section{Intro}\label{s1}
\noindent I am a boy.

\section{Two}
\noindent Related Works referring to Section~\ref{s1}.
\end{document}

Best Answer

The Journal of Web Engineering's LaTeX code completely redefines the sectional units in such a way that referencing them is not possible using the default \label-\ref system. Here's a view on what the sectioning commands look like:

%--------------------------------------------------------------------------
% section commands 
\newcounter{sectionc}\newcounter{subsectionc}\newcounter{subsubsectionc}
\renewcommand{\section}[1] {\vspace{12pt}\addtocounter{sectionc}{1} 
\setcounter{subsectionc}{0}\setcounter{subsubsectionc}{0}\noindent 
          {\bf\thesectionc. #1}\par\vspace{5pt}}
\renewcommand{\subsection}[1] {\vspace{12pt}\addtocounter{subsectionc}{1} 
\setcounter{subsubsectionc}{0}\noindent 
{\bf\thesectionc.\thesubsectionc. {\kern1pt \bfit #1}}\par\vspace{5pt}}
\renewcommand{\subsubsection}[1] {\vspace{12pt}\addtocounter{subsubsectionc}{1}
          \noindent{\rm\thesectionc.\thesubsectionc.\thesubsubsectionc.
          {\kern1pt \it #1}}\par\vspace{5pt}}
\newcommand{\nonumsection}[1] {\vspace{12pt}\noindent{\bf #1}
          \par\vspace{5pt}}

Not only do they use old font declarations, there's no proper \refstepcounter to capture \labels. Instead, the package uses \addtocounter{<cntr>}{1}. For starters, you'd have to redefine \section to use \refstepcounter instead of \addtocounter. However, since this is for a journal submission, you should really question whether this is intended.

Here's a proper redefinition of \section included in a minimal example:

enter image description here

\documentclass{article}
\usepackage{jwe}

\makeatletter
\@addtoreset{subsectionc}{sectionc}
\@addtoreset{subsubsectionc}{subsectionc}
\makeatother

\renewcommand{\section}[1]{%
  \par\vspace{12pt}%
  \refstepcounter{sectionc}% This allows you to use \label and \ref properly
  \noindent{\bfseries\thesectionc. #1}%
  \par\vspace{5pt}}

\begin{document}

\section{Intro}\label{s1}
\noindent I am a boy.

\section{Two}
\noindent Related Works referring to Section~\ref{s1}.

\end{document}

My thought on this is that the journal probably wants people to do these references manually, which seems awkward.

Contact the journal and tell them they need to change things. Or at least ask them why they do it this way.

Related Question