Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an article with multiple sections. Say Section 1 and Section 2, with subsections for each. But I want one section, say Section 2 here, to be treated specially. This question has two parts.

  1. For section 2, I want the counter to just return the subsection number, i.e. instead of 2.3 I just want 3.
  2. I want the section numbering to also only use the subsection numbers.

The reason for this is that this is a Notes section, so is treated specially. See the illustration below.

\documentclass{article}
\begin{document}

\section{Section one}\label{one}

See Note~\ref{note.three}. % First part of question. How can I make this read "See Note 3." not "See Note 2.3."?

\section{Notes}\label{notes}
\subsection{First note}\label{note.one} % Second part of question. How can I make this read "1 First note" not "2.1 First note"?
Some text.
\subsection{Another note}\label{note.two} % Ditto
Some more text.
\subsection{Yet another note}\label{note.three} % Ditto
Yet more text.
\end{document}
share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

You can redefine the subsection counter for the special section and then redefine it again to its default behaviour after this section:

\documentclass{article}
\begin{document}

\section{Section one}\label{one}

See Note~\ref{note.three}.

\renewcommand\thesubsection{\arabic{subsection}}
\section{Notes}\label{notes}
\subsection{First note}\label{note.one}
Some text.
\subsection{Another note}\label{note.two}
Some more text.
\subsection{Yet another note}\label{note.three}
Yet more text.

\renewcommand\thesubsection{\thesection.\arabic{subsection}}
\section{Section three}
\subsection{A subsection}

\end{document}

enter image description here

Another option would be to use the chngcntr package and its \counterwithout (before the special section), \counterwithin (after the special section) commands:

\documentclass{article}
\usepackage{chngcntr}

\begin{document}

\section{Section one}\label{one}

See Note~\ref{note.three}.

\counterwithout{subsection}{section}
\section{Notes}\label{notes}
\subsection{First note}\label{note.one}
Some text.
\subsection{Another note}\label{note.two}
Some more text.
\subsection{Yet another note}\label{note.three}
Yet more text.

\counterwithin{subsection}{section}
\section{Section three}
\subsection{A subsection}

\end{document}
share|improve this answer
add comment

First off, I can't help but observe that you're running the risk of greatly confusing your readers if you have sections numbered 1, 2, ... as well as (within one section only) subsections numbered 1, 2, ... I'm afraid that the fact that LaTeX typesets section headings in \Large and subsection headings in \large is not going to help dispel the confusion to any significant degree.) You may be better off using an enumerate environment in the Notes section, and then referring to the \items within the enumerate environment.

However, if you must use subsection numbering without prefixing the corresponding section's number, you can do so by typing

\begingroup
\renewcommand{\thesubsection}{\arabic{subsection}}

at the start of the zone with the new numbering scheme, and typing

\endgroup

at the end of the zone.

Given the concerns I expressed earlier, you may want to switch to "alphabetic" or "roman" rather than "arabic" numbering for this special zone. E.g., if you typed

\renewcommand{\thesubsection}{(\alph{subsection})}

you'd get subsection "numbers" typeset as (a), (b), ..., and cross-references to these subsections would also be typeset as (a), (b), etc.

share|improve this answer
    
Is using labels for the enumerate environment an option? I thought of doing that earlier, but section numbers seemed more natural. Can you illustrate how the enumerate environment would work? –  Faheem Mitha May 3 '12 at 20:39
    
Absolutely: each \item in an enumerate environment can be assigned a \label and hence can be cross-referenced using the usual \ref mechanism. –  Mico May 3 '12 at 20:42
    
And this would return the integer corresponding to the number in the enumerate environment to an external ref? –  Faheem Mitha May 3 '12 at 20:43
    
Ok, apparently it does, without any extra work. The only thing is that without the subsection one can't give nice titles to the subsections. –  Faheem Mitha May 3 '12 at 20:51
    
If you need to use the \subsection method and need to use arabic numerals to "number" the subsections without the section number prefix, do consider using a redefinition such as \renewcommand{\thesubsection}{(\arabic{subsection})} -- note the parentheses around the subsection numeral -- rather than just \renewcommand{\thesubsection}{\arabic{subsection}}. Your readers will appreciate it. :-) –  Mico May 3 '12 at 20:54
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.