ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Orphans and widows for specific paragraph groups
@ 2016-06-09 20:18 Pavneet Arora
  2016-06-17 12:22 ` Pavneet Arora
  0 siblings, 1 reply; 4+ messages in thread
From: Pavneet Arora @ 2016-06-09 20:18 UTC (permalink / raw)
  To: ConTeXt Mailing list

I have a couple of questions about preventing orphans for specific 
document blocks.

These all relate to a web-based report card application I have written 
for a study abroad school client of mine.  The ConTeXt file is being 
generated and processed out of a PHP Laravel framework app.

I have stripped away most of the details as well as the application 
fonts, but the issue that I am facing is related to keeping the course 
header (done as a paragraph environment), \hairline, and the teacher's 
comment for that course together as a unit.

At a minimum, I would like the three elements as a grouped and pushed to 
the following page.  Ideally, and this is more for my own learning, I'd 
like to be able to have finer control---say the header, \hairline, and a 
set number of comment lines would be acceptable at the bottom of a page.

What would be the best practices for this?

advTHANKSance

>>>> MWE

\definefontfamily[mainface][rm][Latin Modern Roman]
\definefontfamily[mainface][ss][Latin Modern Sans]
\definefontfamily[mainface][tt][Latin Modern Typewriter]
\definefontfamily[mainface][mm][Latin Modern Math]

\setupbodyfont[mainface,9pt]

% Set up default paragraph indenting and spacing.
\setupindenting[yes,
    medium,
    next]
\setupwhitespace[small]

% Set up paragraph environment for subject header.
\defineparagraphs 
    [subjectpar][
        n=2,
        before={\blank[2*big]}]
\setupparagraphs
    [subjectpar]
        [1]
        [width=.3\textwidth]

\starttext
    \blank[8*big, force]
    \dorecurse{10}{
        \blank[2*big]
        \noindentation
        \startsubjectpar
        {\ss\tfc ENG4U}
        \subjectpar
        %% Need to keep the following together as a unit.
        {\ss\tfc English (Grade 12)}
        \stopsubjectpar
        \noindentation
        \vskip-2em\hairline
        \setupindenting[yes,
            medium,
            next]
        \dorecurse{1}{
        \input lorem.tex
        
        }
    }
\stoptext

<<<< MWE

-- 
Pavneet Arora           m: +1 (647) 406-6843
Waroc Informatik        t: +1 (416) 937-9276
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Orphans and widows for specific paragraph groups
  2016-06-09 20:18 Orphans and widows for specific paragraph groups Pavneet Arora
@ 2016-06-17 12:22 ` Pavneet Arora
  2016-06-17 14:03   ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Pavneet Arora @ 2016-06-17 12:22 UTC (permalink / raw)
  To: ConTeXt Mailing list

I tried to use Aditya's suggestion (which was for Natural Tables) to 
keep paragraphs on the same page:

  \noindent{\blank[samepage]}

but I don't seem to have much success with the MWE I posted earlier.

Try as a might, I cannot seem to keep the paragraph head "{\ss\tfc 
English (Grade 12)}" and the hairline together.  I can, however, keep 
the hairline and the following lorem text together, but I need all three 
elements to float as a group:  the paragraph header, hairline, and 
paragraph body.

Would anyone have any suggestions on how to accomplish this?

Many thanks.

On 09Jun16, Pavneet Arora wrote:
...

>>>> MWE

\definefontfamily[mainface][rm][Latin Modern Roman]
\definefontfamily[mainface][ss][Latin Modern Sans]
\definefontfamily[mainface][tt][Latin Modern Typewriter]
\definefontfamily[mainface][mm][Latin Modern Math]

\setupbodyfont[mainface,9pt]

% Set up default paragraph indenting and spacing.
\setupindenting[yes,
    medium,
    next]
\setupwhitespace[small]

% Set up paragraph environment for subject header.
\defineparagraphs 
    [subjectpar][
        n=2,
        before={\blank[2*big]}]
\setupparagraphs
    [subjectpar]
        [1]
        [width=.3\textwidth]

\starttext
    \blank[8*big, force]
    \dorecurse{10}{
        \blank[2*big]
        \noindentation
        \startsubjectpar
        {\ss\tfc ENG4U}
        \subjectpar
        %% Need to keep the following together as a unit.
        {\ss\tfc English (Grade 12)}
        \stopsubjectpar
        \noindentation
        \vskip-2em\hairline
        \setupindenting[yes,
            medium,
            next]
        \dorecurse{1}{
        \input lorem.tex
        
        }
    }
