I am writing a thesis using my institution's template. However, when I use \ref{label} command, there is a spacing after the label and punctuation/comma. My working is as follows:


\usepackage{UTMThesis, enumerate, amsfonts, longtable, qtree, etoolbox, array, rotating, pgf, tikz, tikz-cd, algorithm, csquotes}

    \@normalsize \normalsize

\usetikzlibrary{arrows, matrix, positioning, shapes, shapes.geometric, calc, intersections, decorations.pathreplacing}
    \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
    \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%


\usepackage{cite}                       % change  cite from [1,2,3] to [1-3] etc for number system
\makeatletter                           % change from
\renewcommand{\@biblabel}[1]{#1.}     % [1] to 1. etc 
\makeatother                            % in list of references
%\input{Pictex.tex} % using pictex
\cfoot{\vspace{-.35cm}\thepage}  % 
    \section{Background and motivation}
    In Section \ref{section:background}, we talked about...

that produces:

enter image description here

How can I fix this?

  • The problem you've encountered would appear to be caused by some code in UTMThesis.sty. Please tell us more about this style file. Is it available online? – Mico Feb 7 at 4:59
  • 1
    There's probably a \renewcommand{\thesection}{\thechapter.\arabic{section}\quad} within UTMThesis.sty. Instead the style should use \@seccntformat to set the space in the section counter formatting; not set it as part of the representation. – Werner Feb 7 at 5:07

I was able to replicate the issue when using UTMThesis.sty from How to write the definition of each term in an equation with pointing arrows? That style file has

\renewcommand{\thesection} % space between sect. etc.
  {\thesection\hspace{-.3cm}.\arabic{subsection} \hspace{-.135cm}}

Including the space within the \thesection representation makes it carry through to any \label and eventually the \ref as well. So, instead you'll need to redefine \thesection to the following:


You can increase the gap between the sectional unit number and title, adjust it via \@seccntformat:

\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname\qquad}

The default space is \quad (equivalent to \hspace{1em}).

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.