2010-05-06 73 views
26

我想知道如何从内容列表中隐藏某个部分,但不会丢失文档正文中的部分编号。例如,在本TEX文件我失去了数hide,所有的序列被损坏:隐藏乳胶中的Toc条目

\documentclass{article} 

\begin{document} 
\tableofcontents 
\section{uno} 
\section{dos} 
\section*{hide} 
\section{tres} 
\end{document} 
+0

这将是很好也ommit在right..i页码只需要 SectionName .... .............章节编号 SectionName2 ................ SectionNumber2 ...等等。 – mjsr 2010-05-06 23:54:36

回答

43

我认为你正在寻找

\section*{hide} 
\addtocounter{section}{1} 

或使之成为一个命令:

\newcommand{\toclesssection}[1]{\section*{#1}\addtocounter{section}{1}} 

编辑:

好吧,我认为我明白现在想要的是什么(而且,我给出的答案更有意义)。这是一个命令,您可以使用它来禁止向TOC添加节,子部分等。这个想法是暂时禁用\addcontentsline

\newcommand{\nocontentsline}[3]{} 
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup} 
... 
\tocless\section{hide} 
\tocless\subsection{subhide} 
+0

OP表示“不会丢失身体的节号” – Geoff 2010-05-07 13:15:01

+0

问题依然存在,并出现其他不一致。在托克部分特雷斯有3号,身体有4号。 – mjsr 2010-05-07 15:11:26

+0

对不起,我误解了想要的东西。 – 2010-05-07 16:18:24

4

只想说感谢伊万的伟大提示! (我只是使用Google为我定制(次类似的东西)附录{}命令:

\newcommand{\nocontentsline}[3]{} 
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup} 

\newcommand{\Appendix}[1]{ 
    \refstepcounter{section} 
    \section*{Appendix \thesection:\hspace*{1.5ex} #1} 
    \addcontentsline{toc}{section}{Appendix \thesection} 
} 
\newcommand{\SubAppendix}[1]{\tocless\subsection{#1}} 

也许这是对别人有用,太...)