ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Moving chapternumber in the margin ...
@ 2004-04-13 20:07 Willi Egger
  0 siblings, 0 replies; only message in thread
From: Willi Egger @ 2004-04-13 20:07 UTC (permalink / 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-04-13 20:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-13 20:07 Moving chapternumber in the margin Willi Egger

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).