[NTG-context] Frame

Marco Patzer lists at homerow.info
Thu Feb 21 12:19:11 CET 2019


On Thu, 21 Feb 2019 10:50:21 +0000
Ursula Hermann <ursula.hermann at univie.ac.at> wrote:

> Here is my example:
> 
> \setuppapersize[A5]
> \setupcolors[state=start]

This is the default, no need to start the colours any longer.

> {\framed
>    [width=10cm,
>    background=color,backgroundcolor=darkblue,
>    foreground=color,foregroundcolor=white,
>    align={flushleft}]
> {The Earth, as a habitat for animal life, is in old age and has a
> fatal illness. Several, in fact.\par \setupindenting[yes, small]
> It would be happening whether humans had ever evolved or not.
> 
> \externalfigure[cow.pdf][width=1cm]}
> 
> \setupwhitespace[small]
> \starttext
> Below, we have two separate columns; but up here, for the nonce, we
> have but the one.
> 
> \startcolumns[n=2]  % Two columns, please
>     Text, text, text \dots
>     all in the first column
> \column
>     Words, words, words \dots
>    all in the second column.
>     And look ye here! Even more words!
> \stopcolumns
> \stoptext
> Why can‘t I see the cow?

You're missing

  \setupexternalfigures
    [location=default]

Without setting the location context doesn't check the system
directories for the sample images.

Furthermore, you're typesetting before \starttext. That's why your
font is monospaced.

And I try to separate content from style. That's why I move all
style information before \starttext and after \starttext comes only
content and markup (if possible). Nothing wrong with mixing it, but
it's easier to read and easier to change the layout after the fact.
I'd write your example as follows.

\setuppapersize
  [A5]

\setupexternalfigures
  [location=default]

\setupindenting
  [yes, small]

\setupwhitespace
  [small]

\defineframedtext
  [prettyblock]
  [width=10cm,
   indenting={yes, small},
   background=color, backgroundcolor=darkblue,
   foreground=color, foregroundcolor=white,
   offset=2mm,
   align=flushleft]

\starttext

\startprettyblock
  \noindentation
  The Earth, as a habitat for animal life, is in old age and has a fatal
  illness. Several, in fact.

  It would be happening whether humans had ever evolved or not.

  \externalfigure[cow][width=1cm]
\stopprettyblock

Below, we have two separate columns; but up here, for the nonce, we have but
the one.

\startcolumns [n=2]
  Text, text, text \dots
  all in the first column
\column
  Words, words, words \dots
  all in the second column.
  And look ye here! Even more words!
\stopcolumns

\stoptext

Marco


More information about the ntg-context mailing list