ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Marko Schütz Schmuck" <MarkoSchuetz@web.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: change affecting MPgraphic?
Date: Fri, 24 Sep 2010 07:29:05 -0400	[thread overview]
Message-ID: <87ocbnjs72.wl%MarkoSchuetz@web.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 7890 bytes --]

Dear All,

I only very recently updated from

ConTeXt  ver: 2005.01.31

to 

ConTeXt  ver: 2009.08.19 17:10 MKII 

Previously, using env-assign.tex as described in a 2006 PracTeX
article worked fine. With the new version the drop shadow box is not
rendered. 

This is the version of env-assign.tex I use:


\startenvironment env-assign

%D This is the environment file to prepare homework assignments in \CONTEXT.
%D See accompanying Prac\TEX\ article for an introduction on how to use it.

%D I use US letter paper and resonable margins.

\setuppapersize[letter][letter]

\setuplayout[
                 width=middle,
                height=middle,
              location=middle,
              topspace=1in,
           bottomspace=1in,
             backspace=1in,
              cutspace=1in,
            leftmargin=0in,
           rightmargin=0in,
    leftmargindistance=0in,
   rightmargindistance=0in,
                header=0.5in,
                footer=0.5in,
         headerdistace=0in,
        footerdistance=0in
      ]

\setupwhitespace  [small]
\setupblank       [medium]

%\startMPenvironment[global]
%\definetypeface
%  [MyFace] [rm] [serif] [palatino] [default] [encoding=ec]
%\definetypeface
%  [MyFace] [tt] [mono]  [modern]   [default] [encoding=ec,rscale=1.1]
%\definetypeface
%  [MyFace] [mm] [math]  [euler]    [euler]   [encoding=ec,rscale=1.03]

%\usetypescript[adobekb][\defaultencoding]
%\setupbodyfont  [MyFace, 11pt]
%\stopMPenvironment

\definefont [BigFontOne]  [RegularSlanted sa 2.5]
\definefont [BigFontTwo]  [Regular sa 1.5]


\setupcolors  [state=start]
\definecolor  [colorone]    [r=0.625,g=0,b=0] %dark red
\definecolor  [colortwo]    [b=0.625,g=0,r=0] %dark blue

\startuniqueMPgraphic{shadow}
    fill OverlayBox shifted (3pt,-3pt) withcolor .8white ;
    fill OverlayBox withcolor white ;
    draw OverlayBox withcolor blue ;
    setbounds currentpicture to OverlayBox ;
\stopuniqueMPgraphic

\defineoverlay  [shadow]  [\uniqueMPgraphic{shadow}]

