Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Simple question here: how to make section headings invisible, but still get the correct list of sections in the TOC and headers ? e.g. on page 10, if I do a \section{New section}, I must not see the text "X. New section", but I still want the section to be in the TOC and in the \rightmark of the following pages, until a new section of course.

I'm using a minimalistic document (class article, with no package that are used to adjust section headings style)

share|improve this question
    
Welcome to TeX.SE! Which document class do you use: book, report, ...? Also, do you already use a package (such as titlesec and sectsty) that may be used affect the appearance of sectioning headers. Finally, do you want to suppress the appearance of all sectioning headers (including subsections, subsubsections, etc) or "just" section-level headers? –  Mico Aug 22 '12 at 15:33
    
Just section-level will be fine. –  BigDawg Aug 22 '12 at 15:40
    
Will you use some sort of separator, other than the actual section name, to mark where one section ends and the next one begins? –  Ricardo Aug 22 '12 at 16:19
    
No. The thing is that new sections will necessary be at the beginning of new pages, I just want to remove the "X. Section name", as it will already be written in the header (via fancyhdr) –  BigDawg Aug 22 '12 at 16:45
add comment

1 Answer 1

up vote 15 down vote accepted

Something like this:

\newcommand\invisiblesection[1]{%
  \refstepcounter{section}%
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}%
  \sectionmark{#1}}
...

\invisiblesection{Blah}
share|improve this answer
    
Perfect ! I was missing the \sectionmark in what I tried before coming here. Thanks for the help. –  BigDawg Aug 22 '12 at 17:18
    
Don't you have an issue that several \invisiblesection{} in row are linked to the same (wrong) pages in the TOC or don't appear there at all? –  Anton Dec 11 '13 at 6:55
    
Can you post an MWE? –  Boris Dec 11 '13 at 16:28
    
any chance of getting it to work like \sectio*{} so that the counter number does not appear in the toc –  user43528 Jan 15 at 14:46
    
Just do not \refstepcounter, and do not add \numberline to the TOC –  Boris Jan 15 at 16:53
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.