ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Otared Kavian <otared@gmail.com>
Subject: Re: Filling a page with \thinrules
Date: Sat, 7 Dec 2019 11:41:35 +0100	[thread overview]
Message-ID: <e3865362-12a4-4624-eecb-c73e695c2260@xs4all.nl> (raw)
In-Reply-To: <BFE7A93B-4594-4E69-A97F-61F6E9450390@gmail.com>

On 12/7/2019 10:10 AM, Otared Kavian wrote:
> Hi Rik,
> 
> Thanks a lot for the link to that message dating back to 2010…
> 
> I tried to put that solution on the wiki but I could not create a new page. I'll try later.

Think TeX (and a little ConTeXt):

\starttexdefinition thinrulesfillpage
     \par
     \verticalstrut
     \vskip-.5\lineheight
     \leaders
         \hbox to 
\hsize{\blackrule[width=\hsize,height=1pt,depth=1pt,color=red]\strut}
         \vfilll
     \verticalstrut
     \vskip-1.5\lineheight
     \page
\stoptexdefinition

\showframe

\starttext

     \dorecurse{2}{\input knuth.tex\par} \thinrulesfillpage

     \thinrulesfillpage

     \input ward.tex \thinrulesfillpage

\stoptext

Now Wolfgang can change the \leaders in the proper ConTeXt interface 
calls. Okay, we could as well make it into some feature or course, as 
occasionally we need to add something new anyway, just to show progress.


> For the record, below is a transcript of what I adapted from Wolfgang's solution, but maybe nowadays one could also right a more readable lua code to achieve the same.
> 
> Best regards: Otared K.
> 
> \define\thinrulesfillpage%
> 	{
> 	\hphantom{Answer} % this is necessary, I don't know why...
> 	\blank	
> 	\scratchcounter\dimexpr(\pagegoal-\pagetotal-2\lineheight)/(\dimexpr\lineheight+2.2ex\relax)\relax
> 	\thinrules[n=\number\scratchcounter,inbetween={\blank[2.2ex]}]
> 	\page
> 	}
> 	
> \showframe
> \starttext
> \dorecurse{2}{\input knuth.tex\par}
> 
> \thinrulesfillpage
> 
> \thinrulesfillpage
> 
> \input ward.tex
> \thinrulesfillpage
> 
> \stoptext
> 
>> On 7 Dec 2019, at 03:49, Rik Kabel <context@rik.users.panix.com> wrote:
>>
>> On 12/6/2019 17:50, Otared Kavian wrote:
>>> Hi all,
>>>
>>> I am preparing a test for my students where I would like to have the statement of the problem on the top of a page and the remainder to the bottom of that page filled with \thinrules, for them to write the solution. And sometimes there might be an empty page filled with thinrules when the solution to the exercise is longer.
>>>
>>> The following minimal example gives the idea of what I want to achieve, but since the statement of each exercise may be longer or shorter, I would like ConTeXt to compute how many \thinrules can be put in the remainder of the page.
>>> That is, can one imagine a macro named (say) \fillpagewiththinrules which puts the exact number of thinrules before ejecting the page?
>>> Is this possible or have I to do it by hand for each page?
>>>
>>> \showframe
>>> \starttext
>>> \dorecurse{2}{\input knuth.tex\par}
>>>
>>> \thinrules[n=20] % On the first page I can put 20 thinrules
>>>
>>> \page
>>>
>>> \thinrules[n=40] % On an empty page I can put 40 thinrules
>>> \page
>>>
>>> \input ward.tex
>>>
>>> \thinrules[n=37] % On the third page there can be 37 thinrules
>>>
>>> \stoptext
>>>
>>> Thanks for any hint and help,
>>> Best regards: Otared K.
>>> ___________________________________________________________________________________
>>> 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
>>>
>>> ___________________________________________________________________________________
>>>
>> It looks like Wolfgang answered this a while back. See Re: [NTG-context] Room for comment on the backside of form. .
>>
>> -- 
>> Rik
>>
>> ___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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:[~2019-12-07 10:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 22:50 Otared Kavian
2019-12-07  2:49 ` Rik Kabel
2019-12-07  9:10   ` Otared Kavian
2019-12-07 10:41     ` Hans Hagen [this message]
2019-12-07 15:33     ` Rik Kabel
2019-12-07 15:50       ` Otared Kavian

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=e3865362-12a4-4624-eecb-c73e695c2260@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ntg-context@ntg.nl \
    --cc=otared@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).