From: Youssef Cherem via ntg-context <ntg-context@ntg.nl>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: Youssef Cherem <ycherem@gmail.com>,
mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: measure layer/ ruler
Date: Sat, 1 Jan 2022 12:55:50 -0300 [thread overview]
Message-ID: <CAPENqt37hTEA-J4q+Eo+7=M-rbhqwFC6mJA5JtVn-4sOUkiA_Q@mail.gmail.com> (raw)
In-Reply-To: <6a50dac8-fa1c-7a90-eacc-6257849a1cde@xs4all.nl>
[-- Attachment #1.1: Type: text/plain, Size: 2320 bytes --]
Hans,
Thanks a lot. I'm still trying to apply this to the top/bottom; I suppose
it should be simple after I have a firmer grasp of language.
lør. 1. jan. 2022 kl. 10:15 skrev Hans Hagen <j.hagen@xs4all.nl>:
> On 1/1/2022 11:46 AM, Youssef Cherem via ntg-context wrote:
> > Dear list users,
> >
> > How can one go about implementing a ruler around the page/text area
> > (such as a background) like the one provided by the latex package
> > fgruler? https://www.ctan.org/tex-archive/macros/latex/contrib/fgruler
> > <https://www.ctan.org/tex-archive/macros/latex/contrib/fgruler> or koma
> > script's \layercontentsmeasure?
> a good opportunity to learn some metapost
>
> \startuniqueMPpagegraphic{ruler}
> numeric n, f, sign ;
> pair first, last;
> if OnOddPage :
> first := urcorner Page;
> last := lrcorner Page;
> sign := -1;
> else :
> first := ulcorner Page;
> last := llcorner Page;
> sign := 1;
> fi ;
> f := xpart first;
> n := 0;
> draw first -- last withpen pencircle scaled 2pt;
> for i = ypart first step -1mm until ypart last :
> if (n mod 10) == 0 :
> draw (f,i) -- (f+sign*10mm,i) ;
> if OnOddPage :
> draw thetextext.lft(n/10,(f+sign*12mm,i)) ;
> else :
> draw thetextext.rt (n/10,(f+sign*12mm,i)) ;
> fi
> elseif (n mod 5) == 0 :
> draw (f,i) -- (f+sign*5mm,i) ;
> else :
> draw (f,i) -- (f+sign*3mm,i) ;
> fi ;
> n := n + 1 ;
> endfor ;
> setbounds currentpicture to Page ;
> \stopuniqueMPpagegraphic
>
> \defineoverlay[ruler][\uniqueMPpagegraphic{ruler}]
>
> \setupbackgrounds[page][background=ruler]
>
> \setuppagenumbering[alternative=doublesided]
>
> \starttext
> \dorecurse{10}{test \page}
> \stoptext
>
>
> -----------------------------------------------------------------
> Hans Hagen | PRAGMA ADE
> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>
[-- Attachment #1.2: Type: text/html, Size: 3546 bytes --]
[-- Attachment #2: 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
___________________________________________________________________________________
prev parent reply other threads:[~2022-01-01 15:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-01 10:46 Youssef Cherem via ntg-context
2022-01-01 13:15 ` Hans Hagen via ntg-context
2022-01-01 15:55 ` Youssef Cherem via ntg-context [this message]
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='CAPENqt37hTEA-J4q+Eo+7=M-rbhqwFC6mJA5JtVn-4sOUkiA_Q@mail.gmail.com' \
--to=ntg-context@ntg.nl \
--cc=j.hagen@xs4all.nl \
--cc=ycherem@gmail.com \
/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).