ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \obeyspaces
@ 2011-04-08 11:08 Herbert Voss
  0 siblings, 0 replies; 7+ messages in thread
From: Herbert Voss @ 2011-04-08 11:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

The spaces in front of the lines are not taken
into account for the two defined macros. What to do that
\obeyspaces is also valid for these ones?

\def\TextWithSpaces{\bgroup\obeyspaces\doTextWithSpaces}
\def\FramedTextWithSpaces{\framed\bgroup\obeyspaces\doTextWithSpaces}
\def\doTextWithSpaces#1{#1\egroup}

starttext
     A gap from here        to here!\par
\TextWithSpaces{   A gap from        here      to here!}

\framed{   A gap from here         to  here!}\par
\FramedTextWithSpaces{   A gap from        here      to here!}
\stoptext

current minimal

Herbert
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: \obeyspaces
  2005-08-02 13:11   ` \obeyspaces Hans Hagen
@ 2005-08-02 17:42     ` Peter Rolf
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Rolf @ 2005-08-02 17:42 UTC (permalink / raw)


Hans Hagen wrote:
> Taco Hoekwater wrote:
> 
>>
>>
>> Peter Rolf wrote:
>>
>>> Hi all,
>>>
>>> I need to pass a short text as parameter to a defintion. My problem is,
>>> that the significant spaces are removed in this process. Hmm.....no
>>> clue.
>>>
>>>
>>> % interface=en output=pdftex
>>> \starttext
>>>
>>> \def\TextWithSpaces#1{\framed{\obeyspaces#1}}%
>>
>>
>>
>> A two-part solution is needed:
>>
>>   \def\TextWithSpaces{\bgroup\obeyspaces\doTextWithSpaces}
>>   \def\doTextWithSpaces#1{\framed{#1}\egroup}
> 
> 
> i suggest that rolf adds en entry to the wiki, with the posted
> solutions, maybe we need a "how tex treats arguments" corner or so
> Hans
done. And my (first) name is Peter. Thank god I have no middle name....

Greetings,

Peter

> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
>                                             | www.pragma-pod.nl
> -----------------------------------------------------------------
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: \obeyspaces
  2005-08-02 10:40 ` \obeyspaces Taco Hoekwater
  2005-08-02 10:51   ` \obeyspaces Peter Rolf
@ 2005-08-02 13:11   ` Hans Hagen
  2005-08-02 17:42     ` \obeyspaces Peter Rolf
  1 sibling, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2005-08-02 13:11 UTC (permalink / raw)


Taco Hoekwater wrote:

>
>
> Peter Rolf wrote:
>
>> Hi all,
>>
>> I need to pass a short text as parameter to a defintion. My problem is,
>> that the significant spaces are removed in this process. Hmm.....no 
>> clue.
>>
>>
>> % interface=en output=pdftex
>> \starttext
>>
>> \def\TextWithSpaces#1{\framed{\obeyspaces#1}}%
>
>
> A two-part solution is needed:
>
>   \def\TextWithSpaces{\bgroup\obeyspaces\doTextWithSpaces}
>   \def\doTextWithSpaces#1{\framed{#1}\egroup}

i suggest that rolf adds en entry to the wiki, with the posted solutions, maybe we need a "how tex treats arguments" corner or so 

Hans 


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: \obeyspaces
  2005-08-02 10:32 \obeyspaces Peter Rolf
  2005-08-02 10:40 ` \obeyspaces Taco Hoekwater
@ 2005-08-02 13:09 ` Hans Hagen
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2005-08-02 13:09 UTC (permalink / raw)


Peter Rolf wrote:

>Hi all,
>
>I need to pass a short text as parameter to a defintion. My problem is,
>that the significant spaces are removed in this process. Hmm.....no clue.
>
>
>% interface=en output=pdftex
>\starttext
>
>\def\TextWithSpaces#1{\framed{\obeyspaces#1}}%
>
>% output is ok
>\framed{\obeyspaces{A gap from here      to here!}}
>% no big gap between 'here' and 'to'
>\TextWithSpaces{A gap from here      to here!}
>
>\s
>
\def  \TextWithSpaces  {\framed\bgroup\obeyspaces\doTextWithSpaces}
\def\doTextWithSpaces     #1{#1\egroup}

