ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <pragma@wxs.nl>
Subject: Re: Simple backgrounds not working
Date: Sat, 26 May 2012 10:56:02 +0200	[thread overview]
Message-ID: <C93A6BE7-0945-47C0-849A-70D189CBFFAE@googlemail.com> (raw)
In-Reply-To: <alpine.LNX.2.02.1205252254130.2561@ybpnyubfg.ybpnyqbznva>


Am 26.05.2012 um 04:57 schrieb Aditya Mahajan:

> Hi,
> 
> Simple backgrounds are not working with the latest beta. The following has no background color.
> 
> \setupbackground
>  [background=color, backgroundcolor=red]
> \starttext
> \startbackground
>  ABC
> \stopbackground
> \stoptext

Name clash in pack-rul.mkiv.

\startbackgorund uses \currentbackground for the instance of the environment and \framed uses also \currentbackground when it does process the list of backgrounds, changing the macro name in pack-rul.mkiv to \m_framed_background helps.

\unprotect

%\let\currentbackground\empty
\let\m_framed_background\empty

\def\pack_framed_process_background
%  {\ifcsname\??overlaybuiltin\currentbackground\endcsname
  {\ifcsname\??overlaybuiltin\m_framed_background\endcsname
     \pack_framed_process_background_indeed_internal
%   \else\ifcsname\??overlay\currentbackground\endcsname
   \else\ifcsname\??overlay\m_framed_background\endcsname
     \pack_framed_process_background_indeed_external
   \fi\fi}

\def\pack_framed_process_background_indeed_internal % : in name
  {\bgroup
   \setbox\b_framed_extra\hbox{%\bgroup
     \ifzeropt\framedbackgroundoffset
%       \csname\??overlaybuiltin\currentbackground\endcsname
       \csname\??overlaybuiltin\m_framed_background\endcsname
     \else
       \kern-\framedbackgroundoffset
%       \hbox{\csname\??overlaybuiltin\currentbackground\endcsname}%
       \hbox{\csname\??overlaybuiltin\m_framed_background\endcsname}%
     \fi
   }%\egroup
   \wd\b_framed_extra\zeropoint
   \ht\b_framed_extra\framedbackgroundheight
   \dp\b_framed_extra\framedbackgrounddepth
   \box\b_framed_extra
   \egroup}

\def\pack_framed_process_background_indeed_external
  {\pack_framed_overlay_initialize
   \bgroup
   \setbox\b_framed_extra\hbox{%\bgroup
     \ifzeropt\framedbackgroundoffset
%       \csname\??overlay\currentbackground\endcsname
       \csname\??overlay\m_framed_background\endcsname
     \else
       \kern-\framedbackgroundoffset
%       \hbox{\csname\??overlay\currentbackground\endcsname}%
       \hbox{\csname\??overlay\m_framed_background\endcsname}%
     \fi
   }%\egroup
   \wd\b_framed_extra\zeropoint
   \ht\b_framed_extra\framedbackgroundheight
   \dp\b_framed_extra\framedbackgrounddepth
   \box\b_framed_extra
   \egroup}

\def\pack_framed_process_backgrounds#1,#2% #2 gobbles spaces (we could avoid one catch if we have nextbackground)
%  {\edef\currentbackground{#1}%
  {\edef\m_framed_background{#1}%
%   \ifx\currentbackground\s!unknown\else
   \ifx\m_framed_background\s!unknown\else
     \pack_framed_process_background
     \expandafter\pack_framed_process_backgrounds
   \fi#2}

\protect

\setupbackground
 [background=color,
  backgroundcolor=yellow]

\starttext

\startbackground
 ABC
\stopbackground

\stoptext

Wolfgang
___________________________________________________________________________________
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:[~2012-05-26  8:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-26  2:57 Aditya Mahajan
2012-05-26  8:56 ` Wolfgang Schuster [this message]
2012-05-26  9:26   ` Hans Hagen
2012-05-26 14:07     ` Aditya Mahajan
2012-05-26 14:44       ` Hans Hagen

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=C93A6BE7-0945-47C0-849A-70D189CBFFAE@googlemail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    --cc=pragma@wxs.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).