축약된 참고문헌: 꼭 필요한 참고문헌만, 더 이상은 필요하지 않습니다.

축약된 참고문헌: 꼭 필요한 참고문헌만, 더 이상은 필요하지 않습니다.

독일의 법률 보고서는 종종 다소 이상한 구조 방식을 사용합니다. 일반적인 숫자 대신

ㅏ.

(B., CD ...) 첫 번째 레벨의 경우,

나.

-- 두 번째 수준의 로마 숫자

1.

세 번째 수준의 아라비아 숫자

ㅏ)

b), c), d) ... 네 번째 수준의 경우

아아)

bb), cc), dd)는 다섯 번째 수준입니다.

다음과 같은 거의 최소한의 예제에서 이를 구현했습니다. 간략한 참고자료를 갖고 싶습니다. 섹션 »B.<를 읽고 있고 하위 섹션 »B.II.<에 대한 참조가 있는 경우에는 »II.<를 인쇄하는 것으로 충분합니다. 그러나 섹션 A.를 읽으려면 »B.II.«가 필요합니다. B.II.3.a)cc)에서 B.II.3.a)bb)의 항목을 참조하는 경우 출력은 \ref분명히 B.II.3.a)bb)가 되어서는 안 되며 단순히 bb ). B.II.4.에 있는 경우 참조에는 3.a)bb)가 나와야 합니다.

그러나 CI1.의 어딘가에서 참조하는 경우 B.II.3.a)bb)에 대한 전체 참조가 필요합니다.

특별 요청: 솔루션은 Varioref 패키지에도 적용되어야 합니다.

jura 문서 클래스는 이러한 종류의 참조를 제공합니다. 하지만 나는 여러 가지 이유로 KOMA 스크립트에 의존합니다. 그래서 jura.dtx에서 코드를 가져와서 적용하려고 했지만 이해할 수 없는 오류 메시지가 나타납니다. 아래를 참조하세요.

\ref그래서: 텍스트의 위치에 따라 참조할 수 있습니까 ? 모든 솔루션을 환영합니다.


Ulrike의 답변을 편집하십시오.

이 코드는 항상 "II"를 생성합니다. 하위 섹션보다 낮은 수준:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel, blindtext}

\setcounter{secnumdepth}{5} % fünf Ebenen



\renewcommand*{\thesection}{\Alph{section}.}
\renewcommand*{\thesubsection}{\Roman{subsection}.}
\renewcommand*{\thesubsubsection}{\arabic{subsubsection}.}
\renewcommand*{\theparagraph}{\alph{paragraph})}%)
\renewcommand*{\thesubparagraph}{\alph{subparagraph}\alph{subparagraph})}

\usepackage{zref-user,zref-counter}
\usepackage{expl3}


\makeatletter


\zref@newprop{section}[1]{\the\c@section}
\zref@newprop{subsection}[1]{\the\c@subsection}

\zref@addprop{main}{section}
\zref@addprop{main}{subsection}

\ExplSyntaxOn

