2010-05-06 70 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}} 

也許這是對別人有用,太...)