ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Preventing double title pages for nested content
Date: Wed, 20 May 2015 23:19:52 +0200	[thread overview]
Message-ID: <54674385-59C5-4601-8BA1-E1531059EBDF@gmail.com> (raw)
In-Reply-To: <CAA36g0VWGuvUcqb2YcH3PZXQPGYHeXgLm_YKO4Ke3rm1cwQSOA@mail.gmail.com>


> Am 20.05.2015 um 01:26 schrieb Kate F <kate@elide.org>:
> 
> On 19 May 2015 at 23:51, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
>> 
>>> Am 20.05.2015 um 00:34 schrieb Kate F <kate@elide.org>:
>>> 
>>> Hello!
>>> 
>>> I'm collating some UNIX-like manpages into a PDF.
>>> I'm structuring the content like so:
>>> 
>>> \setupcolors[state=start]
>>> 
>>> \definehead[Volume] [part] % red colour: man(1) section
>>> \definehead[Library][part] % blue colour: library within section 3
>>> \definehead[Manpage][chapter]
>>> 
>>> \setuphead[Volume,Library,Manpage][page=yes,number=no,placehead=yes]
>>> \setuphead[Volume][color=red]
>>> \setuphead[Library][color=blue]
>>> 
>>> \starttext
>>>   \placecontent[list={Volume,Library,Manpage}]
>>> 
>>>   \startVolume[title=Section 1: Programs]
>>>       \dorecurse{3}{\startManpage[title=progxyz(1)] \input lorem \stopManpage}
>>>   \stopVolume
>>> 
>>>   \startVolume[title=Section 2: Syscalls]
>>>       \dorecurse{3}{\startManpage[title=syscallxyz(1)] \input lorem
>>> \stopManpage}
>>>   \stopVolume
>>> 
>>>   \startVolume[title=Section 3: Libraries]
>>>       \startLibrary[title=libjpeg]
>>>           \dorecurse{3}{\startManpage[title=jpegapi_a(3)] \input
>>> lorem \stopManpage}
>>>       \stopLibrary
>>>       \startLibrary[title=libpng]
>>>           \dorecurse{3}{\startManpage[title=pngapi_a(3)] \input
>>> lorem \stopManpage}
>>>       \stopLibrary
>>>       \startLibrary[title=libbmp]
>>>           \dorecurse{3}{\startManpage[title=bmpapi_a(3)] \input
>>> lorem \stopManpage}
>>>       \stopLibrary
>>>   \stopVolume
>>> 
>>>   \startVolume[title=Section 4: Drivers]
>>>       \dorecurse{3}{\startManpage[title=drvxyz(1)] \input lorem \stopManpage}
>>>   \stopVolume
>>> 
>>>   \startVolume[title=Section 7mk: Makefiles]
>>>       \dorecurse{3}{\startManpage[title=xyz.mk(1)] \input lorem \stopManpage}
>>>   \stopVolume
>>> \stoptext
>>> 
>>> There I have grouped Volume 3 manpages into libraries. This grouping only
>>> applies to Volume 3.
>>> 
>>> I'd like a single "title" page for each Volume (which I show in red),
>>> except for section 3, where I'd like a title page for each Library
>>> (which I show in blue). So the pagination should look like:
>>> 
>>> toc S1 ... S2 ... libjpeg ...  libpng ... libbmp ... S4 ...
>>> 
>>> Where S* there is a red title page, S3 is absent, and lib* are blue title pages.
>>> I'm trying to work out how best to do this.
>>> 
>>> Would you recommend I hide Volume 3's title page?
>>> I think that must be the simplest way, but I don't know how to do it
>>> using a setup.
>>> 
>>> My data is coming from XML, and I'd like to avoid having a special
>>> \startVolume for Volume 3, if I can. Although perhaps that could help.
>>> 
>>> Are there any other ways which might be more sensible?
>>> 
>>> I wondered about using \setuphead[something][continue=yes] to fold the
>>> first blue title pages onto the red title pages, but even if I can do that,
>>> I think it would make things more difficult for getting the text right on
>>> those pages.
>> 
>> Change your manpage headings to \chapter and test at the begin of each
>> new volume for the number of chapters (you can use the list mechanism
>> for this) in each volume.
>> 
>> %\setuphead[part][placehead=yes,after=\directsetup{chapterentries}]
>> \setuphead[part][placehead=empty,after=\directsetup{chapterentries}]
>> 
>> \startsetups[chapterentries]
>>  \determinelistcharacteristics[chapter]
>>  \ifcase\structurelistsize
>>    No chapter in this part.
>>  \or
>>    One chapter in this part.
>>  \else
>>    Two or more chapters in this part.
>>  \fi
>> \stopsetups
>> 
>> \starttext
>> 
>> \dorecurse{4}
>>  {\startpart[title=Part #1]
>>   \dorecurse{\ifcase#1\or 0\or 3\else 1\fi}
>>     {\startchapter[title=Chapter ##1]
>>          \stopchapter}
>>   \stoppart}
>> 
>> \stoptext
>> 
>> Wolfgang
> 
> Very interesting!
> 
> I don't want to use \chapter because I'm dealing with several types of
> document, and so I'm trying to keep different things separate, so that
> I don't confuse myself with all the setups. But I just converted your
> example to use \definehead[Manpage] instead, and that seems to have
> the same effect for \determinelistcharacteristics[Manpage].
> 
> Maybe I'm being unimaginative, but I don't see how you're suggesting I
> use this technique to achieve the effect I'm after. Did you mean to
> count Libraries rather than Manpages? Even then I'm not sure how to
> apply the idea. (Especially as your example doesn't have the same
> structure as mine.)
> 
> Sorry if my original description was unclear.


It doesn’t matter which name you use for the sections.

\definehead [Library] [part]
\definehead [Manpage] [chapter]

\setuphead
  [Library]
  [placehead=empty,
   before={\startmakeup[standard][align=middle,style=\ssd]},
   after={\directsetup{chapterentries}\stopmakeup}]

\startsetups[chapterentries]
	\determinelistcharacteristics[Manpage]
	\ifcase\structurelistsize
		No manpages for this libary.
	\or
		One manpage for this Library
	\else
		Two or more manpages for this library.
	\fi	
\stopsetups

\starttext

\startLibrary[title=First Library]
	\startManpage[title=Manpage 1]
	\stopManpage
\stopLibrary

\startLibrary[title=First Library]
\stopLibrary

\startLibrary[title=First Library]
	\startManpage[title=Manpage 1]
	\stopManpage
	\startManpage[title=Manpage 2]
	\stopManpage
	\startManpage[title=Manpage 3]
	\stopManpage
\stopLibrary

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

  reply	other threads:[~2015-05-20 21:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 22:34 Kate F
2015-05-19 22:51 ` Wolfgang Schuster
2015-05-19 23:26   ` Kate F
2015-05-20 21:19     ` Wolfgang Schuster [this message]
2015-05-20 22:36       ` Kate F
2015-05-21  8:06         ` Wolfgang Schuster
2015-05-21 12:33           ` Kate F
2015-05-21 21:09             ` Wolfgang Schuster
2015-05-21 21:44               ` Kate F
2015-05-21 22:06                 ` Wolfgang Schuster
2015-05-21 22:33                   ` Kate F

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=54674385-59C5-4601-8BA1-E1531059EBDF@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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).