Page LayoutSupress -only the printing- of a (sub)section heading

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
User avatar
twotoneblue
Posts: 15
Joined: Sat Aug 29, 2009 8:20 pm

Supress -only the printing- of a (sub)section heading

Post by twotoneblue »

Dear all,
I the course of writing my thesis in LaTeX, I have come across a difficulty which I cannot untangle myself:

I have 25 pages that should be covered in each their PDF-image(I am using \includegraphics within a landscape environment). There is only room for a header(sectionmark and subsectionmark) and a footer(page number). It is imperative to "maximize" the size of the image within reasonable margins in the scrbook class, and I want each page to appear in the toc and the appendix parttoc.

So, what I would really like to do is to make a new (sub)section command that declares the (sub)section without printing the heading, which doesn't take any space at all and which provides all the structural advantages like the incorporation into the toc and so forth...

Is this possible?

Supressing the printing of (sub)section heading while indeed declaring a new section may not be easy. There is the possibility of using \addcontentsline - which I can get to work on the first few pages but after that the headers(fancyhdr) stop updating themselves in relation to the subsectionmarks set on each page...
Also I can't get the toc to count every page, even trying several remedies for this behaviour described on the forums like combinations with \cleardoublepage or \clearpage, \newpage and \pagebreak... also I need to manually increase the (sub)section counter for each page to get the section numbering correct. It is not a satisfactory situation and I will post an MnWE of this if it is not possible to redefine \(sub)section.

Thank you all for your input
best regards
Aasmund
Last edited by twotoneblue on Tue Jul 06, 2010 5:26 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

twotoneblue
Posts: 15
Joined: Sat Aug 29, 2009 8:20 pm

Supress -only the printing- of a (sub)section heading

Post by twotoneblue »

Well now, I figured out why it all went wrong:
There were two issues, the order of the subsection/sectionmark commands and the use of pdflscape's landscape option which I think is the culprit of the page numbering confusion...

So when I simply used:

Code: Select all

\fancyhf{}
\fancyfoot[LO,RE]{\thepage}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{#1}{}}
\fancyhead[LO]{\textit{\nouppercase{\rightmark \ \leftmark}}}
\fancyhead[RE]{\textit{\nouppercase{\leftmark \ \rightmark}}}
\cleardoublepage
...

%newcommand[]{}{

\subsectionmark{mysubsection} %Before the sectionmark!!!
\sectionmark{mysection}

\stepcounter{section}
\stepcounter{subsection}
\addcontentsline{toc}{section}{\protect\numberline{\thesection}mysection}
\addcontentsline{toc}{subsection}{\protect\numberline{\thesubsection}mysubsection}

\ifthenelse{\isodd{\thepage}}{
\includegraphics[angle=270,...]{file1}
}{
\includegraphics[angle=90,...]{file1}
}

\pagebreak % before the next entry
%}
So, then I wrapped the whole thing in a \newcommand[3]{\mycommand}{"thecodeabove"} and passed the mysection, mysubsection and file name to it with \mycommand{mysection}{mysubsection}{file1} and voila. (the newcommand is commented out in the snippet above)

Now we have the following in a book class (scrbook):
- picture filling up the page(of course bb/viewport sets this size) and the turning of the image depending on odd or even page
- headings consisting of both subsection and section which I use as the only text on the page, and pagenumbers in footings
- page numbers in the toc are correct and the so are the entries for section and subsection

Hope this helps someone
:D
Post Reply