4

I'm writing a legal document, using article as the document class. The document is divided into numbered sections (\S). The sections themselves are divided into numbered paragraphs, which in turn can contain normal text, enumerations, lists, etc.

I found a very informative guide on how to do the paragraph numbering in the Lyx-users archive. Following the guide there, I created a new paragraph counter (parno), and now my paragraphs are numbered the way I want them. However, I'm still struggling with references to the specific paragraphs.

I'm using LyX. My preamble right now contains the following:

\renewcommand{\thesection}{\S\arabic{section}}
\newcounter{parno}[section]
\renewcommand{\theparno}{\arabic{section}.\arabic{parno}}
\newcommand{\p}{\stepcounter{parno}\theparno.\ }

Assume I put a label on the first paragraph in section 2 (the one labelled "2.1"). Now I want the internal reference to this label to say "2.1" (or "§2.1" could also work); when I do this, however, I get "§2" as the default reference, without the paragraph number.

How can I force the reference to contain the parno as well?

1
  • 1
    Even though you've got an answer, maybe you might want to check out scrjura: it's part of the KOMA Script classes, specifically made for legal writing.
    – Ingmar
    Aug 10 at 17:58

1 Answer 1

4

You should use \refstepcounter instead of \stepcounter (I am using Polish text, guessing from your name):

\begin{document}

\renewcommand{\thesection}{\S\arabic{section}}
\newcounter{parno}[section]

\renewcommand{\theparno}{\arabic{section}.\arabic{parno}}

\newcommand{\p}{\refstepcounter{parno}\theparno.\ }

  
 \section{Pierwsza}
 
 \p Pierwszy\label{jeden}
 
 
 W paragrafie \ref{jeden} mamy\ldots
 
 \p Drugi \label{dwa}
 
  W paragrafie \ref{dwa} mamy\ldots
  
  \end{document}

enter image description here

1
  • 1
    Thanks, works like a charm. And BTW, your guess was correct ;-) Aug 10 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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