ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
Subject: Re: getvariable
Date: Fri, 07 Oct 2005 12:53:15 +0200	[thread overview]
Message-ID: <4346539B.4@gmx.net> (raw)
In-Reply-To: <C8DA528B-6E53-4CC0-BBE9-72C82F7725C5@uni-bonn.de>

Thomas A. Schmitz wrote:
> Peter, I appreciate your helping me. And I have no clue what's going 
> wrong.
> On Oct 6, 2005, at 10:08 PM, Peter Rolf wrote:
> 
>>>
>> I'm just guessing (taken from my own pile of mistakes).
>> Hmm, is it a problem of setting the variable, or it's interpretation?
>> Can you find out, if the variable is set correctly in your \setupcrop
>> macro? Just add
>>
>> \writestatus{[CROP]}{crop mark is: \getvariable{Crop}{mark}}%
> 
> 
> For debugging, I've narrowed the module down to 8 lines:
> 
> \def\setupcrop{\setvariables[Crop]}
> 
Is that all \setupcrop does? :)
It's a bit hard for me to debug your code from parts, without seeing
all. But anyway, here is the way I would handle such stuff. Not tested!

...
% trigger for printing crop info
\newconditional\CropInfo

\def\SetupCrop{\dosingleempty\doSetupCrop}

\def\doSetupCrop[#1]{%
  \iffirstargument
    \getrawparameters[CROP@][{mark=,info=},#1]%
    \processaction[\CROP@mark][
      camera=>{\setvariables[Crop][mark=camera]
	\def\PageBackground{\CameraMarks}},
      cross=>{\setvariables[Crop][mark=cross]
	\def\PageBackground{\CrossMarks}},
      default=>{\setvariables[Crop][mark=]
	\def\PageBackground{}},
      unknown=>{\setvariables[Crop][mark=]
	\def\PageBackground{}}]%
    % no need to store this into a variable
    \processaction[\CROP@info][
      no=>\setfalse\CropInfo,
      default=>\settrue\CropInfo,
      unknown=>\settrue\CropInfo]%
  \else
  % \SetupCrop is called without parameters
    \setvariables[Crop][mark=]
    \setfalse\CropInfo
    \def\PageBackground{}%
  \fi
  % just to give the idea...
  \ifconditional\CropInfo
    \setlayer[markings][x=.5\paperwidth, y=20mm, location=c]%
    {\tt \txx "\jobname" - \currentdate [y,/,mm,/,dd]\ - \currenttime\ -
\realfolio\ of \lastpage}
%  \else
  \fi
% for debugging only
\writestatus{[CROP]}{crop mark is: \getvariable{Crop}{mark}}%
\writestatus{}{crop info is \ifconditional\CropInfo\ enabled\else\
disabled}%
}

\SetupCrop % initialisation (or \setups[namespace:reset])
...

I have no experience with the namespace mechanism Hans mentioned (will
give it a try/ add it to the wiki).

HTH,

Peter

> \setvariables[Crop][mark=cross,info=yes]
> 
> \processaction[\getvariable{Crop}{mark}][
>   camera =>\def\PageBackground{\CameraMarks},
>   cross  =>\def\PageBackground{\CrossMarks},
>   default=>\def\PageBackground{},
>   unknown=>\def\PageBackground{}]%
> 
> \writestatus{[CROP]}{crop mark is: \getvariable{Crop}{mark}}
> 
> my testfile:
> 
> \usemodule[t-crop]
> \setupcrop[mark=camera,info=yes]
> 
> \starttext
> 
> Hello!
> 
> \stoptext
> 
> Output in log:
> 
> (/Users/tas/Library/texmf/tex/t-crop.tex
> [CROP]          : crop mark is: cross
> 
> If second line of module is commented out, I get:
> 
> [CROP]          : crop mark is:
> 
> So it's a problem of actually setting the variable.
> 
>>
>>
>> The error can't hide forever ;)
>>
> Maybe it can't hide forever, but it looks like it can run...
> 
> Thanks for your help. I'll be away tomorrow and will try more on the 
> weekend.
> 
> Best
> 
> Thomas
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> 
> 

  reply	other threads:[~2005-10-07 10:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-05 21:12 getvariable Thomas A. Schmitz
2005-10-06  7:31 ` getvariable Hans Hagen
2005-10-06  8:53   ` getvariable Thomas A. Schmitz
2005-10-06 10:01     ` getvariable Peter Rolf
2005-10-06 11:06       ` getvariable Thomas A. Schmitz
2005-10-06 12:45         ` getvariable Peter Rolf
2005-10-06 15:08           ` getvariable Thomas A. Schmitz
2005-10-06 20:08             ` getvariable Peter Rolf
2005-10-06 21:11               ` getvariable Thomas A. Schmitz
2005-10-07 10:53                 ` Peter Rolf [this message]
2005-10-06 21:32               ` getvariable Hans Hagen
2005-10-06 21:28       ` getvariable Hans Hagen
2005-10-06 21:27     ` getvariable 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=4346539B.4@gmx.net \
    --to=indiego@gmx.net \
    --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).