# Completely disable automatic incrementing of section and subsection counters?

I'm using LaTeX as a final build step from a specific legal source (a code of laws) that already has numbering - which is not entirely logical. So, the auto-stepping section & subsection numbering does not match the numbering of the laws and really cannot do so programmatically.

So, I would love to completely disable LaTeX/XeTeX's 'counter' system and specify explicitly every single section & subsection number. Is this possible?

Update: currently using the 'article' document class, and here's a chunk of what I'm working on (with non-functional calls to \setcounter)

-
Welcome to TeX.SE! Which document class do you use? –  Mico Apr 19 '13 at 14:50
Currently using article, here's the start of the doc: gist.github.com/tmcw/5420843 –  tmcw Apr 19 '13 at 14:51
erh, \setcounter{secnumdepth}{-10} to disable numbering completely? –  daleif Apr 19 '13 at 14:56
@daleif -- I think what the OP wants is to set the sectioning-related counters directly, rather than to disable numbering entirely. However, I may be wrong. –  Mico Apr 19 '13 at 14:59
@mico To me it sounded more like the numbers was added as a part of the title. –  daleif Apr 19 '13 at 15:05

The following code -- to be inserted in your document's preamble -- disables the stepping of all sectioning-related counters (not just the section and subsection counters). It is up to you, then, to provide your own counter-setting directives.

\usepackage{etoolbox}
\makeatletter  % remove the \refstepcounter directive from \@sect macro
\patchcmd{\@sect}{\refstepcounter{#1}}{}{}{}
\makeatother


Addendum: I just had a chance to look at the code you posted on github. A quick remark: You can't set "1-135" as the value of a counter variable; it has to be an integer. If you need to have the subsection "number" appear as "1-135" (where, presumably, 1 is the section number), you should issue the command

\renewcommand\thesubsection{\thesection-\arabic{subsection}}


in the preamble and then simply set the subsection counter to 135 before invoking the \subsection command.

-
Can subsections have decimals? If one wanted a section like 29A or a subsection like 30.32, that's not possible? –  tmcw Apr 19 '13 at 15:48
@tmcw - would 30.32 be the "number" of a subsection or of a subsubsection (where 30 would be a subsection number)? Please advise. –  Mico Apr 19 '13 at 15:55
30.32 would be the number of a section: for instance, sections can go like '30, 30.1, 30.2, 31' in which 30.1 are siblings, not children, of 31. It's an odd system, but unfortunately not mine to change. –  tmcw Apr 19 '13 at 16:06
@tmcw - Thanks for clarifying this issue. Given the very much "free-format" nature of section and subsection numbers, I'd say it's probably easiest to use "unnumbered" sectioning commands -- \section*, \subsection*, etc -- and to supply the desired sectioning number as part of the argument of the sectioning command. E.g., you might write \section*{30.32\quad <Title of section>}. –  Mico Apr 19 '13 at 16:24