ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: <Robin.Kirkham@csiro.au>
To: <ntg-context@ntg.nl>
Subject: Re: overlay or layer for chapter head.
Date: Thu, 2 Apr 2015 11:15:30 +0000	[thread overview]
Message-ID: <5367A272-0E1B-4057-8414-A1AC4F9AD930@csiro.au> (raw)

> From: John Culleton <John@wexfordpress.com>
> Subject: [NTG-context] overlay or layer for chapter head.
> Date: 2 April 2015 1:19:03 AEDT
> 
> I am redoing a book for a client. Each chapter
> head has a fancy design. I want to reproduce that
> fancy page but still have the "\chapter"
> statement for running heads, TOC etc. 
> 
> Is there a way that I can overlay the entire
> chapter first page with a graphic, ideally a one
> page pdf file. 
> 
> I have tried workarounds with
> \startstandardmakeup,\writetolist,
> \definemarking etc. but the whole thing is
> getting too complicated. I just want to overlay a
> the entire page with a graphic yet have
> the real content of the page still available for
> TOC, running head, indexing terms etc.
> 
> Any suggestions?
> 
> -- 
> John Culleton
> Wexford Press

Hi John,

I did this recently by defining a layer and putting an image in it using \setlayer, in a macro called just before chapters are started:

\definelayer[chapterbackground]
\setupexternalfigures[location=default]

\unexpanded\def\chapterbefore{
    \setlayer[chapterbackground]{%
        \externalfigure[mill.png]
            [width=\paperwidth,height=\paperheight]
    }
    \setupbackgrounds[page]
        [background=chapterbackground]
}

\setuphead[chapter][before=\chapterbefore]

\starttext
\chapter{Knuth}
\dorecurse{5}{
    \input knuth
    \par
}

\chapter{Dawkins}
\input dawkins
\stoptext

No doubt there is a neater/better way to do it than that. In fact I tried to set up the background only once, like this:

\definelayer[chapterbackground]
\setupexternalfigures[location=default]
\setlayer[chapterbackground]{%
    \externalfigure[mill.png]
        [width=\paperwidth,height=\paperheight]
}

\setuphead[chapter]
    [before={
        \setupbackgrounds[page]
            [background=chapterbackground]
    }]

\starttext
\chapter{Knuth}
\dorecurse{5}{
    \input knuth
    \par
}

\chapter{Dawkins}
\input dawkins
\stoptext

But it looks like the layer “forgets” the image each time it is used, and the second chapter does not have the image. I’d be pleased to know the “right way” to do this too ...

Robin



___________________________________________________________________________________
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-04-02 11:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 11:15 Robin.Kirkham [this message]
2015-04-02 12:46 ` Otared Kavian
2015-04-02 13:10   ` Procházka Lukáš Ing. - Pontex s. r. o.
2015-04-02 15:12     ` John Culleton
2015-04-02 17:07       ` Wolfgang Schuster
  -- strict thread matches above, loose matches on Subject: below --
2015-04-01 14:19 John Culleton
2015-04-01 19:37 ` Idris Samawi Hamid ادريس   سماوي حامد
2015-04-01 20:39 ` Alan BRASLAU

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=5367A272-0E1B-4057-8414-A1AC4F9AD930@csiro.au \
    --to=robin.kirkham@csiro.au \
    --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).