考虑 MWE
\documentclass{book}
\usepackage{imakeidx}
\makeindex
\usepackage{idxlayout}
\usepackage{xcolor}
% Make all page numbers in index bold
\let\oldindex\index
\renewcommand{\index}[1]{%
\oldindex{#1|textbf}%
}%
\begin{document}
\LARGE
\newpage A sentence\index{\textbf{Comma Shift}@!Comma shift@\textcolor{red}{``How to move comma inside closing quotes''}}
\idxlayout{columns=1}
\printindex
\end{document}
生成索引:
问题:对于涉及报价的指数(例如显示的指数),我如何移动逗号以使其立即出现在收盘价之前?
谢谢。
答案1
你可以使用csquotes
它。颜色会让事情变得有点尴尬,但可以解决这个问题:
\documentclass{article}
\usepackage{imakeidx}
\makeindex
\usepackage{idxlayout}
\usepackage{xcolor}
\usepackage{csquotes}
\renewcommand{\mktextquote}[6]{#1#2#4#5#3#6}
% Make all page numbers in index bold
\def\fmtpage{\normalcolor\textbf}
\let\oldindex\index
\renewcommand{\index}[1]{%
\oldindex{#1|fmtpage}}
\begin{document}
A sentence\index{\textbf{Comma Shift}@!Comma
shift@\color{red}\textquote{How to move comma inside closing quotes}}
Another sentence\index{\textbf{Comma Shift}@!Comma
shift@\textcolor{red}{\enquote{How to leave comma outside closing quotes}}}
\idxlayout{columns=1}
\printindex
\end{document}