Re: [NTG-context] Centering a defined text frame

2009-01-26 Thread Bart C. Wise
On Mon January 26 2009 8:14:11 am Wolfgang Schuster wrote:
 Hi Bart,

  Is there a way to pass in my own defined parameters to such a function?
 
  I would like to be able to do something similar to the following:
 
  \startCenteredText[myownparm=This is a test]
\startlines
 My own parm is: \myownparm
\stoplines
  \stopCenteredText

 Not with framedtext but you define your environment with a optional
 argument.

 ConTeXt has the command \definestartstop but it did not help in your case,
 something like LaTeXs \newenvironment, I wrote a simple version below.

 \unprotect

 \def\ev{ev}

 \def\environmentparameter#1%
   {\csname\ev\currentenvironment#1\endcsname}

 \def\defineenvironment
   {\dodoubleempty\dodefineenvironment}

 \def\dodefineenvironment[#1][#2]%
   {\getparameters
  [\ev#1]
  [\c!before=,
   \c!after=,
   #2]%
\setvalue{\e!start#1}{\dodoubleempty\dostartenvironment[#1]}%
\setvalue{\e!stop #1}{\dostopenvironment}}

 \def\setupenvironment
   {\dodoubleargument\dosetupenvironment}

 \def\dosetupenvironment[#1][#2]%
   {\getparameters[\ev#1][#2]}

 \def\dostartenvironment[#1][#2]%
   {\bgroup
\edef\currentenvironment{#1}%
\ifsecondargument
  \setupenvironment[\currentenvironment][#2]%
\fi
\environmentparameter\c!before}

 \def\dostopenvironment
   {\environmentparameter\c!after
\egroup}

 \protect

 \defineframedtext
   [CenteredTextFrame]
   [width=fit,
location=middle]

 \defineenvironment
   [CenteredText]
   [before=\startCenteredTextFrame\startlines,
after=\stoplines\stopCenteredTextFrame]

 \starttext

 \startCenteredText[text={This is a test}]
 My own parm is: \environmentparameter{text}
 \stopCenteredText

 \stoptext


Thanks Wolfgang for the insight.

Bart
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Centering a defined text frame

2009-01-26 Thread Bart C. Wise
On Mon January 26 2009 10:57:23 am Wolfgang Schuster wrote:
 Am 26.01.2009 um 17:51 schrieb Bart C. Wise:
  Thanks Wolfgang for the insight.

 Here is one that did exactly you wrote, nothing else.

 \defineframedtext[CenteredTextFrame][width=fit,location=middle]

 \def\startCenteredText
{\dosingleempty\dostartCenteredText}

 \def\dostartCenteredText[#1]%
{\bgroup
 \iffirstargument
   \def\docommand##1{\getparameters[][##1]}%
   \processcommalist[#1]\docommand
 \fi
 \startCenteredTextFrame}

 \def\stopCenteredText
{\stopCenteredTextFrame
 \egroup}

 \starttext

 \startCenteredText[myownparm=This is a test]
\startlines
   My own parm is: \myownparm
\stoplines
 \stopCenteredText

 \stoptext

Yes, a much simpler solution, but I appreciate having both.

Thanks,
Bart
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Centering a defined text frame

2009-01-25 Thread Wolfgang Schuster


Am 24.01.2009 um 15:30 schrieb Bart C. Wise:

I'm trying to have a centered text frame.  There are two examples in  
the code

below.
1) This one works.  It uses a text frame that is in line in the code.
2) This one does not work! It's using a defined text frame and  
flushes the text

frame to the left.  How do I fix this?


\defineframedtext[CenteredText][width=fit,location=middle]

\starttext

\startCenteredText
  \startlines
  The quick brown fox jumps over the lazy dog.
  \stoplines
\stopCenteredText

\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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Centering a defined text frame

2009-01-24 Thread Bart C. Wise
I'm trying to have a centered text frame.  There are two examples in the code 
below.
1) This one works.  It uses a text frame that is in line in the code.
2) This one does not work! It's using a defined text frame and flushes the text 
frame to the left.  How do I fix this?

Thanks,
Bart

\defineframedtext[CenteredText][width=fit]

\starttext

% This one works!
\startalignment[center]
\dontleavehmode
\framedtext[width=fit]{
\startlines
The quick brown fox jumps over the lazy dog.
\stoplines
}
\stopalignment

% This one fails!
\startalignment[center]
\dontleavehmode
\startCenteredText
\startlines
The quick brown fox jumps over the lazy dog.
\stoplines
\stopCenteredText

\stoptext
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Centering a defined text frame

2009-01-24 Thread Willi Egger
In analogy to \framedtext after a define of a framedtext I expect  
that that you should use \CenteredText{...}

And indeed.

\defineframedtext[CenteredText][width=fit]
% This one fails!
\startalignment[center]
\dontleavehmode
\CenteredText{
\startlines
The quick brown fox jumps over the lazy dog.
\stoplines}
%\stopCenteredText


Willi
On Jan 24, 2009, at 3:30 PM, Bart C. Wise wrote:


\defineframedtext[CenteredText][width=fit]

\starttext

% This one works!
\startalignment[center]
\dontleavehmode
\framedtext[width=fit]{
\startlines
The quick brown fox jumps over the lazy dog.
\stoplines
}
\stopalignment

% This one fails!
\startalignment[center]
\dontleavehmode
\startCenteredText
\startlines
The quick brown fox jumps over the lazy dog.
\stoplines
\stopCenteredText

\stoptext


___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Centering a defined text frame

2009-01-24 Thread Bart C. Wise
Oh, I feel stupid.  I think I need some more sleep.  Thanks for the tip.

Bart

 In analogy to \framedtext after a define of a framedtext I expect
 that that you should use \CenteredText{...}
 And indeed.

 \defineframedtext[CenteredText][width=fit]
 % This one fails!
 \startalignment[center]
 \dontleavehmode
 \CenteredText{
  \startlines
  The quick brown fox jumps over the lazy dog.
  \stoplines}
 %\stopCenteredText


 Willi

 On Jan 24, 2009, at 3:30 PM, Bart C. Wise wrote:
  \defineframedtext[CenteredText][width=fit]
 
  \starttext
 
  % This one works!
  \startalignment[center]
  \dontleavehmode
  \framedtext[width=fit]{
  \startlines
  The quick brown fox jumps over the lazy dog.
  \stoplines
  }
  \stopalignment
 
  % This one fails!
  \startalignment[center]
  \dontleavehmode
  \startCenteredText
  \startlines
  The quick brown fox jumps over the lazy dog.
  \stoplines
  \stopCenteredText
 
  \stoptext

 ___
 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  : https://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___


___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___