After reading the following code [1] from the wiki again I will present here my solution: \def\TextWithSpaces{\framed\bgroup\afterassignment\obeyspaces\let\next} [1] http://wiki.contextgarden.net/Inside_ConTeXt#Passing_verbatim_text_as_macro_... Wolfgang
Am 07.05.2009 um 19:55 schrieb Wolfgang Schuster:
After reading the following code [1] from the wiki again I will present here my solution:
\def\TextWithSpaces{\framed\bgroup\afterassignment\obeyspaces\let \next}
[1] http://wiki.contextgarden.net/Inside_ConTeXt#Passing_verbatim_text_as_macro_...
With a small modification optional arguments are possible. \def\TextWithSpaces#1#{\framed#1\bgroup\afterassignment\obeyspaces \let\next} This allows: \TextWithSpaces{A gap from here to there!} and \TextWithSpaces[foregroundstyle=bold]{A gap from here to there!} Wolfgang
Hi Wolfgang, I appreciate your solution, but it would be much more useful if the solution would be accompanied with a step-by-step explanation of what is going on behind the scenes. A collection of such elegant solutions (together with explanations) would be an invaluable source of knowledge for those of us who want to learn the TeX programming. Bostjan Wolfgang Schuster wrote:
After reading the following code [1] from the wiki again I will present here my solution:
\def\TextWithSpaces{\framed\bgroup\afterassignment\obeyspaces\let\next}
[1] http://wiki.contextgarden.net/Inside_ConTeXt#Passing_verbatim_text_as_macro_...
Wolfgang
Am 08.05.2009 um 11:33 schrieb Bostjan Vesnicer:
Hi Wolfgang,
I appreciate your solution, but it would be much more useful if the solution would be accompanied with a step-by-step explanation of what is going on behind the scenes.
It's magic and mages don't explain their tricks :)
A collection of such elegant solutions (together with explanations) would be an invaluable source of knowledge for those of us who want to learn the TeX programming.
Can you please first take a look in a TeX manual (TeXbook, TeX by Topic or TeX for the impatient) and ask then what you don't understand, for my example look at the explanation of \afterassignment. Wolfgang
participants (2)
-
Bostjan Vesnicer
-
Wolfgang Schuster