Difference between revisions of "TextBackground"

From ConTeXt wiki
(Created page.)
 
m
Line 4: Line 4:
  
 
Pages, paragraphs, words can have a background: color or screen.
 
Pages, paragraphs, words can have a background: color or screen.
 +
 +
(See, eventually, the [[manual:details.pdf| details]] manual for further explanations.)
  
 
== Example: multi-page backgrounded text ==
 
== Example: multi-page backgrounded text ==

Revision as of 18:33, 25 January 2009

< Main Page | Visuals >


TODO: Add more examples of usage of textbackgrounds. (See: To-Do List)


Pages, paragraphs, words can have a background: color or screen.

(See, eventually, the details manual for further explanations.)

Example: multi-page backgrounded text

Perhaps one might like to offset examples from the running text, or signal to the reader that the following paragraphs contain secondary, detailed information that is of interest only to the specialists. This can be achieved using textbackgrounds.

In contrast, Framed creates text blocks that do not span columns or pages.

In the following example, we also reduce the textwidth and bodyfont size.

\setupcolors[state=start]

\definetextbackground[secondary][
        location=paragraph,
        %background=screen, %doesn't work??
	background=color,backgroundscreen=middlegray,
        leftoffset=.5\bodyfontsize,rightoffset=.5\bodyfontsize,
        topoffset=.5\bodyfontsize,bottomoffset=.5\bodyfontsize,
        before={\startnarrower\switchtobodyfont[small]},
        after={\switchtobodyfont[normal]\stopnarrower},
        frame=off]

\starttext

\input knuth

\startsecondary
	\input knuth
\stopsecondary

\input knuth

\stoptext


TODO: The background does not show here using the live, online conTeXt processor. Why? (See: To-Do List)


backgroundoffset

The options left, right, top, bottomoffset can be replaced by backgroundoffset yielding a different result:

\setupcolors[state=start]

\definetextbackground[secondary][
        location=paragraph,
        %background=screen, %doesn't work??
	background=color,backgroundscreen=middlegray,
        backgroundoffset=.5\bodyfontsize,
        before={\startnarrower\switchtobodyfont[small]},
        after={\switchtobodyfont[normal]\stopnarrower},
        frame=off]

\starttext

\input knuth

\startsecondary
	\input knuth
\stopsecondary

\input knuth

\stoptext