隐藏乳胶中Toc的条目 [英] hide an entry from Toc in latex

查看:96
本文介绍了隐藏乳胶中Toc的条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何隐藏目录中的部分,但又不会丢失文件正文中的部分编号.例如,在这个 tex 文件中,我松开了hide的数字,所有序列都被破坏了:

I would like to know how I can hide a section from the table of contents but without loosing the section number in the body of the document. For example, in this tex file I loose the number for hide, and all the sequences are damaged:

\documentclass{article}

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

推荐答案

我认为您正在寻找

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

或使其成为命令:

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

好的,我想我知道现在要的是什么(这比我给出的答案更有意义).这是一个命令,您可以用来禁止将节,小节等添加到目录中.这个想法是暂时禁用\addcontentsline.

Okay, I think I understand what is wanted now (and it makes more sense then the answer I gave). Here is a command that you can use to suppress adding a section, subsection, etc. to the TOC. The idea is to temporarily disable \addcontentsline.

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

这篇关于隐藏乳胶中Toc的条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