我喜欢在目录中显示索引。索引应像一个章节一样显示,它包括章节编号和章节名称。当索引打印在文档末尾时也是如此。索引应像一个章节一样打印,带有章节编号,并在其下方从左到右有一条水平线。
这里我将索引称为“Sache”,以便与标准进行区分。
最好的方法是什么?
谢谢你,并致以最诚挚的问候,Timo
\documentclass[twoside]{article}
% Packages required by doxygen
\usepackage{calc}
\usepackage{doxygen}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage[xindy]{imakeidx}%
\usepackage{multicol}
\usepackage{multirow}
\usepackage{textcomp}
\usepackage[table]{xcolor}
% Font selection
\usepackage[T1]{fontenc}
\usepackage{mathptmx} % similar to Times New Roman
\usepackage[scaled=.90]{helvet} %
\usepackage{courier} %
\usepackage{amssymb}
\usepackage{sectsty}
\renewcommand{\familydefault}{\sfdefault}
%
% generate the index \renewcommand{\indexname}{Sache}
\makeindex
\usepackage{geometry}
\geometry{%
a4paper}
\fancypagestyle{plain}
\usepackage{titletoc}
\usepackage{titlesec}
%
% start every section (in "article" / chapter in "report") with/at a new page
\let\stdsection\section
\renewcommand{\section}{\newpage\stdsection}
%
% define how deep the numbering of the table-of-contents can be
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
%
%================================ C O N T E N T S
\begin{document}
%--- End generated contents by doxygen ---
\section{Sache}
\addcontentsline{toc}{section}{Sache}
% print out the index at the end of the document
\printindex
%
%================================================================================
%
\label{lastpage} % get a label for the last page to be printed in the footer
%
% print for test purpose the total number of page(s)
{last page : } \pageref{lastpage}
%
\end{document}
答案1
由于imakeidx
使用了包,命令intoc
的选项\makeindex
应该可以工作!
对于外观为节而不是未编号,\section*
请使用level=\section
选项\indexsetup
,对于水平规则使用\indexprologue
例如。
一些说明:
\renewcommand{\section}{...}
在这种情况下看起来很奇怪。- 我不得不评论
doxygen
一下\fancypagestyle{plain}
\documentclass[twoside]{article}
% Packages required by doxygen
\usepackage{calc}
%\usepackage{doxygen}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
%\usepackage{makeidx} useless in conjunction with imakeidx
\usepackage[xindy]{imakeidx}%
\usepackage{multicol}
\usepackage{multirow}
\usepackage{textcomp}
\usepackage[table]{xcolor}
\makeatletter
%\def\imki@indexlevel{\section}
\makeatother
% Font selection
\usepackage[T1]{fontenc}
\usepackage{mathptmx} % similar to Times New Roman
\usepackage[scaled=.90]{helvet} %
\usepackage{courier} %
\usepackage{amssymb}
\usepackage{sectsty}
\renewcommand{\familydefault}{\sfdefault}
%
% generate the index \renewcommand{\indexname}{Sache}
\indexsetup{level=\section}
\indexprologue{\hrule}
\makeindex[intoc]
\usepackage{geometry}
\geometry{%
a4paper}
%\fancypagestyle{plain}
\usepackage{titletoc}
\usepackage{titlesec}
\usepackage{xpatch}
%
% start every section (in "article" / chapter in "report") with/at a new page
%\let\stdsection\section
%\renewcommand{\section}{\newpage\stdsection}
\xpretocmd{\section}{\clearpage}{}{}
%
% define how deep the numbering of the table-of-contents can be
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
%
%================================ C O N T E N T S
\begin{document}
\tableofcontents
%--- End generated contents by doxygen ---
\section{Sache}
%\addcontentsline{toc}{section}{Sache}
% print out the index at the end of the document
\printindex
%
%================================================================================
%
\label{lastpage} % get a label for the last page to be printed in the footer
%
% print for test purpose the total number of page(s)
{last page : } \pageref{lastpage}
%
\end{document}