我确实看过这回答类似的问题。这是关于我的比斯蒙GPLv3+ 自由软件项目github
(犯罪b08143a1478f
如果这很重要的话)其 LaTeX 文档(部分生成)位于其doc/
子目錄。我的电脑运行的是Linux/Debian/Sid,它的LaTeX子系统是texlive-full 2018.20190227
。
为了本报告草案(在 PDF 中,其 §2.3.2 靠近图 4 页 34)用获得pdflatex
,从我的build-bismon-doc.sh
shell 脚本,由make latexdoc
从 LaTeX 源文件(在 下doc/
)获取的 调用我需要有一个索引条目精确的字符串!(
和!)
,最好采用固定宽度的电传打字机字体格式(因此\texttt
在 LaTeX 用语中使用)。这是在文件doc/datapersist-bm.tex
第 640 行左右当前 (git commit
当然还没有 -ed) LaTeX 代码具有:
\begin{quote}
\begin{small}
The lines starting with \texttt{«} or \texttt{!(}
\index{{!(}@\texttt{!(}} \index{«@\texttt{«}}
and with \texttt{»} or \texttt{!)}
\index{{!)}@\texttt{!(}} \index{»@\texttt{»}}
are delimiting the object's persistent
representation. Comments~\footnote{Once the persistence code -
loading and dumping of the state - is mature enough, we will
disable generation of comments in data files.} can start with a
bar \texttt{|} till the following bar, or with two slashes
\texttt{//} till the end of line. {\verb+!~+} with matching
{\verb+(~+} ... \verb+~)+ are for ``modifications'' (here, we
set the \index{name}{\texttt{name}} of that object to
\texttt{first\_test\_module}). Object payloads are also
dumped in such ``modification'' form. \verb+!@+ puts the
\index{mtime}{\emph{mtime}}. \verb+!$+ \textit{classobjid}
sets the \index{class}{class} to the object of objid
\textit{classobjid}. \verb+!:+ \textit{attrobj}
\textit{valattr} put the attribute \textit{attrobj}
associated with the value \textit{valattr}. \verb+!#+
\textit{nbcomp} reserve the spaces for \textit{nbcomp}, and
\verb/!&/~\textit{valcomp} appends the value \textit{valcomp}
as a component.
%% next paragraph was removed for brevity on this LaTeX forum question
\end{small}
\end{quote}
我上面做错了什么?
并且建议\index{"!"(@\texttt{!(}}
不起作用!
答案1
您需要!
在 之前和之后引用 ,这是 MakeIndex 的特殊字符@
。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex
\begin{document}
\begin{quote}\small
The lines starting with \index{«@\texttt{«}}\texttt{«} or \index{"!(@\texttt{"!(}}\texttt{!(}
and with \index{»@\texttt{»}}\texttt{»} or \index{"!)@\texttt{"!(}}\texttt{!)}
are delimiting the object's persistent representation.
Comments~\footnote{Once the persistence code---loading and dumping of the state---is mature
enough, we will disable generation of comments in data files.} can start with a
bar~\texttt{|} till the following bar, or with two slashes~\texttt{//} till the
end of line.
%
\verb+!~+ with matching \verb+(~+ ... \verb+~)+ are for ``modifications'' (here, we
set the \index{name}{\texttt{name}} of that object to \texttt{first\_test\_module}).
Object payloads are also dumped in such ``modification'' form.
%
\verb+!@+ puts the \index{mtime}{\emph{mtime}}.
%
\verb+!$+ \textit{classobjid} sets the \index{class}{class} to the object of
objid \textit{classobjid}.
%
\verb+!:+ \textit{attrobj} \textit{valattr} put the attribute \textit{attrobj}
associated with the value \textit{valattr}.
%
\verb+!#+ \textit{nbcomp} reserve the spaces for \textit{nbcomp}, and
%
\verb/!&/~\textit{valcomp} appends the value \textit{valcomp} as a component.
\end{quote}
\printindex
\end{document}
这是生成的.ind
文件:
\begin{theindex}
\item \texttt{!(}, 1
\item \texttt{!(}, 1
\item \texttt{\IeC {\guillemotleft }}, 1
\item \texttt{\IeC {\guillemotright }}, 1
\indexspace
\item class, 1
\indexspace
\item mtime, 1
\indexspace
\item name, 1
\end{theindex}