Commands based on previously defined commands, with fixed values for arguments
How can I define a command by reusing the already defined command? \def \HelloTwo #1#2 {Hello, #1 and #2!} \def \HelloOne #1 {\HelloTwo{#1}{Vedran}} This gives me a "Runaway argument". -- Vedran Miletić
On Sat, 7 Aug 2010 18:03:22 +0200
Vedran Miletić
How can I define a command by reusing the already defined command?
\def \HelloTwo #1#2 {Hello, #1 and #2!} \def \HelloOne #1 {\HelloTwo{#1}{Vedran}}
This gives me a "Runaway argument".
-- Vedran Miletić
where is #2 for HelloTwo ?
___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- René Bastian www.pythoneon.org www.musiques-rb.org http://www.soundsurvey.org.uk/
2010/8/7 R. Bastian
On Sat, 7 Aug 2010 18:03:22 +0200 Vedran Miletić
scribit: How can I define a command by reusing the already defined command?
\def \HelloTwo #1#2 {Hello, #1 and #2!} \def \HelloOne #1 {\HelloTwo{#1}{Vedran}}
This gives me a "Runaway argument".
-- Vedran Miletić
where is #2 for HelloTwo ?
The code \def \HelloOne #1 {\HelloTwo{#1}{Vedran} } compiles. #2 should be fixed to "Vedran", but it comes out empty. -- Vedran Miletić
Even if this is completely unrelated to ConTeXt, allow me to mention this since I find it so funny: The message to which I'm replying has the following weird subject: # Subject: Re: [NTG-context] Commands based on previously defined commands, # DA with fixed values for šrguments Notice the word "DA" at the beginning of the second line, and the word "šrguments"? This was obviously not in Vedran's original message: # Subject: [NTG-context] Commands based on previously defined commands, # with fixed values for arguments Let me venture an explanation about how this happened: when replying to the first message, René's e-mail transformed the subject as such: # Subject: [NTG-context] # =?UTF-8?Q?Re:__Commands_based_on_previously_defined_commands, # =D=A_with_fixed_values_for_=9arguments?= This is quoted-printable, where all the characters but the "basic" ones are quoted using their code point in the current encoding (here UTF-8): hence the end line characters (carriage return + line feed) have been rewritten as =D and =A respectively, in hexadecimal (it's 13 and 10 in decimal), and the tabulation character as =9 (for some reason, there was a tab before the word "arguments"). But this is actually not correct, the character codes should be formatted using two hexadecimal digits (hence =0D, =0A and =09). This is probably why when replying to René, Vedran's e-mail agent has interpreted the "=D" and "=A" sequences as plain 'D' and 'A', and, upon seeing the sequence "=9arguments", it has use the letter 'a' in "arguments" as an exadecimal digit! Which it has interpreted as a Windows-1252 character (Microsoft's extension of latin-1), where 0x9A is 'š', thus producing this rather weird result. This is a particularily disturbing example of mojibake (http://en.wikipedia.org/wiki/Mojibake). Arthur
On Sat, 7 Aug 2010, Vedran Miletić wrote:
How can I define a command by reusing the already defined command?
\def \HelloTwo #1#2 {Hello, #1 and #2!} \def \HelloOne #1 {\HelloTwo{#1}{Vedran}}
This gives me a "Runaway argument".
Can you post a complete example? This works for me \def\HelloTwo#1#2{Hello, #1 and #2!} \def\HelloOne#1{\HelloTwo{#1}{Vedran}} \starttext \HelloOne {One} \stoptext Aditya
2010/8/7 Aditya Mahajan
Can you post a complete example? This works for me
\def\HelloTwo#1#2{Hello, #1 and #2!} \def\HelloOne#1{\HelloTwo{#1}{Vedran}}
\starttext \HelloOne {One} \stoptext
Same here, it works. From what I see, you removed the spacing, and if I add it back it doesn't work again. Are there any rules where the space should be and where it should not? -- Vedran Miletić
Are there any rules where the space should be and where it should not?
The way you wrote the macro originally, the spaces were part of the macro. If you use your original definition of \HelloTwo, you can write \HelloOne as follows: ---- \def \HelloOne #1 {\HelloTwo {#1}{Vedran} } ---- and it works. \GoodByeOne{Arthur}
participants (4)
-
Aditya Mahajan
-
Arthur Reutenauer
-
R. Bastian
-
Vedran Miletić