\stoptext

<<<< MWE

-- 
Pavneet Arora           m: +1 (647) 406-6843
Waroc Informatik        t: +1 (416) 937-9276
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Orphans and widows for specific paragraph groups
  2016-06-17 12:22 ` Pavneet Arora
@ 2016-06-17 14:03   ` Wolfgang Schuster
  2016-06-17 20:26     ` Aditya Mahajan
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2016-06-17 14:03 UTC (permalink / raw)
  To: Pavneet Arora, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1299 bytes --]

> Pavneet Arora <mailto:pavneet_arora@waroc.com>
> 17. Juni 2016 um 14:22
> I tried to use Aditya's suggestion (which was for Natural Tables) to
> keep paragraphs on the same page:
>
> \noindent{\blank[samepage]}
>
> but I don't seem to have much success with the MWE I posted earlier.
>
> Try as a might, I cannot seem to keep the paragraph head "{\ss\tfc
> English (Grade 12)}" and the hairline together. I can, however, keep
> the hairline and the following lorem text together, but I need all three
> elements to float as a group: the paragraph header, hairline, and
> paragraph body.
>
> Would anyone have any suggestions on how to accomplish this?
You can put everything in a framedtext to keep it together.

\setupbodyfont[9pt]

\setupindenting[yes,medium,next]
\setupwhitespace[small]

\definetabulate[subjectpar][|f{\ssc}w(.3\textwidth)|f{\ssc}p|]
\setuptabulate 
[subjectpar][after={\blackrule[width=\textwidth,height=\linewidth]\noindentation}]

\defineframedtext
   [subjectblock]
   [frame=off,
    width=max,
    offset=0pt,
    before={\blank[2*big]}]

\starttext

\blank[8*big, force]

\dorecurse{10}
   {\startsubjectblock
      \startsubjectpar
      \NC ENG4U \NC English (Grade 12) \NC\NR
      \stopsubjectpar
      \input{lorem.tex}
    \stopsubjectblock}

\stoptext

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Orphans and widows for specific paragraph groups
  2016-06-17 14:03   ` Wolfgang Schuster
@ 2016-06-17 20:26     ` Aditya Mahajan
  0 siblings, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2016-06-17 20:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Pavneet Arora

On Fri, 17 Jun 2016, Wolfgang Schuster wrote:

>> Pavneet Arora <mailto:pavneet_arora@waroc.com>
>> 17. Juni 2016 um 14:22
>> I tried to use Aditya's suggestion (which was for Natural Tables) to
>> keep paragraphs on the same page:
>> 
>> \noindent{\blank[samepage]}
>> 
>> but I don't seem to have much success with the MWE I posted earlier.
>> 
>> Try as a might, I cannot seem to keep the paragraph head "{\ss\tfc
>> English (Grade 12)}" and the hairline together. I can, however, keep
>> the hairline and the following lorem text together, but I need all three
>> elements to float as a group: the paragraph header, hairline, and
>> paragraph body.
>> 
>> Would anyone have any suggestions on how to accomplish this?
> You can put everything in a framedtext to keep it together.

Or, just put everything in a TABLE (that does not split, by default):

\setupbodyfont[9pt]
\setupindenting[yes,medium,next]
\setupwhitespace[small]

\startsetups subjects
   \setupTABLE[frame=off, align={normal,hyphenated}]
   \setupTABLE[column][1][width=0.3\textwidth]
   \setupTABLE[column][2][width=0.7\textwidth]
   \setupTABLE[row][1][style=\ssc, bottomframe=on, toffset={2\bigskipamount}]
\stopsetups

\starttext

\blank[8*big, force]

\dorecurse{10}
   {\startTABLE[setups=subjects]}]
      \NC ENG4U \NC English (Grade 12) \NC\NR
      \NC[nc=2] \input{lorem.tex}      \NC\NR
    \stopTABLE}

\stoptext

Aditya
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-17 20:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-09 20:18 Orphans and widows for specific paragraph groups Pavneet Arora
2016-06-17 12:22 ` Pavneet Arora
2016-06-17 14:03   ` Wolfgang Schuster
2016-06-17 20:26     ` Aditya Mahajan

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