\def\assignmenttitle#1#2%
  {\framed[
              width=broad,
              frame=off,
              align=right,
    foregroundcolor=colortwo,
         % I want a shadow around the title frame
         background=shadow]
      {#2\\{\colorone\BigFontTwo\Assigncourse}}}

\setuphead[title]
 [  style=\BigFontOne,
   command=\assignmenttitle,
   before={\resetnumber[PROBLEM]\setuppagenumber[number=1]},
    after={\blank[big] \bgroup \colortwo
    Assigned on:
     \expanded{\date[\Assignassigned]}
    \hfill
    Due on:
     \expanded{\date[\Assigndue]}
   \egroup\blank}
 ]

\setupheadertexts [title]

%D say \quotation{Solutions} while generating solutions

\startmode[solution]
  \setupheadertexts [Solutions] []
\stopmode

\setupfootertexts [pagenumber]

\setupfootertexts
  [Assigned: \expanded{\date[\Assignassigned]}]
  [Due: \expanded{\date[\Assigndue]}]

\definetext [title] [footer]  [pagenumber]
\setuphead  [title] [header=high,footer=]

\setuplabeltext [problem=Problem,solution=Solution ]
\setuplabeltext [point=point,points=points]

\def\assignment[#1]
  {\getrawparameters
    [Assign]
    [title=,
      course=,
      assigned=,
      due=,
      #1]%
    \title{\Assigntitle}
}

\defineenumeration
  [PROBLEM]
  [     text={\labeltext{problem}},
    location=hanging,
   headstyle=\sc,
   headcolor=colorone,
      before={\resetnumber[formula]\page[desirable]},
       after=\blank,
  ]

\def\startproblem%
  {\dosingleempty\dostartproblem}

\def\dostartproblem[#1]%
  {\startPROBLEM[#1]\dosinglegroupempty\dodostartproblem}

\def\dodostartproblem#1%
  {\iffirstargument
  % Check if #1 = 1, use point, else use points
    \bgroup \colortwo (#1 \dopoints{#1}) \egroup
   \fi}

\def\dopoints#1%
  {\doifelse{#1}{1}{\labeltext{point}}{\labeltext{points}}}

\def\stopproblem%
  {\stopPROBLEM}


\setupheader  [text]  [color=colortwo]
\setupfooter  [text]  [color=colortwo]

\setupitemize [each]  [left=(,right=),stopper=,color=colorone]
\setupitemize [1]     [intro]
\setupitemize [joinedup,packed]

%D Use characters (a,b,\unknown) at the first level and roman numberals (i, ii,
%D \unknown) at the second level.

\setupitemize [1] [a]
\setupitemize [2] [r]

%D \macros{startsolution}
%D In the default mode, the solution evironment should gobble its contents.
%D I copy the definition of \tex{starthiding} to {\em hide} the solutions.

\definebuffer [solution]
\setupbuffer  [solution]  [local=yes]

%D In solution mode, I redefine solution environment as an
%D enumeration without a number. There are probably better ways to define this
%D environment, but why reinvent the wheel?

\startmode[solution]
\defineenumeration
    [solution]
    [      text=\labeltext{solution},
         number=no,
      headstyle=bold,
      headcolor=colortwo,
       location=serried,
          width=fit,
         before=\startsolutionbackground,
          after=\stopsolutionbackground
    ]

%D The \filename{exam.cls} class in \LATEX\ allows you to put a frame around
%D the solution and the frame breaks across pages. I wanted to put a frame
%D around the solution, but something more informal than a rectangular frame.
%D \CONTEXT's manual gave hints on getting different kinds of frames, and I
%D finally settled for a randomized framed. The frame should
%D break around pages, so I used \tex{textbackground}.

\definetextbackground
    [solutionbackground]
    [           mp=background:random,
          location=paragraph,
     rulethickness=1pt,
        framecolor=colorone,
             width=local,
        leftoffset=1em,
       rightoffset=1em,
            before={\testpage[3]\blank[2*big]},
             after={\blank[2*big]}
    ]

%D The background in  \tex{textbackground} is drawn using a useMPgraphic
%D defined set by \mono{mp=}. I define a useMPgraphic \mono{background:random}
%D to get the frame that I wanted. The code looks a bit complicated, because
%D \tex{texbackground} is supposed to work in a multi||column documents.


%  A randomized frame
\startuseMPgraphic{background:random}
    path p;
    for i = 1 upto nofmultipars :
     p = (multipars[i]
      topenlarged 10pt
      bottomenlarged 10pt) randomized 4pt ;
    fill p withcolor lightgray ;
    draw p withcolor \MPvar{linecolor}
     withpen pencircle scaled \MPvar{linewidth};
    endfor;
\stopuseMPgraphic

%D An earlier attempt that draws a frame which is squeezed in the center.  To
%D use this change mp=background:random to mp=backgrond:squeezed in
%D \definetextbackground above.

\startuseMPgraphic{background:squeezed}
    path p;
    for i = 1 upto nofmultipars :
     p = multipars[i]
      topenlarged 10pt
      bottomenlarged 10pt
      squeezed 5pt
      randomized 1pt ;
      fill p withcolor lightgray ;
     draw p withcolor \MPvar{linecolor}
      withpen pencircle scaled \MPvar{linewidth};
    endfor;
\stopuseMPgraphic

%D By default, the textbackground extends till the page boundary. This does
%D not look good if a page break occurs when there is not enough material to
%D fit in the page. So, we want to limit textbackground till the typeset
%D material. This has not been interfaced yet, so I use a low level \TEX\
%D command.

\chardef\kindofpagetextareas\plusone
\stopmode

%D I also wanted an English rule at the end of each assignment. \CONTEXT\
%D already defines an English rule. I load \filename{meta-txt.tex} to use it.

\useMPlibrary [txt]

%D I want the English rule to match the color scheme of the entire document.

\setupMPvariables
  [EnglishRule]
  [color=colortwo,
   width=0.5\textwidth]

%D I redefined \tex{stopcomponent} to add the rule at the end of the file.

\let\normalstopcomponent\stopcomponent

\def\stopcomponent%
  {\dosomebreak\nobreak
  \framedtext[frame=off,strut=no,align=middle,width=\textwidth]
   {\EnglishRule}
   \normalstopcomponent}

\stopenvironment



Any hints as to why this should not work anymore?

Thanks and best regards,

Marko

[-- Attachment #1.2: Type: application/pgp-signature, Size: 194 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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:[~2010-09-24 11:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24 11:29 Marko Schütz Schmuck [this message]
2010-09-24 15:21 ` Aditya Mahajan
2010-09-27 18:20   ` Marko Schütz Schmuck
2010-09-27 18:27     ` Aditya Mahajan
2010-09-28 19:41       ` Marko Schütz Schmuck
2010-09-28 20:04         ` Aditya Mahajan

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=87ocbnjs72.wl%MarkoSchuetz@web.de \
    --to=markoschuetz@web.de \
    --cc=ntg-context@ntg.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).