4

I'd like to have an intro to a section 3 that would be referenced in the text as section 3.0. It should be a hidden subsection (before the first real subsection) that doesn't have a section header nor shows up in the table of contents.

\section{Section 3}
\label{sec:3}

\setcounter{subsection}{-1}
\subsection{ }
\label{sub:3_0}
yada yada

However, then I get a section header with the numbering. And I have tried

\section{Section 3}
\label{sec:3}

\subsection*{}
\label{sub:3_0}
yada yada

However, then my referencing, shown here

\subsection{Section 3.1}
\label{sub:3_1}
yada yada \cref{sub:3_0}.

only gives me section 3 instead of section 3.0.

Anybody know the answer? Also, feel free to comment on my style choice (using .0 section numbers).

3
  • 1
    It is not yet clear to me. If you do not want a number, then use the star form and a section title, e.g. \subsection*{Introduction}. \addcontentsline{toc}{subsection}{Introduction} would add en entry in the table of contents if needed. Then this subsection can be referenced by the title, e.g. "Introduction of section 3" or similar. But referencing a subsection by a non-existing number is IMHO just a source of confusion for the reader, because he cannot find the specified numbered subsection. Commented Jun 1, 2013 at 21:30
  • I would say that you have a strong point, and the phrasing "introduction to..." is probably the best solution, just for its simplicity. However, it would be good to be able to do what I ask as well. To clarify: I don't want the number, nor do I want any subsection name.
    – Patrick
    Commented Jun 1, 2013 at 21:42
  • 1
    Try \setcounter{subsection}{-1}\refstepcounter{subsection}\label{sub:hidden}
    – egreg
    Commented Jun 1, 2013 at 21:46

1 Answer 1

5

The way to achieve this is via \refstepcounter instead of \subsection:

enter image description here

\documentclass{article}
\begin{document}

\setcounter{section}{2}
\section{Section 3}\label{sec:3}

\setcounter{subsection}{-1}\refstepcounter{subsection}% Correct number & reference
\label{sub:3_0}
yada yada

\subsection{Subsection 3.1}\label{sub:3_1}
yada yada \ref{sub:3_0}.
\end{document}

\refstepcounter correctly sets the referencing label, yet doesn't print anything.

As mentioned in comments, it may cause confusion with the reader to have some reference without it actually being visible in the document itself. In this instance it may be better to state the reference as

In the introduction to Section~\ref{sec:3}...
2
  • Thanks! That did it exactly. The two main reasons I wanted this I guess is 1) because I may move around the arguments and 2) because the arguments are in the same section, and "introduction to this section" may leave the reader wondering if it's this chapter/section/subsection/subsubsection.
    – Patrick
    Commented Jun 2, 2013 at 11:24
  • The correct name for such a text in Germany would be "preamble".
    – Keks Dose
    Commented Jun 3, 2013 at 13:14

You must log in to answer this question.

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