For legal documents I need the paragraphs numbered in the format section.paragraph. So e.g. the third paragraph in section 12 would be 12.3. I don't need subsections.
The paragraphs are all indented as a whole. By tweaking code found online I managed to do so. But: when I now try to reference such a paragraph, I get a ref of 4 digits instead of 2.
Expected output for the 3rd paragraph of section 12 (with \label{test} and \ref{test}) is: 12.3 Reality is, unfortunately: 12.3.1.1
Can I somehow cut of the last two digits? I searched online but couldn't find a solution. I looked into \hyperref and it's cousins but didn't see a solution either.
Here is a minimal example:
\documentclass{article}
\usepackage[german]{babel}
\usepackage[a4paper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\usepackage{titlesec}
\usepackage{etoolbox}
\setcounter{secnumdepth}{5}
\newcounter{para}[section]
\newcommand{\N}{\noindent\refstepcounter{para}\makebox[\parindent][l]{\thesection.\arabic{para}.}}
\newlength\titleindent
\setlength\titleindent{1.25cm}
\pretocmd{\paragraph}{\stepcounter{subsubsection}}{}{}
\titleformat{\section}{\normalfont\Large\bfseries}{\llap{\parbox{\titleindent}{\thesection\hfill}}}{0em}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\llap{\parbox{\titleindent}{\thesubsection\hfill}}}{0em}{}
\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{\llap{\parbox{\titleindent}{\thesubsubsection}}}{0em}{}
\titleformat{\paragraph}[runin]{\normalfont\normalsize}{\llap{\parbox{\titleindent}{\N\hfill}}}{0em}{}
\titlespacing*{\subsubsection}{0pt}{2ex plus 1ex minus 0.2ex}{1.5ex plus .2ex}
\titlespacing*{\paragraph}{0pt}{2ex plus 1ex minus .2ex}{0ex plus 0ex}
\pretocmd{\paragraph}{\stepcounter{subsection}}{}{}
\pretocmd{\subparagraph}{\stepcounter{subsubsection}}{}{}
\begin{document}
\section{Section 1}
\paragraph{}\label{1} Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\section{Section 2}
\paragraph{} At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \\
Here is a reference to above paragraph: \ref{1} \\
That's wrong; it should read "1.1"
\end{document}
Above code generates the following output:

Do I need to reference the refstepcounter?




enumeratehere for the paragraphs. if you really need a section-like command, just use\subsectionand forget the\paragraphs. the names of these divisions are totally arbitrary. all that matters is the hierarchy. if you need two levels, use section and subsection and adjust the formatting however you want. if you need four, use subsubsection and paragraph, too. don't get hung up on the names.\paragraphisn't for paragraph anyway.