* Typing in new command problems
@ 2003-09-23 14:00 ^Nitram^
2003-09-23 14:33 ` Patrick Gundlach
2003-09-23 21:28 ` Hans Hagen
0 siblings, 2 replies; 6+ messages in thread
From: ^Nitram^ @ 2003-09-23 14:00 UTC (permalink / raw)
Hi,
I try to define new command with typing in this way:
\def\Command#1%
{
\framed[options]
{
\starttyping
#1
\stoptyping
}
}
and use it in this way:
\Command{\getbuffer[name]}
but I have an error:
! Argument of \copyverbatimline has an extra }.
If I change to \def\Command#1#2%
I have:
! Paragraph ended before \Command was complete.
How I can do it - put ConTeXt code to own frame ?...
--
Best regards
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Typing in new command problems
2003-09-23 14:00 Typing in new command problems ^Nitram^
@ 2003-09-23 14:33 ` Patrick Gundlach
2003-09-23 16:37 ` Hans Hagen
2003-09-23 21:28 ` Hans Hagen
1 sibling, 1 reply; 6+ messages in thread
From: Patrick Gundlach @ 2003-09-23 14:33 UTC (permalink / raw)
"^Nitram^" <nitram@emil.teleton.pl> writes:
Hi,
> I try to define new command with typing in this way:
> \def\Command#1%
> {
> \framed[options]
> {
> \starttyping
> #1
> \stoptyping
> }
> }
Don't mess with verbatim stuff in commands. Don't ask why, just don't
do it ;-)
And: TeX != C. Don't write C-like TeX-braces:
{
\this
{
\that
{
This will give you a hard time looking for unwanted spaces.
Use % or better: write
\def\Command#1%
{\framed[...]%
> How I can do it - put ConTeXt code to own frame ?...
\definetyping
[nitram]
[before=\startframedtext,
after=\stopframedtext]
\starttext
\startnitram
crazy
\stopnitram
\stoptext
Patrick
--
Silent is the goldfish in its bowl
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: Typing in new command problems
2003-09-23 14:33 ` Patrick Gundlach
@ 2003-09-23 16:37 ` Hans Hagen
2003-09-23 16:56 ` Patrick Gundlach
0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2003-09-23 16:37 UTC (permalink / raw)
At 16:33 23/09/2003 +0200, you wrote:
>Don't mess with verbatim stuff in commands. Don't ask why, just don't
>do it ;-)
use buffers instead
has to do with tex collapsing spaces into one, lineendings being spaces,
active characters etc
>And: TeX != C. Don't write C-like TeX-braces:
>
>{
> \this
> {
> \that
> {
>
>This will give you a hard time looking for unwanted spaces.
\unprotect
\def\beginmacro{\catcode`\^^M=\@@ignore}
\def\endmacro {\catcode`\^^M=\@@endofline}
\protect
\beginmacro
\def\patrickneedsatexchallengeeachday#1
{Does he?
(#1)
Why's That?}
\endmacro
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Typing in new command problems
2003-09-23 16:37 ` Hans Hagen
@ 2003-09-23 16:56 ` Patrick Gundlach
0 siblings, 0 replies; 6+ messages in thread
From: Patrick Gundlach @ 2003-09-23 16:56 UTC (permalink / raw)
Hans Hagen <pragma@wxs.nl> writes:
Hello Hans,
> \unprotect
>
> \def\beginmacro{\catcode`\^^M=\@@ignore}
> \def\endmacro {\catcode`\^^M=\@@endofline}
>
> \protect
>
> \beginmacro
>
> \def\patrickneedsatexchallengeeachday#1
> {Does he?
> (#1)
> Why's That?}
>
> \endmacro
without trying it, I guess it will write
"Does he?(...)Why's That"
hmm, I'll try....... Yes :)
OK, ready for the next challenge :)
Patrick
(Perhaps I *do* have built TeX into my brain one day)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Typing in new command problems
2003-09-23 14:00 Typing in new command problems ^Nitram^
2003-09-23 14:33 ` Patrick Gundlach
@ 2003-09-23 21:28 ` Hans Hagen
1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2003-09-23 21:28 UTC (permalink / raw)
Cc: Pawel Jackowski na Onet
At 16:00 23/09/2003 +0200, you wrote:
>Hi,
>
>I try to define new command with typing in this way:
>\def\Command#1%
>{
> \framed[options]
> {
> \starttyping
> #1
> \stoptyping
> }
>}
>and use it in this way:
>\Command{\getbuffer[name]}
>but I have an error:
>! Argument of \copyverbatimline has an extra }.
>
>If I change to \def\Command#1#2%
>I have:
>! Paragraph ended before \Command was complete.
>
>How I can do it - put ConTeXt code to own frame ?...
definetyping
[MyCode]
[before=\startMyFrame,
after=\stopMyFrame]
\defineframedtext
[MyFrame]
[width=fit]
\startMyCode
\Command{\getbuffer[name]}
\stopMyCode
(btw, this kind of framed texts knwo quite well how to get rid of white space)
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Typing in new command problems
@ 2003-09-24 10:45 ^Nitram^
0 siblings, 0 replies; 6+ messages in thread
From: ^Nitram^ @ 2003-09-24 10:45 UTC (permalink / raw)
Hi,
> > Is it impossible?
> Is this a real question?
No ;) But the real should be '... for newbie' :)
[cut]
Thank you very much. I did it in this way:
\defineframedtext[Frame][width=broad,bodyfont=9pt,align=right]
%but align is a little strange = see new post Aligment?
\def\Command#1#2
{\setuptyping[before=\startFrame,after=\stopFrame]
\setupTABLE[frame=off]\bTABLE\bTR\bTD[width=.2\textwidth,align=left]
%align again
\bfx #2\eTD\bTD \typebuffer[#1] \eTD\eTR\eTABLE
\setuptyping[before=,after=]}
And now it is what I want ;) Probably there is another way to do this
but I'm in ConTeXt since 1-2 months ;)
--
Best regards
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-09-24 10:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-23 14:00 Typing in new command problems ^Nitram^
2003-09-23 14:33 ` Patrick Gundlach
2003-09-23 16:37 ` Hans Hagen
2003-09-23 16:56 ` Patrick Gundlach
2003-09-23 21:28 ` Hans Hagen
2003-09-24 10:45 ^Nitram^
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).