MWE that demonstrates the problem

%%%CHAPTER SETUP

\startuseMPgraphic{MyChapterGraphic}

  picture toc, num ;

  % You can play with the width, offset, fontsizes and so on.

  toc := 
textext("\unframed[width=8cm,align=normal,offset=3mm,leftframe=on,rulethickness=1pt]

                  {%

                  {\switchtobodyfont[18pt]\labeltext{mychapter}}\blank[small]

                  {\switchtobodyfont[12pt] \MPtext{2}}\blank[big]

                  \placecombinedlist[MyContent]

                  }") ;

  toc := toc shifted (-llcorner toc) ;

  num := textext("\MPtext{1}") ;

  num := num ysized 0.8(ypart ulcorner toc) ;

  num := num shifted (-llcorner num) ;

  % The 0.55 decides how much to shift the number left, we shift 55%

  % The 0.1 here satisfies 2*0.1+0.8=1, where 0.8 is the number above

  num := num shifted (-0.65(xpart lrcorner num), 0.1(ypart ulcorner toc) ) ;

  % The 10cm is just to make sure that we are off so that we do not cut to the 
left of the number

  clip num to ((-10cm,0) -- (0,0) -- ulcorner toc -- (-10cm, ypart ulcorner 
toc) -- cycle) ;

  draw toc ;

  draw num ;

  % This midaligns the content

  currentpicture := currentpicture xshifted 0.4(TextWidth - xpart lrcorner toc 
- xpart llcorner num) ;

  setbounds currentpicture to unitsquare xyscaled (TextWidth, ypart urcorner 
toc) ;

\stopuseMPgraphic

\define[2]\MyChapterCommand{%

  \setnostrut% Try without (and add \showstruts to see)

  \setMPtext{1}{#1}%

  \setMPtext{2}{#2}%

  \useMPgraphic{MyChapterGraphic}

}

\setuplabeltext[mychapter= ]

\setuphead

  [chapter]

  [header=high,

   command=\MyChapterCommand,

   numberstyle=\bf,

   textstyle=\tf]

\starttext
\startchapter[title=Chapter 1]
  ABC\footnote{footnote 1}
\stopchapter
\startchapter[title={Chapter 2\footnote{footnote 2} %But in fact it becomes 
footnote 3. 2 has been skipped in the numbering
  ABC\footnote{footnote 3}% But is 4 instead of 3
\stoptext

On 28/8/25 02:55, Aditya Mahajan wrote:
A more automated solution may be possible via \iftrialtypesetting. I'd suggest 
that you post a minimal example with the metapost graphic on the mailing list.

Aditya

On Wed, 27 Aug 2025, jbf wrote:

This may be ugly, but it works! The complicated Chapter setup that was clearly
causing the problem remains unchanged (not included here. I do not know where
I would need to adjust it). I decided to play with counters instead

Would this be an acceptable solution? A bit hacky I admit. If anyone wants to
see the chapter setup, I am happy to provide it, in case we can resolve the
issue at the source of the problem.

\starttext
\startchapter[title=Chapter 1]
   ABC\footnote{footnote 1}
\stopchapter
\startchapter[title={Chapter 2\footnote{footnote
2}\decrementcounter[footnote]}] %without the \decrementcounter command, this
would skip to 3 instead of 2
\incrementcounter[footnote]
   ABC\footnote{footnote 3}
   Another\footnote{footnote 4}
\stopchapter
\stoptext

Julian
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to