Difference between revisions of "Simple Cover Page"

From ConTeXt wiki
Jump to navigationJump to search
 
m
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
< [[Sample documents]] | [[MetaPost]] >
 +
 
<texcode>
 
<texcode>
 
\setupcolors[state=start]
 
\setupcolors[state=start]
Line 59: Line 61:
  
 
[http://archive.contextgarden.net/message/20050223.145512.19d6450f.html Reference to mailing list]
 
[http://archive.contextgarden.net/message/20050223.145512.19d6450f.html Reference to mailing list]
 +
 +
== Another title page ==
 +
 +
<texcode>
 +
\definetype[ytyp][color=yellow]
 +
 +
\startbuffer[title]
 +
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par
 +
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par
 +
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par
 +
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par
 +
\type{/test(}\ytyp{h}\type{*?)expr/io}\par
 +
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par
 +
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par
 +
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par
 +
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par
 +
\stopbuffer
 +
 +
\setupcolors[state=start]
 +
 +
\definelayer
 +
  [TitleGraphic]
 +
  [width=\paperwidth,
 +
    height=\paperheight]
 +
 +
\setlayer
 +
  [TitleGraphic]
 +
  [preset=lefttop]
 +
  {\scale
 +
      [width=\paperwidth,
 +
      height=\paperheight]
 +
      {\framed
 +
        [frame=off,
 +
          offset=overlay,
 +
          background=color,
 +
          backgroundcolor=blue,
 +
          foregroundcolor=red,
 +
          align=normal]
 +
%        {\setuptyping[before=,after=]\typebuffer[title]}}}
 +
        {\getbuffer[title]}}}
 +
 +
\setupbackgrounds[page][background=TitleGraphic]
 +
 +
\starttext
 +
 +
\startstandardmakeup
 +
 +
\stopstandardmakeup
 +
 +
\stoptext
 +
</texcode>
 +
 +
Guess who did this one :-) [http://archive.contextgarden.net/message/20050321.011152.0eb2d729.html Reference to mailing list]
 +
 +
<context>
 +
\setuplayout[location=middle,scale=.2]
 +
\definetype[ytyp][color=yellow]
 +
 +
\startbuffer[title]
 +
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par
 +
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par
 +
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par
 +
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par
 +
\type{/test(}\ytyp{h}\type{*?)expr/io}\par
 +
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par
 +
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par
 +
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par
 +
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par
 +
\stopbuffer
 +
 +
\setupcolors[state=start]
 +
 +
\definelayer
 +
  [TitleGraphic]
 +
  [width=\paperwidth,
 +
    height=\paperheight]
 +
 +
\setlayer
 +
  [TitleGraphic]
 +
  [preset=lefttop]
 +
  {\scale
 +
      [width=\paperwidth,
 +
      height=\paperheight]
 +
      {\framed
 +
        [frame=off,
 +
          offset=overlay,
 +
          background=color,
 +
          backgroundcolor=blue,
 +
          foregroundcolor=red,
 +
          align=normal]
 +
        {\getbuffer[title]}}}
 +
 +
\setupbackgrounds[page][background=TitleGraphic]
 +
 +
\starttext
 +
 +
\startstandardmakeup
 +
 +
\stopstandardmakeup
 +
 +
\stoptext
 +
</context>
 +
 +
 +
== A simple centered cover for a booklet ==
 +
 +
 +
<texcode>
 +
 +
\setuppapersize[A5][A5]
 +
\setuppagenumbering[alternative=doublesided]
 +
 +
 +
\starttext
 +
 +
\startpagemakeup[align=center,doublesided=no,%
 +
  pagestate=start]% we want to number this
 +
 +
{\bfc This should be the long title, Andreas' solution\par}
 +
 +
\stoppagemakeup
 +
 +
This is the colofon
 +
 +
\chapter{Start}
 +
 +
\input knuth
 +
 +
\stoptext
 +
 +
</texcode>
 +
 +
Reference: http://www.ntg.nl/pipermail/ntg-context/2011/063030.html
 +
 +
Or, another solution (which can be tuned at will), which relies on a
 +
new feature in MkIV: there is also a layout with the same name as the
 +
makeup environment and you can control the margins of your new title
 +
page environment with \setuplayout[makeupname][...].
 +
 +
<texcode>
 +
 +
\setuppagenumbering[alternative=doublesided]
 +
 +
%\showframe
 +
 +
\setuppapersize[A5][A4,landscape]
 +
\setuparranging[2UP]
 +
 +
 +
\definemakeup[titlepage][pagestate=start,doublesided=no]
 +
\setuplayout[titlepage]
 +
[backspace=2cm,width=108mm] % 148mm is the width, 20 mm of backspace,
 +
                            % 20 mm of outer margin
 +
 +
\starttext
 +
 +
\starttitlepagemakeup
 +
\raggedcenter
 +
\bfc This should be the long, long, very long title\par
 +
\stoptitlepagemakeup
 +
 +
This is the colofon
 +
 +
\chapter{Start here on page 3}
 +
 +
\dorecurse{20}{\input tufte\par}
 +
 +
\stoptext
 +
 +
</texcode>
 +
 +
== Scaled Full Page Image 1 ==
 +
 +
An elegant option is to extend the makeup mechanism to accept the background key:
 +
 +
    \unprotect
 +
    \appendtoks
 +
      \setupbackgrounds[\v!page][\c!background=\makeupparameter\c!background]
 +
    \to \t_page_makeup_every_setup
 +
    \protect
 +
 +
Then you can use
 +
 +
<pre>
 +
    \setupexternalfigures[location={local,default,global}]
 +
 +
    \defineoverlay
 +
      [backgroundimage]
 +
      [{\externalfigure[cow.pdf][width=\overlaywidth, height=\overlayheight]}]
 +
 +
 +
    \starttext
 +
 +
    \startstandardmakeup[background=backgroundimage]
 +
      Whatever
 +
    \stopstandardmakeup
 +
 +
    Next
 +
 +
    \stoptext
 +
</pre>
 +
 +
 +
== Scaled Full Page Image 2 ==
 +
 +
Another way to use a full-page image includes:
 +
 +
<pre>
 +
  \startTEXpage
 +
    \externalfigure[cow.pdf][width=\paperwidth, height=\paperheight]
 +
  \stopTEXpage
 +
</pre>
 +
 +
 +
[[Category:Sample documents]]
 +
[[Category:Graphics]]
 +
[[Category:Text elements]]

Latest revision as of 06:17, 22 September 2013

< Sample documents | MetaPost >

\setupcolors[state=start]

\startuseMPgraphic{cover}
   StartPage ;
     fill Page withcolor .5green ;
     path p ; p := unitcircle randomized .1 xsized(PaperWidth-1cm) ;
     fill p shifted -center p shifted center Page  withcolor red ;
   StopPage ;
\stopuseMPgraphic

\defineoverlay[cover][\useMPgraphic{cover}]

\starttext

\setupbackgrounds[page][background=cover]

\startstandardmakeup
  \raggedcenter
  \vfill \definedfont[SerifBold at 48pt]\setstrut \strut Penguins in Vietnam
  \blank[2*big] \definedfont[SerifBold at 24pt]\setstrut \strut A Very Short Story
  \vfill
\stopstandardmakeup

\setupbackgrounds[page][background=]

\input tufte

\stoptext

Reference to mailing list

Another title page

\definetype[ytyp][color=yellow]

\startbuffer[title]
\type{/(}\ytyp{h}\type{*?)testexpr/io}\par
\type{/t(}\ytyp{a}\type{*?)estexpr/io}\par
\type{/te(}\ytyp{n}\type{*?)stexpr/io}\par
\type{/tes(}\ytyp{s}\type{*?)texpr/io}\par
\type{/test(}\ytyp{h}\type{*?)expr/io}\par
\type{/teste(}\ytyp{a}\type{*?)xpr/io}\par
\type{/testex(}\ytyp{g}\type{*?)pr/io}\par
\type{/testexp(}\ytyp{e}\type{*?)r/io}\par
\type{/testexpr(}\ytyp{n}\type{*?)/io}\par
\stopbuffer

\setupcolors[state=start]

\definelayer
   [TitleGraphic]
   [width=\paperwidth,
    height=\paperheight]

\setlayer
   [TitleGraphic]
   [preset=lefttop]
   {\scale
      [width=\paperwidth,
       height=\paperheight]
      {\framed
         [frame=off,
          offset=overlay,
          background=color,
          backgroundcolor=blue,
          foregroundcolor=red,
          align=normal]
%         {\setuptyping[before=,after=]\typebuffer[title]}}}
         {\getbuffer[title]}}}

