How do you write a macro that takes arguments containing paragraphs?Add par only if last paragraph did not...

An Undercover Army

Why doesn't "adolescent" take any articles in "listen to adolescent agonising"?

A bug in Excel? Conditional formatting for marking duplicates also highlights unique value

How can you calculate the inverse of signature S, while you cannot do it in ECC to calculate private key from public key?

3.5% Interest Student Loan or use all of my savings on Tuition?

Why aren't there more gauls like Obelix?

Does the in-code argument passing conventions used on PDP-11's have a name?

What is the meaning of option 'by' in TikZ Intersections

Why are special aircraft used for the carriers in the United States Navy?

Was it really inappropriate to write a pull request for the company I interviewed with?

Combination of causative-passive and intransive verb with a direct object?

Where is this quote about overcoming the impossible said in "Interstellar"?

Paper published similar to PhD thesis

Why do we see a rainbow of colors reflected off a CD or DVD?

Why can't we use freedom of speech and expression to incite people to rebel against government in India?

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

Rationale to prefer local variables over instance variables?

Affine transformation of circular arc in 3D

Commonest[] function doesn't actually show commonest elements

Can you run a ground wire from stove directly to ground pole in the ground

Version of C# StringBuilder to allow for strings larger than 2 billion characters

Is every open circuit a capacitor?

In the world of The Matrix, what is "popping"?

Effect of "wrong" driver with slightly long RS-485 stubs



How do you write a macro that takes arguments containing paragraphs?


Add par only if last paragraph did not end with displayed mathHow do you define one macro with arguments inside anotherhow to define newcommand that takes []{} as arguments and not {}{}?TikZ Macro With Multiple ArgumentsHow can I pass expanded material to a macro at definition time (context-specific macro tracker)?Finding out the number of needed macro argumentsHow to create a macro that creates other macros (that takes arguments)?Macro that links JLS paragraphsHow to write a macro that takes a variable number of argumentsHow to create a table macro that takes more than 10 arguments













2















I'm trying to write a macro that takes arguments containing paragraphs. If you write a normal macro and one of its arguments contains a paragraph, it will break:



documentclass{article}
usepackage[utf8]{inputenc}

title{test}

begin{document}

maketitle

section{Introduction}

defmymacro#1{#1}

mymacro{This

contains a paragraph}

end{document}


This produces an error:




