Referencing items in list with varioref

Jerry Seibert jerry at seibercom.net
Fri Nov 5 14:54:05 CET 2021


I have been pulling my hair out, trying to figure out what I am doing
wrong. I need to create a document that strictly follows the numbering
style used by the municipality I work for. This is casing a problem when
I try to reference items.

The code I am using is shown below. It works fine up to the forth level,
then it breaks down. I am hoping someone can assist me.

Thanks!

Gerard

***********************************************************************

% !TeX TS-program =
% !TeX encoding = UTF-8
% !TeX spellcheck = en_US
\RequirePackage{fix-cm}%
\RequirePackage{silence} \WarningFilter{fixltx2e}{} %
\documentclass[letterpaper,11pt,final,oneside,titlepage]{report}
\usepackage[verbose=silent]{microtype} %Subliminal refinements towards typographical perfection%
\usepackage[letterpaper, left=0.50in, right=0.50in, top=1.0in, bottom=1.00in]{geometry} %add ``showframe'' to see the margins%
\usepackage{fontspec}
\usepackage{luatextra}
\defaultfontfeatures{Ligatures=TeX}
\usepackage{fontenc} % Allows the user to select font encodings%
\usepackage{ucs}
\usepackage[dvipsnames,svgnames,x11names,table,hyperref,fixpdftex]{xcolor} % Driver independent access to several kinds of colors, tints, etcetera%
\usepackage[en-US]{datetime2}%
\usepackage[full]{textcomp} % Font families with sub-encoding%
\usepackage[inline]{enumitem} % Control layout of itemize, enumerate, description - use enumerate* for inline lists}%
\usepackage[parfill]{parskip} % Adjust paragraph spacing%
\usepackage{calc} % Simple arithmatic in latex commands%
\usepackage{fancyhdr} % Custom page headers and footers%
\usepackage{graphicx} % Enhanced support for graphics % Driver independent color extentions for latex and pdflatex%
\usepackage{lastpage} % If the hyperref package is used, the references are hyperlinked to their aims. If these hyperlinks shall be suppressed, \pageref*{...} instead of \pageref{...}can be used.%
\usepackage{luacolor}
\usepackage{anyfontsize} % Lets the user select any font size i.e. \fontsize {}{}\selectfont%
\usepackage[nospace]{varioref} % This package defines the commands \vref, \vpageref, \vrefrange, and \vpagerefrange for LATEX2".%
\usepackage{tikz}
\usepackage[hidelinks]{hyperref} % Must be loaded last. It extends the functionality of all the LATEX cross-referencing commands (including the table of contents, bibliographies etc) to produce \special commands which a driver can turn into hypertext links%

\AddToHook{shipout/background}{%
\put(0,-\paperheight){\tikz[overlay]\draw[line width=2pt](10pt,10pt) rectangle (\paperwidth-10pt,\paperheight-10pt);}}

%% Needed to allow the use of \pdfcreationdate to work correctly
\ifdef\pdfcreationdate%
{%
\edef\dtm at pdfcreationdate{\pdfcreationdate}%
}%
{%
\ifdef\pdffeedback%
{%
	\edef\dtm at pdfcreationdate{\pdffeedback creationdate}%
}%
{}%
} %

\setlistdepth{9}
\newlist{CD}{enumerate}{9}
\setlist[CD,1]{label*={\textbf{\arabic*.}}}
\setlist[CD,2]{label*={\textbf{\arabic*}}}
\setlist[CD,3]{label*={\textbf{-\arabic*}}}
\setlist[CD,4]{label={\textbf{\Alph*.}}}
\setlist[CD,5]{label={\textbf{\arabic*.}}}
%\setlist{nosep}%

%% enumerate list
\setlist[enumerate,1]{label={(\Alph*)},ref=\Alph*}
\setlist[enumerate,2]{label={(\arabic*)},ref=\theenumi.\arabic*}
\setlist[enumerate,3]{label={(\alph*)},ref=\theenumii.\alph*}
\setlist[enumerate,4]{label={(\roman*)},ref=\theenumiii.\roman*}
%\setlist{nosep}%

\pagestyle{fancy} % set page style to fancy%
\fancyfoot{} % clear the footers%
\fancyhead{} % clear the headers%
\fancyhead[L]{\includegraphics[scale=.30]{C:/Users/gerar/OneDrive/Creedmoor/Images/LetterHeadLogo}}
\renewcommand{\headrulewidth}{0pt} % Eliminate the head rule line%
\renewcommand{\footrulewidth}{2.0pt} % Create a separator line between the document and the footer 2.0pt wide%
\fancyfoot[l]{{\footnotesize \textbf{City of Creedmoor}}}%
\fancyfoot[c]{{\footnotesize \textbf{Creedmoor Community Development}}}%
\fancyfoot[r]{{\footnotesize \textbf{Page \thepage\ of~\pageref*{LastPage}}}}%

%% Setting main front to Lucida Bright
\setmainfont{Lucida Bright} %

\setlength{\headheight}{29.67584pt}

\author{Gerard E. Seibert}%
\title{Certificate of Zoning Compliance}%

\begin{document}

\begin{enumerate}%
\item This is item one.
\begin{enumerate}%
	\item This is item two, one level down, with a label. \label{ThisWorks}
	\item End of list
\end{enumerate}%
\end{enumerate}%

\cleardoublepage

\begin{enumerate}%
	\item \textbf{This works as expected:} See \vref*{ThisWorks}
	\item \textbf{This one works:} \vref*{first}
	\item \textbf{Or this one:} \vref*{second}
	\item \textbf{Or the third one:} \vref*{three}
	\item \textbf{this one gives an incorrect reference:} \vref*{four}
\end{enumerate}%

\cleardoublepage

\begin{CD}[start=7]%
	\item Example \#1 \label{first}
	\begin{CD}[start=15]%
		\item Example \#2 \label{second}
		\begin{CD}%
			\item Example \#3 \label{three}
			\begin{CD}%
				\item Example \#4 \label{four}
			\end{CD}%
		\end{CD}%
	\end{CD}%
\end{CD}%


\end{document}


More information about the texhax mailing list.