Skip to main content
fixed inlide code
Source Link
Hendrik Vogt
  • 39.4k
  • 11
  • 141
  • 215

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with   \testcommand{#1} (with spaces before \ and after } ; can't get them to be displayed). Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\ifx\relax#1\relax\else \par \hspace{10pt} \testcommand{#1} \expandafter&\fi} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. && \end{document} 

Note that I used && to indicate the end of the script.

As for your question about \def\textcolor#1#, this makes \textcolor a macro that takes one argument delimited by {. Since the definition is

\def\textcolor#1#{\@textcolor{#1}} 

this means that you can use \textcolor<color-model>{..., and this will expand to \@textcolor{<color-model>}{.... Note that <color-model> acts as an optional argument that mustn't contain {.

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with \testcommand{#1} (with spaces before \ and after }; can't get them to be displayed). Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\ifx\relax#1\relax\else \par \hspace{10pt} \testcommand{#1} \expandafter&\fi} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. && \end{document} 

Note that I used && to indicate the end of the script.

As for your question about \def\textcolor#1#, this makes \textcolor a macro that takes one argument delimited by {. Since the definition is

\def\textcolor#1#{\@textcolor{#1}} 

this means that you can use \textcolor<color-model>{..., and this will expand to \@textcolor{<color-model>}{.... Note that <color-model> acts as an optional argument that mustn't contain {.

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with   \testcommand{#1} . Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\ifx\relax#1\relax\else \par \hspace{10pt} \testcommand{#1} \expandafter&\fi} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. && \end{document} 

Note that I used && to indicate the end of the script.

As for your question about \def\textcolor#1#, this makes \textcolor a macro that takes one argument delimited by {. Since the definition is

\def\textcolor#1#{\@textcolor{#1}} 

this means that you can use \textcolor<color-model>{..., and this will expand to \@textcolor{<color-model>}{.... Note that <color-model> acts as an optional argument that mustn't contain {.

added more explanation
Source Link
Hendrik Vogt
  • 39.4k
  • 11
  • 141
  • 215

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with \testcommand{#1} (with spaces before \ and after }; can't get them to be displayed). Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\ifx\relax#1\relax\else\par\ifx\relax#1\relax\else  \par \hspace{10pt} \testcommand{#1} \expandafter&\fi} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. && \end{document} 

Note that I used && to indicate the end of the script.

As for your question about \def\textcolor#1#, this makes \textcolor a macro that takes one argument delimited by {. Since the definition is

\def\textcolor#1#{\@textcolor{#1}} 

this means that you can use \textcolor<color-model>{..., and this will expand to \@textcolor{<color-model>}{.... Note that <color-model> acts as an optional argument that mustn't contain {.

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with \testcommand{#1} (with spaces before \ and after }; can't get them to be displayed). Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\ifx\relax#1\relax\else\par \hspace{10pt} \testcommand{#1} \expandafter&\fi} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. && \end{document} 

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with \testcommand{#1} (with spaces before \ and after }; can't get them to be displayed). Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\ifx\relax#1\relax\else  \par \hspace{10pt} \testcommand{#1} \expandafter&\fi} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. && \end{document} 

Note that I used && to indicate the end of the script.

As for your question about \def\textcolor#1#, this makes \textcolor a macro that takes one argument delimited by {. Since the definition is

\def\textcolor#1#{\@textcolor{#1}} 

this means that you can use \textcolor<color-model>{..., and this will expand to \@textcolor{<color-model>}{.... Note that <color-model> acts as an optional argument that mustn't contain {.

updated code
Source Link
Hendrik Vogt
  • 39.4k
  • 11
  • 141
  • 215

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with \testcommand{#1} (with spaces before \ and after }; can't get them to be displayed). Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\par\ifx\relax#1\relax\else\par \hspace{10pt} \testcommand{#1} \par \hspace{10pt}\expandafter&\fi} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. && \end{document} 

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with \testcommand{#1} (with spaces before \ and after }; can't get them to be displayed). Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\par \hspace{10pt} \testcommand{#1} \par \hspace{10pt}} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. \end{document} 

Your post somehow gives a too many questions overflow error. Let me try and answer a bit: You just can't pass an argument to a macro by using \testcommand\bgroup <argument>\egroup. This will only pass \bgroup to your \testcommand.

And yes, your definition \def&#1&{ \testcommand{#1} } does exactly this: It looks for the text between the & signs, and &<some text>& will be replaced with \testcommand{#1} (with spaces before \ and after }; can't get them to be displayed). Maybe you're looking for something like this:

\documentclass{article} \def\testcommand#1{(#1)} \catcode`\^=13 \def^#1: {\par \textbf{#1:}} \catcode`\&=13 \def&#1&{\ifx\relax#1\relax\else\par \hspace{10pt} \testcommand{#1} \expandafter&\fi} \begin{document} ^Alice: &Hello Bob. &What's up? ^Bob: &Nothing, really. &Goodbye. && \end{document} 
Source Link
Hendrik Vogt
  • 39.4k
  • 11
  • 141
  • 215
Loading