Changes

Jump to navigation Jump to search
31 bytes removed ,  10:48, 13 December 2020
no edit summary
</context>
= Simple example with MetaFun (2019) =
 
from [https://tex.stackexchange.com/questions/472622/cover-page-coloring-in-context tex.stackexchange.com]
 
<context source=yes>
\setuppapersize[A6]
 
\setupbodyfont [palatino]
 
\definecolor [Top] [h=a5b291]
\definecolor [Bottom] [h=b7c1a7]
\definecolor [TitleColor] [h=96433a]
 
\define[1]\titlefont{%
\setcharacterkerning[extrakerning]%
\cap
\definedfont[#1]%
\ignorespaces
}
 
\starttext
 
\startMPpage
 
StartPage ;
 
numeric w ; w := bbwidth(Page) ;
numeric h ; h := bbheight(Page) ;
 
fill (unitsquare xyscaled (w,.8h)) withcolor \MPcolor{Bottom} ;
fill (unitsquare xyscaled (w,.2h) yshifted .8h) withcolor \MPcolor{Top} ;
draw (0,.8h) -- (w,.8h) withpen pensquare scaled 2pt withcolor white ;
 
draw textext.rt("\definedfont[Serif at 10pt]Author") shifted (.1w,.95h) ;
draw textext.rt("\titlefont{Serif at 20pt} Cover Page Title") shifted (.1w,.85h) withcolor \MPcolor{TitleColor} ;
draw textext.rt("\titlefont{SerifBold at 10pt} Subhead Title") shifted (.1w,.75h) withcolor \MPcolor{TitleColor} ;
draw textext.rt("\titlefont{SerifBold at 10pt} Another subhead") shifted (.1w,.70h) ;
 
 
% picture p; p := externalfigure "matterhorn.png" ;
% draw p scaled (w/bbwidth p) ;
 
StopPage ;
 
\stopMPpage
 
\stoptext
</context>
= A very very simple one =
And that's it, a very simple cover page. While it may be useful as such, it has several shortcomings. For example, the positions are not absolute, so a change in the title may move the information block in the lower right corner. Using the TABLE is just a show-off. If you do not need the "align-by-rightmost" alignment, <tt>\startnarrower[..][..] ... \stopnarrower</tt> provides much the same functionality with fewer commands and cleaner code.
= Simple example with MetaFun (2019) = from [https://tex.stackexchange.com/questions/472622/cover-page-coloring-in-context tex.stackexchange.com] <context source=yes>\setuppapersize[A6] \setupbodyfont [palatino] \definecolor [Top] [h=a5b291]\definecolor [Bottom] [h=b7c1a7]\definecolor [TitleColor] [Category:Sample documentsh=96433a] \define[1]\titlefont{% \setcharacterkerning[extrakerning]% \cap \definedfont[#1]% \ignorespaces} \starttext \startMPpage
StartPage ;
 
numeric w ; w := bbwidth(Page) ;
numeric h ; h := bbheight(Page) ;
 
fill (unitsquare xyscaled (w,.8h)) withcolor \MPcolor{Bottom} ;
fill (unitsquare xyscaled (w,.2h) yshifted .8h) withcolor \MPcolor{Top} ;
draw (0,.8h) -- (w,.8h) withpen pensquare scaled 2pt withcolor white ;
 
draw textext.rt("\definedfont[Serif at 10pt]Author") shifted (.1w,.95h) ;
draw textext.rt("\titlefont{Serif at 20pt} Cover Page Title") shifted (.1w,.85h) withcolor \MPcolor{TitleColor} ;
draw textext.rt("\titlefont{SerifBold at 10pt} Subhead Title") shifted (.1w,.75h) withcolor \MPcolor{TitleColor} ;
draw textext.rt("\titlefont{SerifBold at 10pt} Another subhead") shifted (.1w,.70h) ;
 
 
% picture p; p := externalfigure "matterhorn.png" ;
% draw p scaled (w/bbwidth p) ;
 
StopPage ;
 
\stopMPpage
 
\stoptext
</context>
[[Category:Sample documents]]

Navigation menu