2

Consider the MWE

\documentclass{article}

\hoffset 10pt \voffset -45pt \oddsidemargin 12pt \evensidemargin 10pt \topmargin 35pt \headheight 25pt \textheight 8.35in \textwidth 6.25in \headsep 25pt \marginparwidth 35pt

\usepackage{color} \definecolor{RoyalRed}{RGB}{157,16, 45}

\usepackage{imakeidx} \makeindex \usepackage{idxlayout}

\usepackage{lipsum} \usepackage{multicol} \setlength{\columnsep}{1cm} \usepackage{scalefnt} \usepackage{amssymb} %\usepackage{pgfpages} %\pgfpagesuselayout{2 on 1}

% % The colored box that encloses the item number. \usepackage{tcolorbox}

\newtcbox{\logo}{nobeforeafter, notitle, %sharpcorners, colframe=red!75!black, colback=red!75!black, top=.75pt, left=1pt, right=1pt, bottom=.5pt, fontupper=\sffamily\bfseries, tcbox raise base}

\parindent 0pt

% % FANCY ENUMERATE positioning the enumerated colored box above the text. \newcounter{cenum} \newcommand\cenumsep{}
\newenvironment{cenumerate}{% \setcounter{cenum}{0}% \setlength\parskip\bigskipamount % \begin{center}% }{% % \end{center}% }

\newcommand\citemx[1]{% added <<<<<<<<<<<<<< \refstepcounter{cenum}% \par\cenumsep\logo{\textcolor{white}{\arabic{cenum}}}% %\par\cenumsep\logo{\arabic{cenum}}% \begin{minipage}{\linewidth} % added <<<<<<<<<<<<<<<< \hspace{12pt}#1 % left/right space \vspace{0.5ex}% vertical adjustment \end{minipage} \par\nobreak\vskip-\parskip\medskip\noindent\ignorespaces% \medskip is the distance between label and text, change as needed }

% NEW SYMBOL DEFINITIONS

\newcommand{\R}{\textcolor{red}{{\scalefont{1.25}{$\bullet\hspace{.15em}$}}}} \newcommand{\B}{\textcolor{blue}{{\scalefont{1.25}{$\bullet\hspace{.15em}$}}}}

%\usepackage{showframe} \begin{document} %\large

\begin{multicols}{2}

%\setlength\itemsep{1em plus 1fil} %\interlinepenalty=10000 \begin{cenumerate} \citemx{\R\R\B\B \hspace{.08em} \B\R\R\B \hspace{.08em} \R\R\R\R} \lipsum[4] \index{Entry item i}

        \citemx{\B\B\B\B \hspace*{.08em} \R\R\R\B \hspace*{.08em} \R\B\R\R} \lipsum[1] \index{Entry item ii}

        \citemx{\B\B\B\B \hspace*{.08em} \R\R\R\B \hspace*{.08em} \R\B\R\R} \lipsum[2] \index{Entry item iii}

        \citemx{\B\B\B\B \hspace*{.08em} \R\R\R\B \hspace*{.08em} \R\B\R\R} \lipsum[5] \index{Entry item iv}

        \citemx{\B\B\B\B \hspace*{.08em} \R\R\R\B \hspace*{.08em} \R\B\R\R} \lipsum[5] \index{Entry item v}

        \citemx{\B\B\B\B \hspace*{.08em} \R\R\R\B \hspace*{.08em} \R\B\R\R} \lipsum[1] \index{Entry item vi}

        \citemx{\B\B\B\B \hspace*{.08em} \R\R\R\B \hspace*{.08em} \R\B\R\R} \lipsum[5] \index{Entry item vii}

        \citemx{\B\B\B\B \hspace*{.08em} \R\R\R\B \hspace*{.08em} \R\B\R\R} \lipsum[5] \index{Entry item viii}
    \end{cenumerate}
\end{multicols}

\idxlayout{columns=1} \printindex

\vspace{1cm}\centering\large Instead of page numbers, I would like item (i.e., citemx) numbers.
\end{document}

which produces (only some pictured) the customized itemization

enter image description here

In the actual document, I anticipate there will be hundreds of such items containing actual, as well as coded descriptions of each item---with several items on each page. Thus, an index that displays the item number rather than the page number is desired.

The index produced by the MWE is

enter image description here

QUESTION: How may the code given in the MWE be modified in order for the Index to display items (\citemx numbers) instead of page numbers for each index item?

Thank you.

DDS
  • 8,816
  • 4
  • 9
  • 36
  • https://tex.stackexchange.com/questions/187038/how-to-mention-section-number-in-index-created-by-imakeidx seems related (uses xindy as index processor) – Marijn Sep 25 '21 at 18:25
  • also https://tex.stackexchange.com/questions/180141/how-to-make-index-entries-refer-to-section-numbers-and-or-figure-table-numbers – Marijn Sep 25 '21 at 18:26
  • This one too: https://tex.stackexchange.com/questions/137223/custom-numbers-for-index (glossaries with counter=xxx) – Marijn Sep 25 '21 at 18:27
  • with regular makeindex: https://tex.stackexchange.com/questions/298519/using-imakeidx-with-custom-page-numbering and https://tex.stackexchange.com/questions/352759/index-by-section-subsection/352765 – Marijn Sep 25 '21 at 18:30
  • @Marijn Thank you for these posts; I recall (I think) having looked at some of them before posting the question. One difference between my question and some of your links, for example, is the redefining of the enumerate environment to accommodate both the fancy item display, as well as the adjoining binary code. I have tried various adaptations, but so far, nothing has worked. I am hoping that an expert might post a working answer. – DDS Sep 25 '21 at 19:36

0 Answers0