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.

5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.