Very nice! Thanks Rik!

On Fri, Mar 14, 2025 at 1:46 PM Rik Kabel <ConTeXt@rik.users.panix.com> wrote:


On 2025-03-14 11:58, Mohammad Hossein Bateni wrote:
The \start/\stop section alternative works nicely. Thanks!

I was trying to work on an automated solution consisting of three parts:
1) Define a new marking which processed normal section title marking
2) Check width to see if we need to apply clipping and add "..."
3) Performing clipping

Here are my unsuccessful attempts for 3:

% clips width correctly but descenders are also removed
\clip[width=3cm]{Long Title for Section Four}
% does not work with \dimexpr (expansion issue?)
\setbox0\hbox{Long Title for Section Four}
\clip[width=3cm,height=\the\dimexpr\ht0+\dp0\relax]{\box0}
% but this one works
\setbox0\hbox{Long Title for Section Four}
\clip[width=3cm,height=18pt}{\box0}


https://wiki.contextgarden.net/Command/limitatetext

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________