ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Setting a heading text on its own page with \setuphead
@ 2021-08-06 17:12 Joey McCollum via ntg-context
  2021-08-06 17:54 ` Pablo Rodriguez via ntg-context
  2021-08-07  9:20 ` Wolfgang Schuster via ntg-context
  0 siblings, 2 replies; 5+ messages in thread
From: Joey McCollum via ntg-context @ 2021-08-06 17:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Joey McCollum


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

Hi,

I'd like to define my own class of heading derived from the "part" heading;
in the MWE below, it's called "MyPart". I'd like this heading to have the
following features:

   - Its title should appear in the ToC, but its number should never be
   printed in the ToC or in the text.
   - It should always start on an odd page.
   - Its text should be in a larger size than the text of the body, set in
   all caps, and set with extra letterspacing.
   - Most importantly, the title of the heading should appear on its own
   page without a header or footer. The text of the body should begin on the
   next odd page.

I was hoping to accomplish all of this within the \setuphead command, and
it seems like this should be possible, but in the following example, I'm
not getting the text of the header at all:

```

\setuppagenumbering [alternative=doublesided, location=] %undo default page
numbering in middle of header; doublesided option will ensure that the
document has an even number of pages


%Define an odd page break between books that omits headers and footers in
blank pages

\definepagebreak[blankpagebreak][yes,header,footer,right]


%Setup body and title fonts (is any of this redundant, or can it be
consolidated?):

\definefontsynonym [EBGaramond] [name:EBGaramond-Regular] [features=default]

\definefontfamily[garamond] [rm] [EBGaramond] [features={default}]

\setupbodyfont[garamond, 12pt]

\setupinterlinespace[18pt] %text line spacing

\definefont[MyPartFont][EBGaramond at 24pt][line=36pt] %font command to be
used for setting MyPart heading texts


%Macro for adjusting kerning of MyPart heading texts (can any of this can
be handled in the \definefont call?):

\define[1]\MyPartTextCommand{%

\kerncharacters[0.6666]%increase letterspacing

\WORDS{#1}%set all letters in uppercase

}


%Macro for page break after MyPart headings:

\define\AfterMyPart{%

\page[blankpagebreak]%

}


%Define a new heading at the level of a part:

\definehead[MyPart][part]

\setuphead[MyPart][

number=no,%do not add a number to this heading

page=blankpagebreak,%always start this on an odd page

header=empty,%disable headers for this page

footer=empty,%disable footers for this page

align={flushleft, nothyphenated},%titling alignment settings

textstyle=\MyPartFont,%set text style

textcommand=\MyPartTextCommand,%set text formatting command

commandafter=\AfterBookTitle%add a double page break afterwards

]


%Setup header and footer text:

\setupheadertexts[{\structureuservariable{booktitle}}\hfill][][][\hfill
{\structureuservariable{booktitle}}] %even left, even right, odd left, odd
right

\setupfootertexts[\pagenumber][][][\pagenumber] %even left, even right, odd
left, odd right


%Ensure that whitespace respects the grid layout:

\setupblank[line,fixed]

\starttext

\startMyPart[title={Title for Title Page}][booktitle={Title for Header}]

\input knuth\par

\input knuth\par

\input knuth\par

\input knuth\par

\input knuth\par

\input knuth

\stopMyPart

\stoptext
```

I expect there's something obvious that I'm missing, but any help is
appreciated.

Thank you!

Joey

