我想从目录中删除“页面”列标题。我找了好久,似乎找不到答案(或类似的问题)。
我还想仅在目录的各节后添加句点“。”。我找到并尝试了以下代码,该代码会在目录中的每个条目后(而不仅仅是各节)生成一个句点。
\let \savenumberline \numberline
\def \numberline#1{\savenumberline{#1.}}
编辑:添加 MWE(希望如此)。我的文档实际上由至少 10 个使用 \input 包含的独立 latex 文件组成,长度仍为 11,500 行。我希望我包含的内容足以有所帮助。有些项目被注释掉了,这样我就不会丢失迄今为止找到的“解决方案”。前言被注释掉了,因为它包含了一个表格列表,而这并不是我想要的。
我还想补充一点,我注意到我的目录不再是超链接。我想知道这是否是因为我选择了“目录”而不是使用前言命令。
\documentclass[draft,wd,letterpaper]{isov2} % needed to change ; to , in order to compile
\let\ifpdf\relax % required to get rid of fatal error
% Latex Error: /usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty:3540 Package ifpdf Error: Name clash, \ifpdf is already defined.
%\usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry}
\usepackage{float}
% see http://tex.stackexchange.com/questions/46512/too-many-unprocessed-floats
\usepackage{morefloats}
% see https://texfaq.org/FAQ-underscore
\usepackage{import} % file path
% see http://http://www.ctan.org/pkg/import
\usepackage{multicol}
% see http://www.ctan.org/pkg/multicol
\usepackage{tabularx}
\usepackage{longtable}
% table of contents hyperlinks
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
%\usepackage{lmodern}"
%\usepackage[T1]{fontenc}"
%\usepackage{textcomp}"
%\usepackage{underscore}"
% This bit controls how ASN1 is formatted
\usepackage{listings}
\lstdefinelanguage{ASN1} {
keywords={CHOICE, SEQUENCE, BEGIN, END, IMPLICIT, EXPLICIT, INTEGER, DEFINITIONS},
sensitive=false,
morecomment=[s]{(--}{--)},
morecomment=[l]{--}
}
\lstnewenvironment{asn1}[1][] {
\lstset{
language=ASN1,
tabsize=2,
xleftmargin=1em
captionpos=b,
frame=single,
% basicstyle=\scriptsize,
basicstyle=\footnotesize\ttfamily,
float,
#1
}
}
{}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% essentially allows one to build a table within a table
% \newcommand{\specialcell}[2][c]{%
% \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
% allow underscores to serve as linebreaks for wrapping
\renewcommand\_{\textunderscore\allowbreak}
% defines the command \camelhyphen. Anything in the argument can break before a capital letter and wrap with a hyphen
\makeatletter
\def\camelhyphen{\leavevmode\begingroup
\let\ifcase\iftrue
\def\or##1{%
\catcode`##1\active\uccode`\~`##1\uppercase{%
\def~{\egroup\-\hbox\bgroup\string##1}}}%
\@Alph{}%
\@camelhyphen}
\def\@camelhyphen#1{{\hbox\bgroup#1\egroup}\endgroup}
\makeatother
\standard{ISO/IEEE 11073-10201}
\yearofedition{2013}
\languageofedition{(E)}
\setcounter{tocdepth}{3} % ToC includes ssclauses and above
% Add a period (.) after the section numbering
\makeatletter
\def\@seccntformat#1{\csname the#1\endcsname.\quad}
\makeatother
\usepackage{etoolbox} \patchcmd{\tableofcontents}{\hfil\pagename}{}{}{}
%\usepackage[dotinlabels]{titletoc}
%\usepackage{tocloft}
%\newcommand{\cftdot}{.}
%\let \savenumberline \numberline
%\def \numberline#1{\savenumberline{#1.}}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\title{Example Document}
\newpage
\tableofcontents
\clause{Hello}\lipsum
\sclause{Little}\lipsum
\clause{Second}\lipsum
\end{document}
澄清:我没有编辑我的实际 .tex 文件来创建 MWE。我没有注释掉实际文件中最初未注释的任何内容。上面的代码创建了一个与我正在处理的文档类似的文档。我现在还意识到我一直将条款称为章节,但它们实际上是条款。
在目录中,我只希望在条款编号后加一个句号(即不是 sclause 或 ssclauses)。
@Gonzalo Medina - 非常感谢!效果非常好!我的目录现在不显示“页面”
感谢大家的有益评论。
答案1
要从目录中删除“页面”一词,请将以下几行添加到序言中:
\usepackage{etoolbox}
\patchcmd{\tableofcontents}{\hfil\pagename}{}{}{}
clause
要在目录中 s的数字后面(但不在sclause
s 之后)或其他章节单元条目中添加句号,\@sect
需要重新定义;在此重新定义中,仅当章节单元级别为 1(即,章节单元为小句)时才添加句号。
完整的代码(我从我的示例中删除了问题代码中与讨论的问题无关的一些包和代码):
\documentclass[draft,wd,letterpaper]{isov2}
\let\ifpdf\relax
\usepackage{etoolbox}
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\standard{ISO/IEEE 11073-10201}
\yearofedition{2013}
\languageofedition{(E)}
\setcounter{tocdepth}{3} % ToC includes ssclauses and above
% Add a period (.) after the section numbering
\makeatletter
\def\@seccntformat#1{\csname the#1\endcsname.\quad}
\makeatother
% suppress ''page'' form the ToC
\patchcmd{\tableofcontents}{\hfil\pagename}{}{}{}
% Add a perior after clause number in ToC
\makeatletter
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\protected@edef\@svsec{\@seccntformat{#1}\relax}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@
\begingroup
#6{%
\@hangfrom{\hskip #3\relax\@svsec}%
\interlinepenalty \@M #8\@@par}%
\endgroup
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\ifnum#2=1\relax
\protect\numberline{\csname the#1\endcsname.}%
\else
\protect\numberline{\csname the#1\endcsname}%
\fi
\fi
#7}%
\else
\@xsect
\def\@svsechd{%
#6{\hskip #3\relax
\@svsec #8}%
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}}%
\fi
\@xsect{#5}}
\makeatother
\begin{document}
\title{Example Document}
\newpage
\tableofcontents
\clause{First test clause}
test
\sclause{Test sclause}
test
\ssclause{Test ssclause}
test
\clause{Second test clause}
test
\end{document}
结果: