% content=tex
%
% copyright=pragma-ade readme=readme.pdf licence=cc-by-nc-sa

\usemodule[mag-01] % \setuplayout[grid=yes] \showgrid 

\setvariables
  [magazine]
  [title={Hiding parts of section titles},
   author=Hans Hagen,
   affiliation=PRAGMA ADE, 
   date=Februari 2003,
   number=1]

\startbuffer[abstract] 
  Early versions of \CONTEXT\ already provided means for
  limiting the length of header and footers as well as list
  entries. Due to user requests, in the beginning of 2003 we
  made the placeholder symbol (sequence) configurable. Here
  we describe this feature. We also take the opportunity to
  remind you of a few more limiting features. 
\stopbuffer

\starttext \setups [titlepage] \setups [title] 

\startbuffer[s]
\section {A title with a \nomarking {shortened} mark} 
\stopbuffer

\getbuffer[s]  

You can set up running headers and footers (and of course
its top, bottom and text relatives) with: 

\startbuffer[t]
\setupheadertexts[section] 
\stopbuffer

\typebuffer[t] \getbuffer[t]  

Sometimes, a section title can be pretty long, and in such
situations you may want to exercise control over the way the
title ends up in the header. The previous title was defined
with: 

\typebuffer[s] 

\startbuffer[s]
\section {A title with a \nolist {shortened} list entry}
\stopbuffer

\getbuffer[s]  

Something similar can be done with the table of contents
(lists): 

\typebuffer[s] 

\startbuffer[l]
\placelist[section][criterium=all,maxwidth=.7\textwidth]
\stopbuffer

\typebuffer[l] \getbuffer[l]

You can set up the placeholder symbols in several ways.
Because such a placeholder can differ per language |<|as
with quotations and subsentences|>| document wide settings
take place with: 

\starttyping
\setuplanguage[en][limittext=\unknown]
\stoptyping

But, in case you want more control, you can use: 

\starttyping
\setuplist   [section][limittext={($\cdots$)}]
\setupmarking[section][limittext={/$\cdots$/}]
\stoptyping

By default \type {limittext} is set to \type {yes}, which
means that it will honor the language settings. When set to
\type {no}, the original text will show up. 

When users on the \CONTEXT\ list asked for more control, I
was surprised that \type {\nolist} and \type {\nomarking}
were used by more than a few. This is because a more clever
mechanism is available. 

\startbuffer[s]
\section {How to limit the width of a header text and|/|or 
entry in a list, a rather user friendly mechanism} 
\stopbuffer

\typebuffer[s] \getbuffer[s] 

This title is way to long to fit comfortably in the header,
so we have to deal with it: 

\startbuffer[h]
\setupheader[text][width=.5\textwidth]
\stopbuffer

\typebuffer[h] \getbuffer[h] 

You can also set up the left and right part of a header or
footer: 

\starttyping
\setupheader
  [text]
  [leftwidth=.35\textwidth,
   rightwidth=.55\textwidth]
\stoptyping

The limiter is also available as a low level command: 

\startbuffer 
\limitatetext {I prefer centimeters over inches}  {3cm} {!} 
\limitatetext {I prefer centimeters over inches} {-1in} {!} 
\stopbuffer 

\typebuffer 

\startlines 
\getbuffer
\stoplines 

If you peek into \type {supp-box.tex}, you will find out
that you can not only feed a negative width, and not only
that, how about: 

\startbuffer
\limitatetext {two plus two equals four} {1cm,1cm} {!} 
\stopbuffer

\typebuffer \getbuffer

The header text limiter uses this macro, so there you can
also feed negative values and pairs. 

\setups [listing] \setups [lastpage] \stoptext
