I am working on a long document with many chapters, using report class.
I would like to have three different versions of certain section titles (long for document, medium for TOC, and short for header). I am using package fancyhdr
, so I followed instructions in a nice FAQ (also given in this question: How to use short subsection title in header but not in table of contents?).
\section[TOC_title]{Full_title\sectionmark{Header_title}}
\sectionmark{Header_title}
(I believe that the idea is that the inside-title sectionmark
takes care of the page the section starts on, and the outside one deals with the subsequent pages.)
This all worked fine. However, because my doc is double-spaced, I also used titlesec
to shrink down some whitespace around chapter and section titles.
Now I get the TOC_title header on the page the section starts on (wrong), and then the (correct) Header_title header on subsequent pages. Obviously I would like to fix this.
I suspect that fancyhdr
is a bad idea long-term and I should switch to another header package, but I don't want to mess with the current document. I also don't want to let go of titlesec
right now because it really has helped a lot with the doublespaced whitespace, and the issue I am having is minor in comparison.
Is there a way to fix this using titlesec
? I have tried reading the documentation but I am getting very confused. I would be very grateful for someone who already knows this package to make a suggestion.
This question has been asked before in How do I put a short title in the header but a long title in the toc (clashing of titlesec package with sectionmark)?. But the only answer suggests KOMA-script; I suspect that this is some other family of packages that I am not going to learn right now.
Let me also add that my dissertation is due tomorrow, so I will not have time to put together a small working example today. I am interested in solving this issue both today and long-term, so I can come back and do this later if necessary. But in the meantime, I would appreciate any answers today very much!
UPDATE (May 1, 2015): Here's a minimal working example. The Ponysec header on its first page is correct if \usepackage{titlesec} is commented out and not otherwise. The Carouselsec header uses Ulrike Fischer's minihack and works either way.
\documentclass{report}
\usepackage{fancyhdr}
\usepackage{titlesec}
\newcommand{\funnysection}[3]
{\let\orisectionmark\sectionmark
\renewcommand\sectionmark[1]{}%
\section[{#2}]{{#1}\orisectionmark{{#3}}}
\orisectionmark{{#3}}
\let\sectionmark\orisectionmark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%% BEGIN DOCUMENT %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\pagestyle{fancy}
\chapter{Mychapter}
\section{Cactussec (UNIVERSION)}
No header on this page.
\clearpage
\section[Ponysec (TOC)]{Ponysec (main)\sectionmark{Ponysec (header)}}
\sectionmark{Ponysec (header)}
Desired header here is "Ponysec (header)".
\clearpage
Desired header here is "Ponysec (header)".
\clearpage
\funnysection{Carouselsec (main)}{Carouselsec (TOC)}{Carouselsec (header)}
Desired header here is "Carouselsec (header)".
\clearpage
Desired header here is "Carouselsec (header)".
\end{document}
If the right solution (for me, who doesn't really know what KOMA/KONA/script means and yet wants to create decent typeset documents today, this week, this month despite this massive ignorance) is to use titleps
instead of fancyhdr
, I would still love to find out how to do that.