\setupbackgrounds[page][background=TitleGraphic]

\starttext

\startstandardmakeup

\stopstandardmakeup

\stoptext

Guess who did this one :-) Reference to mailing list


A simple centered cover for a booklet


\setuppapersize[A5][A5]
\setuppagenumbering[alternative=doublesided]


\starttext

\startpagemakeup[align=center,doublesided=no,%
  pagestate=start]% we want to number this

{\bfc This should be the long title, Andreas' solution\par}

\stoppagemakeup

This is the colofon

\chapter{Start}

\input knuth

\stoptext

Reference: http://www.ntg.nl/pipermail/ntg-context/2011/063030.html

Or, another solution (which can be tuned at will), which relies on a new feature in MkIV: there is also a layout with the same name as the makeup environment and you can control the margins of your new title page environment with \setuplayout[makeupname][...].


\setuppagenumbering[alternative=doublesided]

%\showframe

\setuppapersize[A5][A4,landscape]
\setuparranging[2UP]


\definemakeup[titlepage][pagestate=start,doublesided=no]
\setuplayout[titlepage]
[backspace=2cm,width=108mm] % 148mm is the width, 20 mm of backspace,
                            % 20 mm of outer margin

\starttext

\starttitlepagemakeup
 \raggedcenter
 \bfc This should be the long, long, very long title\par
\stoptitlepagemakeup

This is the colofon

\chapter{Start here on page 3}

\dorecurse{20}{\input tufte\par}

\stoptext

Scaled Full Page Image 1

An elegant option is to extend the makeup mechanism to accept the background key:

   \unprotect
   \appendtoks
     \setupbackgrounds[\v!page][\c!background=\makeupparameter\c!background]
   \to \t_page_makeup_every_setup
   \protect

Then you can use

    \setupexternalfigures[location={local,default,global}]

    \defineoverlay
      [backgroundimage]
      [{\externalfigure[cow.pdf][width=\overlaywidth, height=\overlayheight]}]


    \starttext

    \startstandardmakeup[background=backgroundimage]
      Whatever
    \stopstandardmakeup

    Next

    \stoptext


Scaled Full Page Image 2

Another way to use a full-page image includes:

  \startTEXpage
    \externalfigure[cow.pdf][width=\paperwidth, height=\paperheight]
  \stopTEXpage