On 2025-03-14 11:05, Mohammad Hossein Bateni wrote:
I get an undefined command error. Does it work on your machine?

On Fri, Mar 14, 2025 at 10:43 AM Duncan Hothersall <dh@capdm.com> wrote:
Untested but this should work:

\section{This title is long \nomarking{enough to cause problems in the headers and footers}}

Everything inside \nomarking{} will not be shown in the headers or footers.


Duncan

On Fri, 14 Mar 2025 at 14:33, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
Hello,

How can I clip long markings in the header?

See this MNWE, where the two copies of section title collide on page 3.

---------------
\starttext
\setupbodyfont[20pt]
\setupheadertexts[section][section]
\section{One}
\section{Two}
\page
\section{Three}
\page
\section{Long Title for Section Four}
\page
\section{Five}
\stoptext
------------

How can I clip the title to a fixed length (5cm?) and perhaps add "..." at the end for longer titles?

Is it possible to provide an alternative shorter section title within \section?


Use \startsection <https://wiki.contextgarden.net/Command/_startsection> instead of \section. That allows you to specify different values for title, bookmark, heading, references, and more.

\starttext
\setupbodyfont[20pt]
\setupheadertexts[section][section]
\section{One}
\section{Two}
\page
\section{Three}
\page
\startsection[title=Long Title for Section Four,marking=Long Title]
\stopsection
\page
\section{Five}
\stoptext
\starttext

--
Rik