0

I'm using linguex and need a numbered list with four levels of embedding. I want to be able to have a custom number bullet (label) for the fourth level of embedding as well, and to be able to cross-reference it non-ambiguously in the text. What I have below gives me four levels of embedding, but doesn't allow for non-ambiguous labeling and cross-referencing.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\usepackage{natbib}
\usepackage{linguex}

\begin{document}

  \ex. Level one.\label{l1}
   \a. Level 2.\label{l2}
    \a. Level 3.\label{l3}
     \a. Level 4.\label{l4}
   \z.


\end{document}
2

Here is an attempt to define an extra level for linguex. It seems to work but there may be unintended side effects, so test carefully.

The idea is to define an extra counter which is bound to (i.e., resets with) the lowest level linguex counter SubSubExNo. With a newly defined command the linguex command \a. can be combined with printing (in uppercase alphabetic letters) and increasing this new counter. The spacing is adjusted a bit with \hskip to position the label. Another new command is defined analogous to \b..

The label for cross-referencing is set by redefining \@currentlabel, as described in https://tex.stackexchange.com/a/292890/. Here the cross-reference is composed of the four level counters Exno, SubExNo, SubSubExNo and the new counter SubSubSubExNo.

Code:

\documentclass{article}
\usepackage{linguex}
\newcounter{SubSubSubExNo}[SubSubExNo]
\setcounter{SubSubSubExNo}{0}

\makeatletter
\newcommand{\lfourlabel}{%
  \@bsphack%
  \csname phantomsection\endcsname % in case hyperref is used
  \def\@currentlabel{(\arabic{ExNo}-\alph{SubExNo}-\roman{SubSubExNo}-\Alph{SubSubSubExNo})}%
  \@esphack%
}
\makeatother

\newcommand{\lvlfoura}{%
\a. \hskip -1em\stepcounter{SubSubSubExNo}\Alph{SubSubSubExNo}.\lfourlabel\hskip 1em%
}
\newcommand{\lvlfourb}{%
\b. \hskip -1em\stepcounter{SubSubSubExNo}\Alph{SubSubSubExNo}.\lfourlabel\hskip 1em%
}

\begin{document}

  \ex. Level one.\label{l1}
   \a. Level 2.\label{l2}
    \a. Level 3.\label{l3}
     \lvlfoura Level 4\label{l4}.
     \lvlfourb Also level 4.
     \z.
    \b. Also level 3\label{l32}.
     \lvlfoura Level 4.
     \lvlfourb Also level 4\label{l42}.
   \z.

See example \ref{l3} and \ref{l4} and higher level \ref{l32} and \ref{l42}.

\end{document}

Result:

enter image description here

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.