\newcommand\myref[1]{%
 \hyperref[#1]{
 \int_compare:nTF
  {
   \zref@extractdefault {#1} {section} {0} = \the\c@section
  }
  {
   %ref is from current section
   \int_compare:nTF
    {\zref@extractdefault {#1} {subsection} {0}  = 0 }
    {Was~nun?}
    {\int_to_Roman:n{\zref@extractdefault {#1} {subsection} {0}}.}
  }
  {
  %ref is from other section
  \int_to_Alph:n  {\zref@extractdefault {#1} {section} {0}}.
  \int_to_Roman:n {\zref@extractdefault {#1} {subsection} {0}}
  }}}

\ExplSyntaxOff
\makeatother
%\usepackage{xcolor}
\usepackage[]{hyperref}

\newcommand\Label[1]{\zlabel{#1}\label{#1}}

\begin{document}

\section{First}
\Label{sec:first}

I'm refering to the second section and I'd like to have a full
reference like this: \myref{sec:secondofsecond}.

\section{Second}
\Label{sec:second}

\myref{sec:secondofsecond}, \myref{sec:first}, \myref{sec:second} And lets test the
new references, see \myref{CLA:first-paragraph} or \myref{CLA:first-second.second}

\subsection{Firstofsecond}
\Label{sec:firstofsecond}

Text.

\subsection{Secondofsecond}
\Label{sec:secondofsecond}

Now down the tree:

\subsubsection{first of second.second}
\Label{CLA:first-second.second}

Just some letters. 

\paragraph{first-paragraph}
\Label{CLA:first-paragraph}

And more text. 



\end{document}

이것은 나의 초기 MWE이며 이제는 더 이상 사용되지 않습니다.

\documentclass[english, parskip=half, numbers=noendperiod]{scrartcl}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}
\usepackage{babel, blindtext}

\setcounter{secnumdepth}{5} % five levels

\renewcommand*{\thesection}{\Alph{section}.}
\renewcommand*{\thesubsection}{\Roman{subsection}.}
\renewcommand*{\thesubsubsection}{\arabic{subsubsection}.}
\renewcommand*{\theparagraph}{\alph{paragraph})}%)
\renewcommand*{\thesubparagraph}{\alph{subparagraph}\alph{subparagraph})}
\renewcommand*{\paragraphformat}{\theparagraph{}\enskip}
\renewcommand*{\subparagraphformat}{%
  \thesubparagraph{}\enskip}

\makeatletter
\renewcommand{\p@subsection}{\thesection}
\renewcommand{\p@subsubsection}{\thesection\thesubsection}
\renewcommand{\p@paragraph}{\thesection\thesubsection\thesubsubsection}
\renewcommand{\p@subparagraph}{\thesection\thesubsection\thesubsubsection\theparagraph\,}
\makeatother{}

\begin{document}

\section{First}
\label{sec:first}

I'm refering to the second section and I'd like to have a full
reference like this: \ref{sec:secondofsecond}. 

\section{Second}
\label{sec:second}

\subsection{Firstofsecond}
\label{sec:firstofsecond}

Text.

\subsection{Secondofsecond}
\label{sec:secondofsecond}

But now I'm refering to »Firstofsecond« and my readers do not need the
full reference (\ref{sec:firstofsecond}), simply »I.« would be sufficient.

From here a reference to »first of second / second« should look like
this: »1.« and not \ref{sec:first-second-second}

\subsubsection{First of second / second}
\label{sec:first-second-second}

text.

\end{document}

좋아요, 이제 더 이상 사용되지 않는 jura.dtx의 코드를 재활용하는 아이디어로 넘어갑니다.

jknappen의 조언에 따라 나는 내가 원하는 동작을 정확히 구현하기 위해 jura.dtx의 코드를 사용하려고 했습니다. 코드를 다음과 같이 변경했습니다.

%\documentclass[english, parskip=half, numbers=noendperiod]{scrartcl}
\documentclass[english]{article}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}
\usepackage{babel, blindtext}

\setcounter{secnumdepth}{5} % fünf Ebenen



\renewcommand*{\thesection}{\Alph{section}.}
\renewcommand*{\thesubsection}{\Roman{subsection}.}
\renewcommand*{\thesubsubsection}{\arabic{subsubsection}.}
\renewcommand*{\theparagraph}{\alph{paragraph})}%)
\renewcommand*{\thesubparagraph}{\alph{subparagraph}\alph{subparagraph})}

%% Code stolen from jura.dtx
\makeatletter{}
\newcommand*{\@greek}[1]{\ifcase#1\relax\or$\alpha$\or$\beta$\or
$\gamma$\or$\delta$\or$\varepsilon$\or$\zeta$\or$\eta$\or$\vartheta$\or
$\iota$\or$\kappa$\or$\lambda$\or$\mu$\or$\nu$\or$\xi$\or$o$\or$\pi$\or
$\rho$\or$\sigma$\or$\tau$\or$\upsilon$\or$\varphi$\or$\chi$\or$\psi$\or
$\omega$\else\@ctrerr\fi}
\newcounter{lvla}
\newcounter{lvlb}
\newcounter{lvlc}
\newcounter{lvld}
\newcounter{lvle}
\newcounter{lvlf}
\newcounter{lvlg}
\newcounter{lvlh}
\newcounter{lvli}
\newcounter{lvlj}
\newcounter{lvlk}
\newcounter{lvll}
\renewcommand*{\thelvla}{\J@Number}
\renewcommand*{\thelvlb}{\J@Number}
\renewcommand*{\thelvlc}{\J@Number}
\renewcommand*{\thelvld}{\J@Number}
\renewcommand*{\thelvle}{\J@Number}
\renewcommand*{\thelvlf}{\J@Number}
\renewcommand*{\thelvlg}{\J@Number}
\renewcommand*{\thelvlh}{\J@Number}
\renewcommand*{\thelvli}{\J@Number}
\renewcommand*{\thelvlj}{\J@Number}
\renewcommand*{\thelvlk}{\J@Number}
\renewcommand*{\thelvll}{\J@Number}

\newcounter{tiefe}\setcounter{tiefe}{1}
%\setcounter{tocdepth}{12}
%\setcounter{secnumdepth}{12}
\newcommand*{\J@Number}{\J@NumberRoot{\value{tiefe}}%
\J@NumberEnd{\value{tiefe}}}
\newcommand*{\J@NumberRoot}[1]{\J@INumberRoot{#1}%
{\csname c@lvl\@alph{#1}\endcsname}}
\newcommand*{\J@INumberRoot}[2]{%
\ifcase#1\or
\@Alph{#2}\or
\@Roman{#2}\or
\@arabic{#2}\or
\@alph{#2}\or
\@alph{#2}\@alph{#2}\or
\@greek{#2}\or
\@greek{#2}\@greek{#2}\or
(\@arabic{#2})\or
(\@alph{#2})\or
(\@alph{#2}\@alph{#2})\or
(\@greek{#2})\or
(\@greek{#2}\@greek{#2})\fi}
\newcommand*{\J@NumberEnd}[1]{\ifnum#1<8\ifnum#1<4.\else)\fi\fi}

\newcommand*{\J@SetCurrent}{\xdef\@currentlabel{{\arabic{lvla}}%
{\arabic{lvlb}}{\arabic{lvlc}}{\arabic{lvld}}{\arabic{lvle}}%
{\arabic{lvlf}}{\arabic{lvlg}}{\arabic{lvlh}}{\arabic{lvli}}%
{\arabic{lvlj}}{\arabic{lvlk}}{\arabic{lvll}}}}

\ifnum\value{lvl\alph{tiefe}}=1%
\PackageWarning{alphanum}{only one subitem in level "\J@Number" ending}%
\fi
\setcounter{lvl\alph{tiefe}}{0}
\addtocounter{tiefe}{-1}

\renewcommand*{\ref}{%
\@ifstar{\@tempswatrue\J@ref}{\@tempswafalse\J@ref}}
\newcommand*{\J@ref}[1]{%
\expandafter\ifx\csname r@#1\endcsname\relax
 \protect\G@refundefinedtrue
 \nfss@text{\reset@font\bfseries ??}
 \@latex@warning{Reference '#1' on page \thepage \space undefined}%
\else
 \expandafter\J@refX\csname r@#1\endcsname
\fi
}
\newcommand*{\J@refX}[1]{\expandafter\J@refXX#1}
\newcommand*{\J@refXX}[2]{%
\ifcat_\ifnum9<1#1_\else X\fi
  #1%
\else
  \expandafter\J@refA#1%
\fi}
\newcommand*{\J@refA}[6]{\@tempcnta\@ne%
\J@refP1{#1}0\J@refP2{#2}{#1}\J@refP3{#3}{#2}\J@refP4{#4}{#3}%
\J@refP5{#5}{#4}\J@refP6{#6}{#5}\J@refB#6}
\newcommand*{\J@refB}[7]{\J@refP7{#2}{#1}\J@refP8{#3}{#2}%
\J@refP9{#4}{#3}\J@refP{10}{#5}{#4}\J@refP{11}{#6}{#5}%
\J@refP{12}{#7}{#6}\J@NumberEnd\@tempcnta}
\newcommand*{\J@refP}[3]{%
\if@tempswa%
 \ifnum#2>0\@tempcnta#1\,\J@INumberRoot{#1}{#2}\fi
\else%
 \ifnum#2=\value{lvl\@alph{#1}}%
  \ifnum#1=12\PackageError{alphanum}{Self-reference detected!}{You used
    a \protect\ref\space in the same section as the referenced
    \protect\label\MessageBreak That makes no sense!}\fi
 \else
  \ifnum#2>0\@tempcnta#1\@tempswatrue\J@INumberRoot{#1}{#2}\else
   \ifnum#3>0%
   \@tempcnta#1\advance\@tempcnta-1\relax\J@INumberRoot{\@tempcnta}{#3}%
   \fi
  \fi
 \fi
\fi}

\makeatother{}




\begin{document}

\section{First}
\label{sec:first}

I'm refering to the second section and I'd like to have a full
reference like this: \ref{sec:secondofsecond}. 

\section{Second}
\label{sec:second}

\subsection{Firstofsecond}
\label{sec:firstofsecond}

Text.

\subsection{Secondofsecond}
\label{sec:secondofsecond}

But now I'm refering to »Firstofsecond« and my readers do not need the
full reference (\ref{sec:firstofsecond}), simply »I.« would be sufficient.

From here a reference to »first of second / second« should look like
this: »1.« and not \ref{sec:first-second-second}

\subsubsection{First of second / second}
\label{sec:first-second-second}

text.


\end{document}

안타깝게도 오류가 있습니다(파일 이름: kurze-verweise-mwe.tex).

./kurze-verweise-mwe.tex:134: Missing number, treated as zero.
<to be read again> 
                   I
l.134 ...ence like this: \ref{sec:secondofsecond}.

./kurze-verweise-mwe.tex:134: Missing = inserted for \ifnum.
<to be read again> 

여기 두 가지 예 중 하나에 대한 해결책을 찾을 시간과 재미를 갖고 있는 사람이 있습니까?

여기에 이미지 설명을 입력하세요

답변1

이론적으로 이는 그리 어렵지 않습니다. zref를 사용하여 레이블의 섹션, 하위 섹션 등의 다양한 값을 모두 저장할 수 있으며, 그런 다음 해당 값을 테스트하고 현재 값과 비교하여 어떤 일이 발생해야 하는지 결정하기만 하면 됩니다.

실제로는 꽤 많은 테스트가 있고 일반적으로 모든 분기를 올바르게 수행하려면 큰 종이가 필요하기 때문에 모든 레벨에 대해 실제로 수행하려는 경우 약간 지루할 수 있습니다. (저는 첫 번째 시도에서는 절대 수행하지 않습니다.) .

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel, blindtext}

\setcounter{secnumdepth}{5} % fünf Ebenen



\renewcommand*{\thesection}{\Alph{section}.}
\renewcommand*{\thesubsection}{\Roman{subsection}.}
\renewcommand*{\thesubsubsection}{\arabic{subsubsection}.}
\renewcommand*{\theparagraph}{\alph{paragraph})}%)
\renewcommand*{\thesubparagraph}{\alph{subparagraph}\alph{subparagraph})}

\usepackage{zref-user,zref-counter}
\usepackage{expl3}


\makeatletter


\zref@newprop{section}[1]{\the\c@section}
\zref@newprop{subsection}[1]{\the\c@subsection}

\zref@addprop{main}{section}
\zref@addprop{main}{subsection}

\ExplSyntaxOn

\newcommand\myref[1]{%
 \hyperref[#1]{
 \int_compare:nTF
  {
   \zref@extractdefault {#1} {section} {0} = \the\c@section
  }
  {
   %ref is from current section
   \int_compare:nTF
    {\zref@extractdefault {#1} {subsection} {0}  = 0 }
    {Was~nun?}
    {\int_to_Roman:n{\zref@extractdefault {#1} {subsection} {0}}.}
  }
  {
  %ref is from other section
  \int_to_Alph:n  {\zref@extractdefault {#1} {section} {0}}.
  \int_to_Roman:n {\zref@extractdefault {#1} {subsection} {0}}
  }}}

\ExplSyntaxOff
\makeatother
%\usepackage{xcolor}
\usepackage[]{hyperref}

\newcommand\Label[1]{\zlabel{#1}\label{#1}}

\begin{document}

\section{First}
\Label{sec:first}

I'm refering to the second section and I'd like to have a full
reference like this: \myref{sec:secondofsecond}.

\section{Second}
\Label{sec:second}

\myref{sec:secondofsecond}, \myref{sec:first}, \myref{sec:second}

\subsection{Firstofsecond}
\Label{sec:firstofsecond}

Text.

\subsection{Secondofsecond}
\Label{sec:secondofsecond}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

당신은 알고 있습니까?쥐라 패키지? 그러나 꽤 오래되고 지원되지 않으며 스케치한 미세한 등급 수준 구조를 제공합니다(그리고 α) β) 및 αα) ββ)로 표시된 수준까지 더 내려갑니다.

jura편집: (또는 레벨 구조를 포함하는) 도입된 문서 마크업은 \usepackage{alphanum}일반적인 LaTeX 섹션 명령(예: \section등)과 호환되지 않습니다. , , 를 jura사용하여 단면화하는 스타일을 사용해야 합니다 .\toc\sub\levelup

답변3

그만큼답변~의울리케 피셔나에게 길을 보여줬고 하루 종일 고민한 끝에 다음과 같은 해결책을 찾았습니다.

아마도 그것은 당신이 읽게 될 코딩 수준 중 가장 낮은 수준일 것이므로 주의하십시오. 누군가가 더 나은 해결책을 생각해낸다면, 좋습니다!

하지만 울리케 님의 아낌없는 도움이 없었다면 불가능했을 것입니다. 정말 감사합니다!

일부 댓글은 독일어로 되어 있습니다. 죄송합니다. 지금은 늦었고 오늘 제가 쓴 내용을 내일 이해할 수 있을지 의문입니다! 아, 그리고 주석에 있는 다양하고 쓸모없는 "("는 Emacs를 행복하게 만들기 위한 것입니다. 그렇지 않으면 "{"와 "}"가 일치하지 않습니다.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel, blindtext}

\setcounter{secnumdepth}{5} % fünf Ebenen



\renewcommand*{\thesection}{\Alph{section}.}
\renewcommand*{\thesubsection}{\Roman{subsection}.}
\renewcommand*{\thesubsubsection}{\arabic{subsubsection}.}
\renewcommand*{\theparagraph}{\alph{paragraph})}%)
\renewcommand*{\thesubparagraph}{\alph{subparagraph}\alph{subparagraph})}

\usepackage{zref-user, zref-counter}
\usepackage{expl3}


\makeatletter


\zref@newprop{section}[1]{\the\c@section}
\zref@newprop{subsection}[1]{\the\c@subsection}
\zref@newprop{subsubsection}[1]{\the\c@subsubsection}
\zref@newprop{paragraph}[1]{\the\c@paragraph}
\zref@newprop{subparagraph}[1]{\the\c@subparagraph}

\zref@addprop{main}{section}
\zref@addprop{main}{subsection}
\zref@addprop{main}{subsubsection}
\zref@addprop{main}{paragraph}
\zref@addprop{main}{subparagraph}

\ExplSyntaxOn

\newcommand\myref[1]{%
 \hyperref[#1]{%
  \int_compare:nTF
  {% A.-Ebene prüfen: sind wir auf dem gleichen Zweig? 
   \zref@extractdefault {#1} {section} {0} = \the\c@section
  }
  { % Ja, wir sind auf dem gleichen Zweig
    % Existiert eine weitere Ebene?
    \int_compare:nTF
    {\zref@extractdefault {#1} {subsection} {0}  = 0}
    % Wenn subsection 0 ist, also nicht existiert, dann muss section ausgegeben
    % werden. 
    {
     % \emph{Fehlerhafter Verweis}
    \int_to_Alph:n  {\zref@extractdefault {#1} {section} {0}}.
    }
    % Wenn dagegen subsection existiert, dann geht die Prüfung weiter:
    {
     % OK, weitere ebene existiert. 
     \int_compare:nTF % I.-Ebene
      {
        \zref@extractdefault {#1} {subsection} {0}  = \the\c@subsection 
      }% Sind wir auf der gleichen I.-Ebene?
      {% I.-Ebene: Gleiche Ebene
        % Prüfung: gibt es eine weitere Ebene?
        \int_compare:nTF
        {\zref@extractdefault {#1} {subsubsection} {0} = 0}
        {% Wenn 0, dann keine weitere Ebene und subsection ausgeben:
          \int_to_Roman:n {\zref@extractdefault {#1} {subsection} {0}}.
        }
        {% OK, weitere Ebene existiert
              \int_compare:nTF % subsubsection-Ebene
                {% 1.-Ebene prüfen
                  \zref@extractdefault {#1} {subsubsection} {0} = \the\c@subsubsection  
                }
                {% 1.-Ebene ist gleich
                  %Prüfung: gibt es eine weitere Ebene?
                  \int_compare:nTF % Gibt es eine a-Ebene?
                  {\zref@extractdefault {#1} {paragraph} {0} =  0}
                  {% Wenn 0, dann keine weitere Ebene und subsubsection ausgeben:
                    \int_to_arabic:n { \zref@extractdefault {#1} {subsubsection} {0}}.
                  }
                  {% Paragraph existiert:
                   \int_compare:nTF % a-Ebene prüfen
                    {
                      \zref@extractdefault {#1} {paragraph} {0} =  \the\c@paragraph
                    }
                    {% a-Ebene ist gleich
                      % Prüfung: aa-Ebene vorhanden?
                      \int_compare:nTF % 
                      { \zref@extractdefault {#1} {subparagraph} {0} =  0}
                      %
                      {%( damit emacs happy ist
                        \int_to_alph:n {\zref@extractdefault {#1} {paragraph} {0} })
                      }
                      {% aa-Ebene vorhanden
                        \int_compare:nTF
                        {\zref@extractdefault {#1} {subparagraph} {0} = \the\c@subparagraph}
                        {\emph{Fehlerhafter VERWEIS}}
                        %( make emacs happy
                        {\int_to_alph:n { \zref@extractdefault {#1} {subparagraph}   {0}   }
                        \int_to_alph:n { \zref@extractdefault {#1} {subparagraph} {0}   })
                        }
                      }
                    }
                    {% a-Ebene ist unterschiedlich (
                      \int_to_alph:n{\zref@extractdefault {#1} {paragraph} {0}})
                    }
                  }
                }
                {% 1.-Ebene ist unterschiedlich 
                  \int_to_arabic:n{\zref@extractdefault {#1} {subsubsection} {0}}.
                }
         }% 3. Klammer Prüfung, ob subsection existiert (also wenn ja)
    }   
     {% I.-Ebene: ungleich
       % Also römische Nummer ausgeben
         \int_to_Roman:n{\zref@extractdefault {#1} {subsection} {0}}.%
          \int_compare:nTF%existiert die nächste Ebene?
           { \zref@extractdefault {#1} {subsubsection} {0} = 0 }
           {}% = 0, subsubsection nicht vorhanden
           {% ungleich 0
            % also arabische Zahl ausgeben
             \int_to_arabic:n { \zref@extractdefault {#1} {subsubsection} {0}}.
               \int_compare:nTF%existiert die nächste Ebene paragraph?
               { \zref@extractdefault {#1} {paragraph} {0} = 0 }
               {}% = 0, subsubsection nicht vorhanden
               {% ungleich 0 (
                 \int_to_alph:n { \zref@extractdefault {#1} {paragraph} {0}})
               }
               % subpar Ebene vorhanden?
               \int_compare:nTF
               { \zref@extractdefault {#1} {subparagraph} {0} = 0}
               {}% ja, also existiert subpar nicht 
               { %(
                 \int_to_alph:n {\zref@extractdefault {#1} {subparagraph} {0}}
                 \int_to_alph:n {\zref@extractdefault {#1} {subparagraph} {0}})
               }
           }
       }% 3. Klammer I.-Ebene
  }% 3. Klammer Prüfung, ob I. Ebene besteht.
  }% 2. Klammer A.-Ebene
  {% A.-Ebene: Ungleich
  %ref is from other section
  \int_to_Alph:n  {\zref@extractdefault {#1} {section} {0}}.
    \int_compare:nTF%existiert die nächste Ebene?
    { \zref@extractdefault {#1} {subsection} {0} = 0 }
    {}% ja, erfüllt, keine subsection
    {% subsection existiert:
      \int_to_Roman:n {\zref@extractdefault {#1} {subsection} {0}}.
      \int_compare:nTF%existiert die nächste Ebene?
          { \zref@extractdefault {#1} {subsubsection} {0} = 0 }
          {}% = 0, subsubsection nicht vorhanden
          {% ungleich 0
            \int_to_arabic:n { \zref@extractdefault {#1} {subsubsection} {0} }.
             \int_compare:nTF%existiert die nächste Ebene paragraph?
              { \zref@extractdefault {#1} {paragraph} {0} = 0 }
              {}% = 0, paragraph nicht vorhanden
              {% ungleich 0 (
                \int_to_alph:n { \zref@extractdefault {#1} {paragraph} {0} })
                \int_compare:nTF
                { \zref@extractdefault {#1} {subparagraph} {0} = 0}
                {}% ja, also existiert subpar nicht
                {% (
                  \int_to_alph:n {\zref@extractdefault {#1} {subparagraph} {0}}
                  \int_to_alph:n {\zref@extractdefault {#1} {subparagraph} {0}})
                }
              }
          }
       }
  }% 3. Klammer A.-Ebene
}% hyperref Klammer zu
}%Ende Befehlsdefinition myref

\ExplSyntaxOff
\makeatother

\usepackage[]{hyperref}

\newcommand\Label[1]{\zlabel{#1}\label{#1}}

\begin{document}

\textbf{Präambel}

\begin{enumerate}
  \item Reference to first section: \myref{sec:first}
  \item Reference to second section: \myref{sec:second}
  \item Reference to snd section / first subsection: \myref{sec:firstofsecond}
  \item Ref. to snd sect. / second subsect: \myref{sec:secondofsecond}
  \item Ref to snd sect. / second subsect / first arabic:
  \myref{CLA:first-second.second}
  \item Ref. to snd sect. / second subsect / first arabic / second par:
  \myref{CLA:second-paragr}
  \item Subparagraph: \myref{CLA:first-sub}
\end{enumerate}


\section{First}
\Label{sec:first}

Sytematically:
\begin{enumerate}
  \item Reference to this section should display a warning: \myref{sec:first}.
  \item Reference to next section: \myref{sec:second}
  \item Reference to next section / first subsection: \myref{sec:firstofsecond}
  \item Ref. to next sect. / second subsect: \myref{sec:secondofsecond}
  \item Ref to next sect. / second subsect / first arabic:
  \myref{CLA:first-second.second}
  \item Ref. to next sect. / second subsect / first arabic / second par:
  \myref{CLA:second-paragr}
  \item Subparagraph: \myref{CLA:first-sub}
\end{enumerate}


\section{Second}
\Label{sec:second}

Sytematically:
\begin{enumerate}
  \item Reference to previous section: \myref{sec:first}.
  \item Reference to this section should display a warning: \myref{sec:second}
  \item Reference to this section / first subsection: \myref{sec:firstofsecond}
  \item Ref. to this sect. / second subsect: \myref{sec:secondofsecond}
  \item Ref to this sect. / second subsect / first arabic:
  \myref{CLA:first-second.second}
  \item Ref. to this sect. / second subsect / first arabic / second par:
  \myref{CLA:second-paragr}
  \item Subparagraph: \myref{CLA:first-sub}
\end{enumerate}


\subsection{Firstofsecond}
\Label{sec:firstofsecond}

Sytematically:
\begin{enumerate}
  \item Reference to previous section: \myref{sec:first}.
  \item Reference to this section: \myref{sec:second}
  \item Reference to this section / first subsection: \myref{sec:firstofsecond}
  \item Ref. to this sect. / second subsect: \myref{sec:secondofsecond}
  \item Ref to this sect. / second subsect / first arabic:
  \myref{CLA:first-second.second}
  \item Ref. to this sect. / second subsect / first arabic / second par:
  \myref{CLA:second-paragr}
  \item Subparagraph: \myref{CLA:first-sub}
\end{enumerate}


\subsection{Secondofsecond}
\Label{sec:secondofsecond}


Now down the tree:

\subsubsection{first of second.second}
\Label{CLA:first-second.second}

Just some letters. 

\paragraph{first-paragraph}
\Label{CLA:first-paragraph}

And more text. Ref to next paragraph, should be a b): \myref{CLA:second-paragr}

\begin{enumerate}
  \item Reference to previous section: \myref{sec:first}.
  \item Reference to this section: \myref{sec:second}
  \item Reference to this section / first subsection: \myref{sec:firstofsecond}
  \item Ref. to this sect. / second subsect: \myref{sec:secondofsecond}
  \item Ref to this sect. / second subsect / first arabic:
  \myref{CLA:first-second.second}
  \item Ref. to this sect. / second subsect / first arabic / second par:
  \myref{CLA:second-paragr}
  \item Subparagraph: \myref{CLA:first-sub}
\end{enumerate}



\paragraph{second paragr}
\Label{CLA:second-paragr}

\begin{enumerate}
  \item Reference to previous section: \myref{sec:first}.
  \item Reference to this section: \myref{sec:second}
  \item Reference to this section / first subsection: \myref{sec:firstofsecond}
  \item Ref. to this sect. / second subsect: \myref{sec:secondofsecond}
  \item Ref to this sect. / second subsect / first arabic:
  \myref{CLA:first-second.second}
  \item Ref. to this sect. / second subsect / first arabic / second par:
  \myref{CLA:second-paragr}
\end{enumerate}

\subparagraph{first sub}
\Label{CLA:first-sub}

\begin{enumerate}
  \item Reference to previous section: \myref{sec:first}.
  \item Reference to this section: \myref{sec:second}
  \item Reference to this section / first subsection: \myref{sec:firstofsecond}
  \item Ref. to this sect. / second subsect: \myref{sec:secondofsecond}
  \item Ref to this sect. / second subsect / first arabic:
  \myref{CLA:first-second.second}
  \item Ref. to this sect. / second subsect / first arabic / second par:
  \myref{CLA:second-paragr}
  \item Subparagraph: \myref{CLA:first-sub}
\end{enumerate}


dsfsdf


\subsubsection{Last one}
\Label{CLA:last-one}

text

\paragraph{paragraph somewhere}
\Label{CLA:paragraph-somewhere}

OK, the par above should display a). And now we refer to the next subpar:
\myref{CLA:second-subpar}.

And now a subpar:

\subparagraph{second subpar}
\Label{CLA:second-subpar}

text

\subparagraph{third subpar}





\end{document}

관련 정보