ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Willi Egger <w.egger@boede.nl>
Subject: Moving chapternumber in the margin ...
Date: Tue, 13 Apr 2004 22:07:31 +0200	[thread overview]
Message-ID: <407C4883.6080803@boede.nl> (raw)

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

Hi everybody,

Studying the details manual I thought to have found a way to print the 
chapter number on the margin. Each increase of the chapternumber would 
move the figure a predefined distance downwards.

Now when using a \def{\dimexpr(\realpageno\rightmarginwidth)} my 
chapternumber moves down. Replacing the \realpageno with 
\currentheadnumber the chapternumber is not moving or only after a 
couple of pages ...

Is there someone who could hint me how to approach this? Please refer to 
the attached sample file "bleedingchapternumber.tex"

Thanks and regards

Willi

[-- Attachment #2: bleedingchapternumber.tex --]
[-- Type: text/plain, Size: 1988 bytes --]

% pagenumbers in the margin at half makeupheight
%
% Context file
% filename: bleedingchapternumber.tex
% W. Egger
% 12.04.2004

\setupoutput[pdftex]
\usetypescript[palatino][texnansi]
\setupbodyfont[palatino,rm,12pt]
\setuppapersize[A4][A3,portrait]
\setuplayout[location=middle]
\setupcolors[state=start]

\def\shifted{%
	\dimexpr(\realpageno\rightmarginwidth)}

% \def\shifted{%
% 	\dimexpr(\currentheadnumber\rightmarginwidth)}

\setuppagenumbering[state=start,location={footer,marginedge}]

\startreusableMPgraphic{Pagenumberbackground}
	path p;
	p := fullcircle scaled 50pt ;
	fill p withcolor blue;
	p := unitsquare xyscaled 50pt shifted (0,-25pt);
	fill p withcolor blue;
    setbounds currentpicture to boundingbox currentpicture leftenlarged 50pt ;
%  	draw bbox currentpicture withcolor red ;
\stopreusableMPgraphic

\defineoverlay[Pagenumberbackground]
	[\useMPgraphic{Pagenumberbackground}]

\definelayer
	[Pagenumber]
	[width=\rightmarginwidth,
	height=\makeupheight]

\startsetups Pagenumber
	\setups[Pagenumber:Number]
	\setups[Pagenumber:Finish]
\stopsetups

\startsetups Pagenumber:Number

	\setlayerframed
		[Pagenumber]
		[x=1mm,
		y=\shifted,
		location={right,top}]
		[width=\dimexpr(\cutspace-\rightmargindistance),
		height=\dimexpr(\cutspace-\rightmargindistance),
		foregroundcolor=yellow,
		background=Pagenumberbackground,
		frame=on,
		offset=none]
		{\framed[frame=on,
			width=.8\rightmarginwidth,
			align={left,lohi},
			offset=8pt]
			{\placeheadnumber[chapter]}}%
\stopsetups


\startsetups Pagenumber:Finish
	\framed
	[width=\rightmarginwidth,
	height=\makeupheight,
	background=Pagenumber,
	frame=off]
	{}
\stopsetups

\setuptexttexts[margin] [] [\setups{Pagenumber}]

\starttext
\showframe
\chapter{This is chapter no \headnumber[chapter]}
\chapter{This is chapter no \headnumber[chapter]}
\chapter{This is chapter no \headnumber[chapter]}
\chapter{This is chapter no \headnumber[chapter]}
\chapter{This is chapter no \headnumber[chapter]}

\stoptext

                 reply	other threads:[~2004-04-13 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=407C4883.6080803@boede.nl \
    --to=w.egger@boede.nl \
    --cc=ntg-context@ntg.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).