Runaway argument?
{This
! Paragraph ended before mymacro was complete.
<to be read again>
par
l.15



So I tried to redefine par for expanding the arguments of the macro, but now it won't stop compiling:



documentclass{article}
usepackage[utf8]{inputenc}

title{test}

begin{document}

maketitle

section{Introduction}

gdefoldpar{par}

defmymacro{gdefpar{}mymacroi}

defmymacroi#1{#1gdefpar{oldpar}}

mymacro{foo

bar}

end{document}









share|improve this question




















  • 6





    Use longdef or newcommand.

    – Phelype Oleinik
    6 hours ago






  • 2





    I recommend defining a new environment instead of a command.

    – JouleV
    6 hours ago











  • @PhelypeOleinik If you make that an answer, I'll accept it. I was so sure that I had written commands in the past whose arguments could span paragraphs. It makes sense now, it was before I started using def instead of newcommnad.

    – sgf
    6 hours ago











  • def is not a latex command, newcommand which, is already allows paragraphs.

    – David Carlisle
    6 hours ago











  • @DavidCarlisle Sometimes I need versions of def. I have no idea how to replicate edef, gdef or xdef with newcommand (which I believe is gdef?). What does it even mean for a tex command not to be a latex command?

    – sgf
    5 hours ago
















2















I'm trying to write a macro that takes arguments containing paragraphs. If you write a normal macro and one of its arguments contains a paragraph, it will break:



documentclass{article}
usepackage[utf8]{inputenc}

title{test}

begin{document}

maketitle

section{Introduction}

defmymacro#1{#1}

mymacro{This

contains a paragraph}

end{document}


This produces an error:




Runaway argument?
{This
! Paragraph ended before mymacro was complete.
<to be read again>
par
l.15



So I tried to redefine par for expanding the arguments of the macro, but now it won't stop compiling:



documentclass{article}
usepackage[utf8]{inputenc}

title{test}

begin{document}

maketitle

section{Introduction}

gdefoldpar{par}

defmymacro{gdefpar{}mymacroi}

defmymacroi#1{#1gdefpar{oldpar}}

mymacro{foo

bar}

end{document}









share|improve this question




















  • 6





    Use longdef or newcommand.

    – Phelype Oleinik
    6 hours ago






  • 2





    I recommend defining a new environment instead of a command.

    – JouleV
    6 hours ago











  • @PhelypeOleinik If you make that an answer, I'll accept it. I was so sure that I had written commands in the past whose arguments could span paragraphs. It makes sense now, it was before I started using def instead of newcommnad.

    – sgf
    6 hours ago











  • def is not a latex command, newcommand which, is already allows paragraphs.

    – David Carlisle
    6 hours ago











  • @DavidCarlisle Sometimes I need versions of def. I have no idea how to replicate edef, gdef or xdef with newcommand (which I believe is gdef?). What does it even mean for a tex command not to be a latex command?

    – sgf
    5 hours ago














2












2








2








I'm trying to write a macro that takes arguments containing paragraphs. If you write a normal macro and one of its arguments contains a paragraph, it will break:



documentclass{article}
usepackage[utf8]{inputenc}

title{test}

begin{document}

maketitle

section{Introduction}

defmymacro#1{#1}

mymacro{This

contains a paragraph}

end{document}


This produces an error:




Runaway argument?
{This
! Paragraph ended before mymacro was complete.
<to be read again>
par
l.15



So I tried to redefine par for expanding the arguments of the macro, but now it won't stop compiling:



documentclass{article}
usepackage[utf8]{inputenc}

title{test}

begin{document}

maketitle

section{Introduction}

gdefoldpar{par}

defmymacro{gdefpar{}mymacroi}

defmymacroi#1{#1gdefpar{oldpar}}

mymacro{foo

bar}

end{document}









share|improve this question
















I'm trying to write a macro that takes arguments containing paragraphs. If you write a normal macro and one of its arguments contains a paragraph, it will break:



documentclass{article}
usepackage[utf8]{inputenc}

title{test}

begin{document}

maketitle

section{Introduction}

defmymacro#1{#1}

mymacro{This

contains a paragraph}

end{document}


This produces an error:




Runaway argument?
{This
! Paragraph ended before mymacro was complete.
<to be read again>
par
l.15



So I tried to redefine par for expanding the arguments of the macro, but now it won't stop compiling:



documentclass{article}
usepackage[utf8]{inputenc}

title{test}

begin{document}

maketitle

section{Introduction}

gdefoldpar{par}

defmymacro{gdefpar{}mymacroi}

defmymacroi#1{#1gdefpar{oldpar}}

mymacro{foo

bar}

end{document}






macros tex-core paragraphs arguments






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 3 hours ago









Phelype Oleinik

23.9k54587




23.9k54587










asked 6 hours ago









sgfsgf

29517




29517








  • 6





    Use longdef or newcommand.

    – Phelype Oleinik
    6 hours ago






  • 2





    I recommend defining a new environment instead of a command.

    – JouleV
    6 hours ago











  • @PhelypeOleinik If you make that an answer, I'll accept it. I was so sure that I had written commands in the past whose arguments could span paragraphs. It makes sense now, it was before I started using def instead of newcommnad.

    – sgf
    6 hours ago











  • def is not a latex command, newcommand which, is already allows paragraphs.

    – David Carlisle
    6 hours ago











  • @DavidCarlisle Sometimes I need versions of def. I have no idea how to replicate edef, gdef or xdef with newcommand (which I believe is gdef?). What does it even mean for a tex command not to be a latex command?

    – sgf
    5 hours ago














  • 6





    Use longdef or newcommand.

    – Phelype Oleinik
    6 hours ago






  • 2





    I recommend defining a new environment instead of a command.

    – JouleV
    6 hours ago











  • @PhelypeOleinik If you make that an answer, I'll accept it. I was so sure that I had written commands in the past whose arguments could span paragraphs. It makes sense now, it was before I started using def instead of newcommnad.

    – sgf
    6 hours ago











  • def is not a latex command, newcommand which, is already allows paragraphs.

    – David Carlisle
    6 hours ago











  • @DavidCarlisle Sometimes I need versions of def. I have no idea how to replicate edef, gdef or xdef with newcommand (which I believe is gdef?). What does it even mean for a tex command not to be a latex command?

    – sgf
    5 hours ago








6




6





Use longdef or newcommand.

– Phelype Oleinik
6 hours ago





Use longdef or newcommand.

– Phelype Oleinik
6 hours ago




2




2





I recommend defining a new environment instead of a command.

– JouleV
6 hours ago





I recommend defining a new environment instead of a command.

– JouleV
6 hours ago













@PhelypeOleinik If you make that an answer, I'll accept it. I was so sure that I had written commands in the past whose arguments could span paragraphs. It makes sense now, it was before I started using def instead of newcommnad.

– sgf
6 hours ago





@PhelypeOleinik If you make that an answer, I'll accept it. I was so sure that I had written commands in the past whose arguments could span paragraphs. It makes sense now, it was before I started using def instead of newcommnad.

– sgf
6 hours ago













def is not a latex command, newcommand which, is already allows paragraphs.

– David Carlisle
6 hours ago





def is not a latex command, newcommand which, is already allows paragraphs.

– David Carlisle
6 hours ago













@DavidCarlisle Sometimes I need versions of def. I have no idea how to replicate edef, gdef or xdef with newcommand (which I believe is gdef?). What does it even mean for a tex command not to be a latex command?

– sgf
5 hours ago





@DavidCarlisle Sometimes I need versions of def. I have no idea how to replicate edef, gdef or xdef with newcommand (which I believe is gdef?). What does it even mean for a tex command not to be a latex command?

– sgf
5 hours ago










1 Answer
1






active

oldest

votes


















8














At the time TeX was written, one page of a document would take several minutes to be processed, and syntax highlighting was not a thing, so it was a good thing to have some mechanism to detect if you forgot a }. A def, by default, doesn't allow a par token unless you explicitly say it's a longdef:



defmymacro#1{#1}


LaTeX, on the other hand, uses that by default, so if you use proper LaTeX commands (def shouldn't be used in LaTeX documents), newcommand makes a longdef by default. If you want a “short” def then you use newcommand*.



xparse returns the short argument default, but lets you define a long macro using the + argument modifier:



NewDocumentCommandmymacro{ m}{#1}% def
NewDocumentCommandmymacro{+m}{#1}% longdef




Your second attempt is clever, and it could have worked except for two things.



First is that you are using gdefoldpar{par} and then gdefpar{oldpar}. Once you expand par you get oldpar which, when expanded, yields par which, when expanded, yields oldpar which, when expanded, yields par which, when expanded, yields oldpar... Running forever :/



You need to use let (or globallet to have global effect) in this case: letoldparpar. This creates an exact copy of par named oldpar which does not depend on what is par.



Second, the runaway argument checking is implemented in a lower level, independent of the definition of par, so this would fail with the same error:



letparrelax
defmymacro#1{#1}
mymacro{foo

bar}


because when TeX sees two endlinechar tokens (which is a space by default) TeX inserts an implicit par token, which raises the Runaway argument error. Knowing that, then:



newcountoldELchar
oldELchar=endlinechar
defmymacro{endlinechar=-1relaxmymacroi}
defmymacroi#1{#1endlinechar=oldELchar}
mymacro{foo

bar}


won't raise an error, but a new line won't be a space anymore.






share|improve this answer
























  • Haha, I was wondering where I went into infinite recursion...

    – sgf
    5 hours ago











  • @sgf You can say, for instance, tracingall before the command you suspect is infinite-looping. You'll get a ton of garbage in the terminal and the log, but it gets easier to find out what is TeX doing.

    – Phelype Oleinik
    5 hours ago











  • I would take a slight difference with the statement "(def shouldn't be used in LaTeX documents)". Certain service routines a user writes may require the special parsing provided by def syntax. I think it would be better to say "(def should be avoided, where possible)".

    – Steven B. Segletes
    5 hours ago






  • 1





    the endlinechar version has to be used with care, for example it also removes the end of line after mymacro (even if there is text following mymacro) not just the one in the argument.

    – David Carlisle
    5 hours ago






  • 1





    tex takes a line at a time and inserts the character specified by endlinechar at the point it grabs the next line at the end of the buffer before tokenizing., so its timing is well defined but er "delicate" :-)

    – David Carlisle
    5 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478189%2fhow-do-you-write-a-macro-that-takes-arguments-containing-paragraphs%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









8














At the time TeX was written, one page of a document would take several minutes to be processed, and syntax highlighting was not a thing, so it was a good thing to have some mechanism to detect if you forgot a }. A def, by default, doesn't allow a par token unless you explicitly say it's a longdef:



defmymacro#1{#1}


LaTeX, on the other hand, uses that by default, so if you use proper LaTeX commands (def shouldn't be used in LaTeX documents), newcommand makes a longdef by default. If you want a “short” def then you use newcommand*.



xparse returns the short argument default, but lets you define a long macro using the + argument modifier:



NewDocumentCommandmymacro{ m}{#1}% def
NewDocumentCommandmymacro{+m}{#1}% longdef




Your second attempt is clever, and it could have worked except for two things.



First is that you are using gdefoldpar{par} and then gdefpar{oldpar}. Once you expand par you get oldpar which, when expanded, yields par which, when expanded, yields oldpar which, when expanded, yields par which, when expanded, yields oldpar... Running forever :/



You need to use let (or globallet to have global effect) in this case: letoldparpar. This creates an exact copy of par named oldpar which does not depend on what is par.



Second, the runaway argument checking is implemented in a lower level, independent of the definition of par, so this would fail with the same error:



letparrelax
defmymacro#1{#1}
mymacro{foo

bar}


because when TeX sees two endlinechar tokens (which is a space by default) TeX inserts an implicit par token, which raises the Runaway argument error. Knowing that, then:



newcountoldELchar
oldELchar=endlinechar
defmymacro{endlinechar=-1relaxmymacroi}
defmymacroi#1{#1endlinechar=oldELchar}
mymacro{foo

bar}


won't raise an error, but a new line won't be a space anymore.






share|improve this answer
























  • Haha, I was wondering where I went into infinite recursion...

    – sgf
    5 hours ago











  • @sgf You can say, for instance, tracingall before the command you suspect is infinite-looping. You'll get a ton of garbage in the terminal and the log, but it gets easier to find out what is TeX doing.

    – Phelype Oleinik
    5 hours ago











  • I would take a slight difference with the statement "(def shouldn't be used in LaTeX documents)". Certain service routines a user writes may require the special parsing provided by def syntax. I think it would be better to say "(def should be avoided, where possible)".

    – Steven B. Segletes
    5 hours ago






  • 1





    the endlinechar version has to be used with care, for example it also removes the end of line after mymacro (even if there is text following mymacro) not just the one in the argument.

    – David Carlisle
    5 hours ago






  • 1





    tex takes a line at a time and inserts the character specified by endlinechar at the point it grabs the next line at the end of the buffer before tokenizing., so its timing is well defined but er "delicate" :-)

    – David Carlisle
    5 hours ago
















8














At the time TeX was written, one page of a document would take several minutes to be processed, and syntax highlighting was not a thing, so it was a good thing to have some mechanism to detect if you forgot a }. A def, by default, doesn't allow a par token unless you explicitly say it's a longdef:



defmymacro#1{#1}


LaTeX, on the other hand, uses that by default, so if you use proper LaTeX commands (def shouldn't be used in LaTeX documents), newcommand makes a longdef by default. If you want a “short” def then you use newcommand*.



xparse returns the short argument default, but lets you define a long macro using the + argument modifier:



NewDocumentCommandmymacro{ m}{#1}% def
NewDocumentCommandmymacro{+m}{#1}% longdef




Your second attempt is clever, and it could have worked except for two things.



First is that you are using gdefoldpar{par} and then gdefpar{oldpar}. Once you expand par you get oldpar which, when expanded, yields par which, when expanded, yields oldpar which, when expanded, yields par which, when expanded, yields oldpar... Running forever :/



You need to use let (or globallet to have global effect) in this case: letoldparpar. This creates an exact copy of par named oldpar which does not depend on what is par.



Second, the runaway argument checking is implemented in a lower level, independent of the definition of par, so this would fail with the same error:



letparrelax
defmymacro#1{#1}
mymacro{foo

bar}


because when TeX sees two endlinechar tokens (which is a space by default) TeX inserts an implicit par token, which raises the Runaway argument error. Knowing that, then:



newcountoldELchar
oldELchar=endlinechar
defmymacro{endlinechar=-1relaxmymacroi}
defmymacroi#1{#1endlinechar=oldELchar}
mymacro{foo

bar}


won't raise an error, but a new line won't be a space anymore.






share|improve this answer
























  • Haha, I was wondering where I went into infinite recursion...

    – sgf
    5 hours ago











  • @sgf You can say, for instance, tracingall before the command you suspect is infinite-looping. You'll get a ton of garbage in the terminal and the log, but it gets easier to find out what is TeX doing.

    – Phelype Oleinik
    5 hours ago











  • I would take a slight difference with the statement "(def shouldn't be used in LaTeX documents)". Certain service routines a user writes may require the special parsing provided by def syntax. I think it would be better to say "(def should be avoided, where possible)".

    – Steven B. Segletes
    5 hours ago






  • 1





    the endlinechar version has to be used with care, for example it also removes the end of line after mymacro (even if there is text following mymacro) not just the one in the argument.

    – David Carlisle
    5 hours ago






  • 1





    tex takes a line at a time and inserts the character specified by endlinechar at the point it grabs the next line at the end of the buffer before tokenizing., so its timing is well defined but er "delicate" :-)

    – David Carlisle
    5 hours ago














8












8








8







At the time TeX was written, one page of a document would take several minutes to be processed, and syntax highlighting was not a thing, so it was a good thing to have some mechanism to detect if you forgot a }. A def, by default, doesn't allow a par token unless you explicitly say it's a longdef:



defmymacro#1{#1}


LaTeX, on the other hand, uses that by default, so if you use proper LaTeX commands (def shouldn't be used in LaTeX documents), newcommand makes a longdef by default. If you want a “short” def then you use newcommand*.



xparse returns the short argument default, but lets you define a long macro using the + argument modifier:



NewDocumentCommandmymacro{ m}{#1}% def
NewDocumentCommandmymacro{+m}{#1}% longdef




Your second attempt is clever, and it could have worked except for two things.



First is that you are using gdefoldpar{par} and then gdefpar{oldpar}. Once you expand par you get oldpar which, when expanded, yields par which, when expanded, yields oldpar which, when expanded, yields par which, when expanded, yields oldpar... Running forever :/



You need to use let (or globallet to have global effect) in this case: letoldparpar. This creates an exact copy of par named oldpar which does not depend on what is par.



Second, the runaway argument checking is implemented in a lower level, independent of the definition of par, so this would fail with the same error:



letparrelax
defmymacro#1{#1}
mymacro{foo

bar}


because when TeX sees two endlinechar tokens (which is a space by default) TeX inserts an implicit par token, which raises the Runaway argument error. Knowing that, then:



newcountoldELchar
oldELchar=endlinechar
defmymacro{endlinechar=-1relaxmymacroi}
defmymacroi#1{#1endlinechar=oldELchar}
mymacro{foo

bar}


won't raise an error, but a new line won't be a space anymore.






share|improve this answer













At the time TeX was written, one page of a document would take several minutes to be processed, and syntax highlighting was not a thing, so it was a good thing to have some mechanism to detect if you forgot a }. A def, by default, doesn't allow a par token unless you explicitly say it's a longdef:



defmymacro#1{#1}


LaTeX, on the other hand, uses that by default, so if you use proper LaTeX commands (def shouldn't be used in LaTeX documents), newcommand makes a longdef by default. If you want a “short” def then you use newcommand*.



xparse returns the short argument default, but lets you define a long macro using the + argument modifier:



NewDocumentCommandmymacro{ m}{#1}% def
NewDocumentCommandmymacro{+m}{#1}% longdef




Your second attempt is clever, and it could have worked except for two things.



First is that you are using gdefoldpar{par} and then gdefpar{oldpar}. Once you expand par you get oldpar which, when expanded, yields par which, when expanded, yields oldpar which, when expanded, yields par which, when expanded, yields oldpar... Running forever :/



You need to use let (or globallet to have global effect) in this case: letoldparpar. This creates an exact copy of par named oldpar which does not depend on what is par.



Second, the runaway argument checking is implemented in a lower level, independent of the definition of par, so this would fail with the same error:



letparrelax
defmymacro#1{#1}
mymacro{foo

bar}


because when TeX sees two endlinechar tokens (which is a space by default) TeX inserts an implicit par token, which raises the Runaway argument error. Knowing that, then:



newcountoldELchar
oldELchar=endlinechar
defmymacro{endlinechar=-1relaxmymacroi}
defmymacroi#1{#1endlinechar=oldELchar}
mymacro{foo

bar}


won't raise an error, but a new line won't be a space anymore.







share|improve this answer












share|improve this answer



share|improve this answer










answered 5 hours ago









Phelype OleinikPhelype Oleinik

23.9k54587




23.9k54587













  • Haha, I was wondering where I went into infinite recursion...

    – sgf
    5 hours ago











  • @sgf You can say, for instance, tracingall before the command you suspect is infinite-looping. You'll get a ton of garbage in the terminal and the log, but it gets easier to find out what is TeX doing.

    – Phelype Oleinik
    5 hours ago











  • I would take a slight difference with the statement "(def shouldn't be used in LaTeX documents)". Certain service routines a user writes may require the special parsing provided by def syntax. I think it would be better to say "(def should be avoided, where possible)".

    – Steven B. Segletes
    5 hours ago






  • 1





    the endlinechar version has to be used with care, for example it also removes the end of line after mymacro (even if there is text following mymacro) not just the one in the argument.

    – David Carlisle
    5 hours ago






  • 1





    tex takes a line at a time and inserts the character specified by endlinechar at the point it grabs the next line at the end of the buffer before tokenizing., so its timing is well defined but er "delicate" :-)

    – David Carlisle
    5 hours ago



















  • Haha, I was wondering where I went into infinite recursion...

    – sgf
    5 hours ago











  • @sgf You can say, for instance, tracingall before the command you suspect is infinite-looping. You'll get a ton of garbage in the terminal and the log, but it gets easier to find out what is TeX doing.

    – Phelype Oleinik
    5 hours ago











  • I would take a slight difference with the statement "(def shouldn't be used in LaTeX documents)". Certain service routines a user writes may require the special parsing provided by def syntax. I think it would be better to say "(def should be avoided, where possible)".

    – Steven B. Segletes
    5 hours ago






  • 1





    the endlinechar version has to be used with care, for example it also removes the end of line after mymacro (even if there is text following mymacro) not just the one in the argument.

    – David Carlisle
    5 hours ago






  • 1





    tex takes a line at a time and inserts the character specified by endlinechar at the point it grabs the next line at the end of the buffer before tokenizing., so its timing is well defined but er "delicate" :-)

    – David Carlisle
    5 hours ago

















Haha, I was wondering where I went into infinite recursion...

– sgf
5 hours ago





Haha, I was wondering where I went into infinite recursion...

– sgf
5 hours ago













@sgf You can say, for instance, tracingall before the command you suspect is infinite-looping. You'll get a ton of garbage in the terminal and the log, but it gets easier to find out what is TeX doing.

– Phelype Oleinik
5 hours ago





@sgf You can say, for instance, tracingall before the command you suspect is infinite-looping. You'll get a ton of garbage in the terminal and the log, but it gets easier to find out what is TeX doing.

– Phelype Oleinik
5 hours ago













I would take a slight difference with the statement "(def shouldn't be used in LaTeX documents)". Certain service routines a user writes may require the special parsing provided by def syntax. I think it would be better to say "(def should be avoided, where possible)".

– Steven B. Segletes
5 hours ago





I would take a slight difference with the statement "(def shouldn't be used in LaTeX documents)". Certain service routines a user writes may require the special parsing provided by def syntax. I think it would be better to say "(def should be avoided, where possible)".

– Steven B. Segletes
5 hours ago




1




1





the endlinechar version has to be used with care, for example it also removes the end of line after mymacro (even if there is text following mymacro) not just the one in the argument.

– David Carlisle
5 hours ago





the endlinechar version has to be used with care, for example it also removes the end of line after mymacro (even if there is text following mymacro) not just the one in the argument.

– David Carlisle
5 hours ago




1




1





tex takes a line at a time and inserts the character specified by endlinechar at the point it grabs the next line at the end of the buffer before tokenizing., so its timing is well defined but er "delicate" :-)

– David Carlisle
5 hours ago





tex takes a line at a time and inserts the character specified by endlinechar at the point it grabs the next line at the end of the buffer before tokenizing., so its timing is well defined but er "delicate" :-)

– David Carlisle
5 hours ago


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478189%2fhow-do-you-write-a-macro-that-takes-arguments-containing-paragraphs%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

Castillo d'Acher Características Menú de navegación

Connecting two nodes from the same mother node horizontallyTikZ: What EXACTLY does the the |- notation for...