[-- Attachment #1.2: Type: text/html, Size: 5785 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
___________________________________________________________________________________

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

* Re: Setting a heading text on its own page with \setuphead
  2021-08-06 17:12 Setting a heading text on its own page with \setuphead Joey McCollum via ntg-context
@ 2021-08-06 17:54 ` Pablo Rodriguez via ntg-context
  2021-08-06 23:41   ` Joey McCollum via ntg-context
  2021-08-07  9:20 ` Wolfgang Schuster via ntg-context
  1 sibling, 1 reply; 5+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2021-08-06 17:54 UTC (permalink / raw)
  To: Joey McCollum via ntg-context; +Cc: Pablo Rodriguez

On 8/6/21 7:12 PM, Joey McCollum via ntg-context wrote:
> Hi,
>
> I'd like to define my own class of heading derived from the "part"
> heading; in the MWE below, it's called "MyPart".

Hi Joey,

these are options for \setuphead[part] (MyPart in your case):

> I'd like this heading to have the following features:
>
>   * Its title should appear in the ToC, but its number should never be
>     printed in the ToC or in the text.

number=no.

>   * It should always start on an odd page.

This is the default for \setuphead[part] (only noticeable in doublesided
documents).

>   * Its text should be in a larger size than the text of the body, set
>     in all caps, and set with extra letterspacing.

style is the right option there.

>   * Most importantly, the title of the heading should appear on its own
>     page without a header or footer. The text of the body should begin
>     on the next odd page.

placehead=yes is required for \setuphead[part]. And also for MyPart.

header=empty and footer=emtpy. For the page break before the body text,
you need after=\page.

> I was hoping to accomplish all of this within the \setuphead command,
> and it seems like this should be possible, but in the following example,
> I'm not getting the text of the header at all.

See above. I hope it helps,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Setting a heading text on its own page with \setuphead
  2021-08-06 17:54 ` Pablo Rodriguez via ntg-context
@ 2021-08-06 23:41   ` Joey McCollum via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Joey McCollum via ntg-context @ 2021-08-06 23:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Joey McCollum, Pablo Rodriguez


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

Thank you so much! The piece I was missing was the "placehead=yes". Now
everything works as expected! I couldn't figure out how to increase letter
spacing for the "style" argument using just a \definefont macro, but I was
able to do it with a macro supplied as the "textcommand" argument.

Joey

On Fri, Aug 6, 2021, 1:54 PM Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> wrote:

> On 8/6/21 7:12 PM, Joey McCollum via ntg-context wrote:
> > Hi,
> >
> > I'd like to define my own class of heading derived from the "part"
> > heading; in the MWE below, it's called "MyPart".
>
> Hi Joey,
>
> these are options for \setuphead[part] (MyPart in your case):
>
> > I'd like this heading to have the following features:
> >
> >   * Its title should appear in the ToC, but its number should never be
> >     printed in the ToC or in the text.
>
> number=no.
>
> >   * It should always start on an odd page.
>
> This is the default for \setuphead[part] (only noticeable in doublesided
> documents).
>
> >   * Its text should be in a larger size than the text of the body, set
> >     in all caps, and set with extra letterspacing.
>
> style is the right option there.
>
> >   * Most importantly, the title of the heading should appear on its own
> >     page without a header or footer. The text of the body should begin
> >     on the next odd page.
>
> placehead=yes is required for \setuphead[part]. And also for MyPart.
>
> header=empty and footer=emtpy. For the page break before the body text,
> you need after=\page.
>
> > I was hoping to accomplish all of this within the \setuphead command,
> > and it seems like this should be possible, but in the following example,
> > I'm not getting the text of the header at all.
>
> See above. I hope it helps,
>
> Pablo
> --
> http://www.ousia.tk
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 3654 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
___________________________________________________________________________________

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

* Re: Setting a heading text on its own page with \setuphead
  2021-08-06 17:12 Setting a heading text on its own page with \setuphead Joey McCollum via ntg-context
  2021-08-06 17:54 ` Pablo Rodriguez via ntg-context
@ 2021-08-07  9:20 ` Wolfgang Schuster via ntg-context
  2021-08-07 19:14   ` Joey McCollum via ntg-context
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2021-08-07  9:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Wolfgang Schuster

Joey McCollum via ntg-context schrieb am 06.08.2021 um 19:12:
> Hi,
> 
> I'd like to define my own class of heading derived from the "part" 
> heading; in the MWE below, it's called "MyPart". I'd like this heading 
> to have the following features:
> 
>   * Its title should appear in the ToC, but its number should never be
>     printed in the ToC or in the text.
>   * It should always start on an odd page.
>   * Its text should be in a larger size than the text of the body, set
>     in all caps, and set with extra letterspacing.
>   * Most importantly, the title of the heading should appear on its own
>     page without a header or footer. The text of the body should begin
>     on the next odd page.
> 
> I was hoping to accomplish all of this within the \setuphead command, 
> and it seems like this should be possible, but in the following example, 
> I'm not getting the text of the header at all:
> 
> [...]
> 
> I expect there's something obvious that I'm missing, but any help is 
> appreciated.

Most of the stuff was already answered by Pablo. Below is my version how 
to set the layout to fit the requirements.

\definefontfamily
   [garamond]
   [rm]
   [EBGaramond]

\setupbodyfont
   [garamond,12pt]

\definefont
   [MyPartFont]
   [Serif at 24pt]
   [line=36pt]

\setuppagenumbering
   [alternative=doublesided,
    location=]

\setupinterlinespace
   [line=18pt]

\definepagebreak
   [blankpagebreak]
   [yes,header,footer,right]

\definehead
   [MyPart]
   [part]

\definecharacterkerning
   [mypartkerning]
   [factor=0.6666,
    features=letterspacing]

\setuphead
   [MyPart]
   [placehead=yes,
    number=no,
    page=blankpagebreak,
    header=empty,
    footer=empty,
    align={flushleft,nothyphenated},
    style=MyPartFont,
 
textstyle={\setcharacterkerning[mypartkerning]\setcharactercasing[WORD]},
    after={\page[blankpagebreak]}]

\setupheadertexts
   [\structureuservariable{booktitle}] []
   [] [\structureuservariable{booktitle}]

\setupfootertexts
   [pagenumber] []
   [] [pagenumber]

\setupblank
   [line,fixed]

\starttext

\startMyPart [title={Title for Title Page}] [booktitle={Title for Header}]
\dorecurse{6}{\input knuth\par}
\stopMyPart

\stoptext

Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Setting a heading text on its own page with \setuphead
  2021-08-07  9:20 ` Wolfgang Schuster via ntg-context
@ 2021-08-07 19:14   ` Joey McCollum via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Joey McCollum via ntg-context @ 2021-08-07 19:14 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: Joey McCollum, mailing list for ConTeXt users


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

Beautiful! This makes things even more succinct. I notice that if I try to
prevent paragraph indentation after a MyPart heading with the
"indentnext=no" argument, it doesn't work. Is this because of the
\page[blankpagebreak] command in the "after" argument? (In any case, I can
just change the "after" argument to
"after=\page[blankpagebreak]\noindentation" and things work as expected, so
this isn't a real problem. I'm just curious.)

Thanks!

Joey

On Sat, Aug 7, 2021 at 5:20 AM Wolfgang Schuster <
wolfgang.schuster.lists@gmail.com> wrote:

> Joey McCollum via ntg-context schrieb am 06.08.2021 um 19:12:
> > Hi,
> >
> > I'd like to define my own class of heading derived from the "part"
> > heading; in the MWE below, it's called "MyPart". I'd like this heading
> > to have the following features:
> >
> >   * Its title should appear in the ToC, but its number should never be
> >     printed in the ToC or in the text.
> >   * It should always start on an odd page.
> >   * Its text should be in a larger size than the text of the body, set
> >     in all caps, and set with extra letterspacing.
> >   * Most importantly, the title of the heading should appear on its own
> >     page without a header or footer. The text of the body should begin
> >     on the next odd page.
> >
> > I was hoping to accomplish all of this within the \setuphead command,
> > and it seems like this should be possible, but in the following example,
> > I'm not getting the text of the header at all:
> >
> > [...]
> >
> > I expect there's something obvious that I'm missing, but any help is
> > appreciated.
>
> Most of the stuff was already answered by Pablo. Below is my version how
> to set the layout to fit the requirements.
>
> \definefontfamily
>    [garamond]
>    [rm]
>    [EBGaramond]
>
> \setupbodyfont
>    [garamond,12pt]
>
> \definefont
>    [MyPartFont]
>    [Serif at 24pt]
>    [line=36pt]
>
> \setuppagenumbering
>    [alternative=doublesided,
>     location=]
>
> \setupinterlinespace
>    [line=18pt]
>
> \definepagebreak
>    [blankpagebreak]
>    [yes,header,footer,right]
>
> \definehead
>    [MyPart]
>    [part]
>
> \definecharacterkerning
>    [mypartkerning]
>    [factor=0.6666,
>     features=letterspacing]
>
> \setuphead
>    [MyPart]
>    [placehead=yes,
>     number=no,
>     page=blankpagebreak,
>     header=empty,
>     footer=empty,
>     align={flushleft,nothyphenated},
>     style=MyPartFont,
>
> textstyle={\setcharacterkerning[mypartkerning]\setcharactercasing[WORD]},
>     after={\page[blankpagebreak]}]
>
> \setupheadertexts
>    [\structureuservariable{booktitle}] []
>    [] [\structureuservariable{booktitle}]
>
> \setupfootertexts
>    [pagenumber] []
>    [] [pagenumber]
>
> \setupblank
>    [line,fixed]
>
> \starttext
>
> \startMyPart [title={Title for Title Page}] [booktitle={Title for Header}]
> \dorecurse{6}{\input knuth\par}
> \stopMyPart
>
> \stoptext
>
> Wolfgang
>

[-- Attachment #1.2: Type: text/html, Size: 3818 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
___________________________________________________________________________________

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

end of thread, other threads:[~2021-08-07 19:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 17:12 Setting a heading text on its own page with \setuphead Joey McCollum via ntg-context
2021-08-06 17:54 ` Pablo Rodriguez via ntg-context
2021-08-06 23:41   ` Joey McCollum via ntg-context
2021-08-07  9:20 ` Wolfgang Schuster via ntg-context
2021-08-07 19:14   ` Joey McCollum via ntg-context

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