* Centering a defined text frame
@ 2009-01-24 14:30 Bart C. Wise
2009-01-24 19:47 ` Willi Egger
2009-01-25 12:11 ` Wolfgang Schuster
0 siblings, 2 replies; 9+ messages in thread
From: Bart C. Wise @ 2009-01-24 14:30 UTC (permalink / raw)
To: Context Mailing List
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Centering a defined text frame
2009-01-24 14:30 Centering a defined text frame Bart C. Wise
@ 2009-01-24 19:47 ` Willi Egger
2009-01-24 20:59 ` Bart C. Wise
2009-01-25 12:11 ` Wolfgang Schuster
1 sibling, 1 reply; 9+ messages in thread
From: Willi Egger @ 2009-01-24 19:47 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Centering a defined text frame
2009-01-24 19:47 ` Willi Egger
@ 2009-01-24 20:59 ` Bart C. Wise
0 siblings, 0 replies; 9+ messages in thread
From: Bart C. Wise @ 2009-01-24 20:59 UTC (permalink / raw)
To: ntg-context; +Cc: Willi Egger
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Centering a defined text frame
2009-01-24 14:30 Centering a defined text frame Bart C. Wise
2009-01-24 19:47 ` Willi Egger
@ 2009-01-25 12:11 ` Wolfgang Schuster
2009-01-26 14:11 ` Bart C. Wise
1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2009-01-25 12:11 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Centering a defined text frame
2009-01-25 12:11 ` Wolfgang Schuster
@ 2009-01-26 14:11 ` Bart C. Wise
2009-01-26 15:14 ` Wolfgang Schuster
0 siblings, 1 reply; 9+ messages in thread
From: Bart C. Wise @ 2009-01-26 14:11 UTC (permalink / raw)
To: ntg-context
On Sun January 25 2009 5:11:25 am Wolfgang Schuster wrote:
> 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
>
>
Thanks Wolfgang.
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
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Centering a defined text frame
2009-01-26 14:11 ` Bart C. Wise
@ 2009-01-26 15:14 ` Wolfgang Schuster
2009-01-26 16:51 ` Bart C. Wise
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2009-01-26 15:14 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Centering a defined text frame
2009-01-26 15:14 ` Wolfgang Schuster
@ 2009-01-26 16:51 ` Bart C. Wise
2009-01-26 17:57 ` Wolfgang Schuster
0 siblings, 1 reply; 9+ messages in thread
From: Bart C. Wise @ 2009-01-26 16:51 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Centering a defined text frame
2009-01-26 16:51 ` Bart C. Wise
@ 2009-01-26 17:57 ` Wolfgang Schuster
2009-01-26 18:33 ` Bart C. Wise
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2009-01-26 17:57 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Centering a defined text frame
2009-01-26 17:57 ` Wolfgang Schuster
@ 2009-01-26 18:33 ` Bart C. Wise
0 siblings, 0 replies; 9+ messages in thread
From: Bart C. Wise @ 2009-01-26 18:33 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-01-26 18:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-24 14:30 Centering a defined text frame Bart C. Wise
2009-01-24 19:47 ` Willi Egger
2009-01-24 20:59 ` Bart C. Wise
2009-01-25 12:11 ` Wolfgang Schuster
2009-01-26 14:11 ` Bart C. Wise
2009-01-26 15:14 ` Wolfgang Schuster
2009-01-26 16:51 ` Bart C. Wise
2009-01-26 17:57 ` Wolfgang Schuster
2009-01-26 18:33 ` Bart C. Wise
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).