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
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
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
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 -----------------------------------------------------------------
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
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 -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Peter Rolf
-
Taco Hoekwater