ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Willi Egger via ntg-context <ntg-context@ntg.nl>
To: Mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Willi Egger <context@boede.nl>
Subject: Metafun, difficulty with graphical element in the margin
Date: Fri, 18 Mar 2022 20:29:34 +0100	[thread overview]
Message-ID: <C21D2BAD-A970-4621-B1A7-564979E22190@boede.nl> (raw)

[-- Attachment #1: Type: text/plain, Size: 531 bytes --]

Good evening!

I have a dictionary where I would like to include thumb-pictures in the margin. — When I use the attached code with a single \startchapter...\stopchapter, it works. However if I add another \startchapter…\stopchapter before loading the setups for the thumb-picture metafun throws an error about not having complete information for performing a transformation.

I am currently using the before last version of LMTX-ConTeXT (January 21st 2022).

Could someone try to compile?

Thanks, kind regards

Willi

[-- Attachment #2: test-thumb-picture.tex --]
[-- Type: application/octet-stream, Size: 1950 bytes --]

% ConTeXt file
% filename: test-thumb-pictures
% 18-03-2022


\startsetups[Thumb-pictures]
	\definecolor[chap_frame][black] %[g=1,t=1,a=12]
	\definecolor[textcolor][white] %[r=1,t=1,a=12]

	\startuseMPgraphic{chapter-thumb}
	  path chap_frame ;  
		pair pos,a,b ;  
		picture Chap ;

	  if  \somenamedheadnumber{chapter}{current} > 0 :
			curr_chap := \somenamedheadnumber{chapter}{current} ; 
	  else :
			curr_chap := 1 ;
	  fi;
	  if \somenamedheadnumber{chapter}{last} > 0 :
	   	last_chap := \somenamedheadnumber{chapter}{last} ;
	  else :
	  	last_chap := 1 ;
		  fi;
		  if \somenamedheadnumber{section}{current} > 0 : 
				curr_sect := \somenamedheadnumber{section}{current} ; 
		  else: 
	  		curr_sect := 1 ;
	  fi;
	  if \somenamedheadnumber{section}{last} > 0 :
	  	last_sect := \somenamedheadnumber{section}{last};
	  else:
		last_sect := 1;
	  fi;
		if curr_chap < 11  :
			skip := TextHeight * (curr_chap-1)/11 ;
		elseif curr_chap < 21  :
			skip := TextHeight * (curr_chap-11)/11 ;
		else:
			skip := TextHeight * (curr_chap-21)/11 ;
		fi;
 
	  Chap   := textext("\bfa\textcolor\getmarking[chapter]");

	  StartPage ;
	    chap_frame := lcircle xscaled (2*RightMarginWidth) yscaled (1.5*RightMarginWidth);

	    a := ulcorner chap_frame ;
	    b := urcorner chap_frame ;

	    pos := urcorner Field[Text][RightMarginSeparator] -
	           ulcorner chap_frame - (-1mm,skip);

	    fill chap_frame shifted pos withcolor \MPcolor{chap_frame};
	    draw Chap rotated 90 shifted (xpart pos-4mm,ypart pos) ;
	  StopPage ;
	\stopuseMPgraphic


	\defineoverlay[chapter-thumb][\useMPgraphic{chapter-thumb}]

	\setupbackgrounds[rightpage][background=chapter-thumb]
	\stopsetups



\showframe

\starttext

\startchapter[title=Test A]
	\samplefile{ward}
\stopchapter

\page[yes]
% \startchapter[title=Test B]
% 	\samplefile{ward}
% \stopchapter

\setups{Thumb-pictures}

\startchapter[title=Test C]
	\samplefile{ward}
\stopchapter
% 
\stoptext

[-- Attachment #3: test-thumb-picture.pdf --]
[-- Type: application/pdf, Size: 15533 bytes --]

[-- Attachment #4: Type: text/plain, Size: 493 bytes --]

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2022-03-18 19:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 19:29 Willi Egger via ntg-context [this message]
2022-03-19  5:41 ` śrīrāma via ntg-context
2022-03-19  8:39 ` Hans Hagen via ntg-context
2022-03-19 15:52 ` Otared Kavian via ntg-context
2022-03-19 20:42   ` Willi Egger via ntg-context
2022-03-19 22:39     ` Otared Kavian via ntg-context
2022-03-20 15:46       ` Willi Egger via ntg-context
2022-03-20 10:28     ` Wolfgang Schuster via ntg-context
2022-03-20 15:53       ` Willi Egger via ntg-context
2022-03-20 16:00         ` Wolfgang Schuster via ntg-context
2022-03-20 16:05           ` Willi Egger via ntg-context
2022-03-20 16:21             ` Wolfgang Schuster via ntg-context
2022-03-21  9:04               ` Willi Egger via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C21D2BAD-A970-4621-B1A7-564979E22190@boede.nl \
    --to=ntg-context@ntg.nl \
    --cc=context@boede.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).