考虑 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}
生成(仅部分图片)定制项目
在实际文档中,我预计会有数百个这样的项目,其中包含每个项目的实际描述以及编码描述——每页上有几个项目。因此,需要一个显示项目编号而不是页码的索引。
MWE 制作的指数是
问题:如何修改 MWE 中给出的代码,以便索引显示项目(\citemx
数字)而不是每个索引项的页码?
谢谢。