The main problem is just how to get a section reference working, specifically in TeXMaker. I've never used \ref and \label before, so this is a first for me. I've done a little work searching for a solution, but haven't gotten too far.

Currently I'm at the stage where I run the program and two question marks appear when instead of the referenced section number. For syntax and such, sites like this and this are good for starting out, assuming that your only question is about syntax; however, none of these seem to really expand on what it is that's going on behind the \label and \ref commands.

So I looked to see what was going on behind the scene, because I recently tried and failed to use BibLaTex, so I found explanations like this and this, from which I get that if I am doing everything right in my code, then I should ideally be able to make a series of runs that will build the PDF and then fill the section numbers. If that is my only problem, then I don't know how to do that in TeXMaker anyways, because I wasn't sure which Configure->Quick Build option should work to get the right sequence of runs.

However, even those large explanations about how the file runs work doesn't apply specifically to TeXMaker, and so I was hesitant to go too much off of those for fear that TeXMaker as a compiler had a specific problem on it's own, or that one of my numerous packages was messing something up. The basic code I've tried to run is below, with all the preamble commands that I normally use.


%Formatting Libraries
\usepackage[autostyle, english = american]{csquotes}

%References %To be attempted at a later date

%For MATLAB Code
\usepackage{color} %red, green, blue, yellow, cyan, magenta, black, white
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue

%Symbols Libraries

%For Image Generation

%For Theorem Environment


\section{Introduction} \label{intro}

\section{Section 1}
\indent Here in \ref{sec:intro}.

  • 5
    Welcome to TeX.SX! The fact you're using Texmaker is irrelevant as far as the labels and references are concerned.
    – egreg
    Dec 2, 2017 at 15:47
  • Most probably off-topic here, but you're loading hyperref too early
    – user31729
    Dec 2, 2017 at 15:51
  • 1
    Just make sure that the keys used for \label and \ref match, e.g. \label{sec:intro} and \ref{sec:intro}.
    – Troy
    Dec 2, 2017 at 15:55
  • @Troy: Observed well -- did not spot that the OP uses \label{intro} only
    – user31729
    Dec 2, 2017 at 15:59

1 Answer 1


TeXmaker is not at all relevant to the discussion about labels and references here -- it is just a front-end editor. Just make sure that the labels and references share the same key, that is:

    \section{Introduction}\label{sec:intro}% <------
    Hello world, I am in Section~\ref{sec:intro}. % <------

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .