I'd like to know if it's possible to reference the section numbers that have been repressed with the star (*) option. I've made a little example with two sections which are numbered, and several subsections which are not. If I use the \ref to point to labels within the subsections the references only display the most recent section numbers. Is that just a byproduct of hiding section numbers? I know I can get unreferenced sections to appear in a table of contents by explicitly adding them, is there a similar mechanism for getting their reference numbers
\documentclass[12pt]{article}
\title{Section Labelling Test}
\begin{document}
\maketitle
\section{First Section\label{sec:1}}
I'm interest in looking at Subsection~\ref{sec:2.1} which I'd expect to be 2.1. I'm not interested in Subsections~\ref{sec:1.1} or \ref{sec:1.2} though they should be 1.1 and 1.2 respectively.
\subsection*{First Subsection\label{sec:1.1}}
Not interesting
\subsection*{Second Subsection\label{sec:1.2}}
Irrelevant
\section{Second Section\label{sec:2}}
Some facts
\subsection*{First Subsection of the Second Subsection\label{sec:2.1}}
Subsection of interest!
\end{document}
referencing with numbers to subsections that aren'nt numbered is fooling the reader. It's like having a table of contents with page numbers but no single page has a page number written on it.
Though it could be done with \refstepcounter, for example:
\documentclass[12pt]{article}
\title{Section Labelling Test}
\begin{document}
\maketitle
\section{First Section\label{sec:1}}
I'm interest in looking at Subsection~\ref{sec:2.1} which I'd expect to be 2.1. I'm not interested in Subsections~\ref{sec:1.1} or \ref{sec:1.2} though they should be 1.1 and 1.2 respectively.
\refstepcounter{subsection}
\subsection*{First Subsection\label{sec:1.1}}
Not interesting
\refstepcounter{subsection}
\subsection*{Second Subsection\label{sec:1.2}}
Irrelevant
\section{Second Section\label{sec:2}}
Some facts
\refstepcounter{subsection}
\subsection*{First Subsection of the Second Subsection\label{sec:2.1}}
Subsection of interest!
\end{document}
That's ideal, cheers for the suggestion. I do agree with you that I am misleading the readers by providing a reference number for a section that doesn't actually appear but I feel that's the best option for my requirements.
I'm currently writing my thesis and I have several subsections in some chapters (describing related components of a large software system) where I've suppressed the numbering because I think stylistically it looks better. However in a later chapter I want to refer to a specific unnumbered subsection. At present the reference is something just a plain integer (e.g. see Section 11) but this doesn't provide any context such as which chapter this section is actually in. I had toyed with using the zref package to provide the reference as the section name rather than a number but again this provides no chapter context, unless I do something like (see the Title Of Section section in Chapter chapter of section). My supervisor may make me change it all anyway!