0

I apply the answer which is given here

How to use short subsection title in header but not in table of contents?

but in works only in one side, how to do ?

Vrouvrou
  • 541
  • In a case like this, it's best to use the \mark* mechanism to set up the text for the running head. If the change is to be made on the left, use \markleft{...} (this is not defined by all document classes); if it's on the right, \markright{...}; if both sides are affected, \markboth{<left text>}{<right text>}. – barbara beeton Dec 10 '19 at 22:01
  • @barbarabeeton how to use this ? in any place? pease – Vrouvrou Dec 11 '19 at 11:00
  • You need to set the mark after the (sub)section heading that it replaces, but before the page is output. So the best place is immediately after issuing the (sub)section command. Be careful not to leave any unwanted (horizontal) spaces; remember that a new line in the input file is equivalent to a typed space, so negating the "extra" space can be done by ending the affected line with a %. – barbara beeton Dec 11 '19 at 14:57
  • it works thank you – Vrouvrou Dec 11 '19 at 21:38

1 Answers1

1

Since the suggested link didn't answer your question (good for trying that first!), and different document classes treat this problem in different ways, Here is an approach that should work almost everywhere.

The "generic" approach makes use of the basic "mark" structure provided by (La)TeX. Assume two-sided paging.

If the change is to be made on the left-hand page, use \markleft{...} (this is not defined by all document classes; see \markboth below); if it's on the right, \markright{...}. If both sides are affected, \markboth{<left text>}{<right text>} is your friend.

You need to set the mark after the (sub)section heading that it replaces, but before the page is output. So the best place is immediately after issuing the (sub)section command. Be careful not to leave any unwanted (horizontal) spaces; remember that a new line in the input file is equivalent to a typed space, so negating the "extra" space can be done by ending the affected line with a %. Here's an example:

\subsection{Long, long, long heading used for TOC}
\markboth{Short left heading}{Short right heading}%
Text of the section.

By the way, there's another question that also provides a related solution, along with a link to a blog entry with even more information: How can I display a short chapter name in the header and a long chapter name in the ToC?

addition:
In response to a followup question from @Vrouvrou, "Is there \markcenter?", the answer is no, but maybe not for the "obvious" reason.

"Right" and "left" in this context refer to the right- (recto) and lefthand (verso) pages, not to the position of the text in the header line. There is no corresponding center.