just postpone argument loading 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: \obeyspaces
  2005-08-02 10:40 ` \obeyspaces Taco Hoekwater
@ 2005-08-02 10:51   ` Peter Rolf
  2005-08-02 13:11   ` \obeyspaces Hans Hagen
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Rolf @ 2005-08-02 10:51 UTC (permalink / raw)


Taco Hoekwater wrote:
> 
> 
> Peter Rolf wrote:
> 
>> Hi all,
>>
>> I need to pass a short text as parameter to a defintion. My problem is,
>> that the significant spaces are removed in this process. Hmm.....no clue.
>>
>>
>> % interface=en output=pdftex
>> \starttext
>>
>> \def\TextWithSpaces#1{\framed{\obeyspaces#1}}%
> 
> 
> A two-part solution is needed:
> 
>   \def\TextWithSpaces{\bgroup\obeyspaces\doTextWithSpaces}
>   \def\doTextWithSpaces#1{\framed{#1}\egroup}
> 
stupid me. \obeyspaces changes the cat-code of the space char, so...

> Cheers, Taco
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> 
> 

Many thanks Taco!

Greetings,

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: \obeyspaces
  2005-08-02 10:32 \obeyspaces Peter Rolf
@ 2005-08-02 10:40 ` Taco Hoekwater
  2005-08-02 10:51   ` \obeyspaces Peter Rolf
  2005-08-02 13:11   ` \obeyspaces Hans Hagen
  2005-08-02 13:09 ` \obeyspaces Hans Hagen
  1 sibling, 2 replies; 7+ messages in thread
From: Taco Hoekwater @ 2005-08-02 10:40 UTC (permalink / raw)




Peter Rolf wrote:
> Hi all,
> 
> I need to pass a short text as parameter to a defintion. My problem is,
> that the significant spaces are removed in this process. Hmm.....no clue.
> 
> 
> % interface=en output=pdftex
> \starttext
> 
> \def\TextWithSpaces#1{\framed{\obeyspaces#1}}%

A two-part solution is needed:

   \def\TextWithSpaces{\bgroup\obeyspaces\doTextWithSpaces}
   \def\doTextWithSpaces#1{\framed{#1}\egroup}

Cheers, Taco

^ permalink raw reply	[flat|nested] 7+ messages in thread

* \obeyspaces
@ 2005-08-02 10:32 Peter Rolf
  2005-08-02 10:40 ` \obeyspaces Taco Hoekwater
  2005-08-02 13:09 ` \obeyspaces Hans Hagen
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Rolf @ 2005-08-02 10:32 UTC (permalink / raw)


Hi all,

I need to pass a short text as parameter to a defintion. My problem is,
that the significant spaces are removed in this process. Hmm.....no clue.


% interface=en output=pdftex
\starttext

\def\TextWithSpaces#1{\framed{\obeyspaces#1}}%

% output is ok
\framed{\obeyspaces{A gap from here      to here!}}
% no big gap between 'here' and 'to'
\TextWithSpaces{A gap from here      to here!}

\stoptext


Any help is welcome.

Greetings,

Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-04-08 11:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-08 11:08 \obeyspaces Herbert Voss
  -- strict thread matches above, loose matches on Subject: below --
2005-08-02 10:32 \obeyspaces Peter Rolf
2005-08-02 10:40 ` \obeyspaces Taco Hoekwater
2005-08-02 10:51   ` \obeyspaces Peter Rolf
2005-08-02 13:11   ` \obeyspaces Hans Hagen
2005-08-02 17:42     ` \obeyspaces Peter Rolf
2005-08-02 13:09 ` \obeyspaces Hans Hagen

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).