Runaway-argument error message when line break occurs inside argument of a macroHow does italic correction...

Algorithm that spans orthogonal vectors: Python

How to deal with my team leader who keeps calling me about project updates even though I am on leave for personal reasons?

Did HaShem ever command a Navi (Prophet) to break a law?

Hilbert's hotel, why can't I repeat it infinitely many times?

Figuring out the frequency components using FFT

What did the controller say during my approach to land (audio clip)?

Nanomachines exist that enable Axolotl-levels of regeneration - So how can crippling injuries exist as well?

Leaving a job that I just took based on false promise of a raise. What do I tell future interviewers?

Do the villains know Batman has no superpowers?

Is there any actual security benefit to restricting foreign IPs?

How to reference parameters outside of Apex Class that can be configured by Administrator

How do rulers get rich from war?

GitHub repo with Apache License version 2 in package.json, but no full license copy nor comment headers

Wired to Wireless Doorbell

I reverse the source code, you negate the input!

How does one calculate the distribution of the Matt Colville way of rolling stats?

What is the fastest way to do Array Table Lookup with an Integer Index?

Can Bless or Bardic Inspiration help a creature from rolling a 1 on a death save?

Do liquid propellant rocket engines experience thrust oscillation?

Why there so many pitch control surfaces on the Piaggio P180 Avanti?

What can a pilot do if an air traffic controller is incapacitated?

In a jam session, when asked which key my non-transposing instrument (like a violin) is in, what do I answer?

Can someone explain to me the parameters of a lognormal distribution?

How is the problem, {⟨G⟩|G has no triangle} in Logspace?



Runaway-argument error message when line break occurs inside argument of a macro


How does italic correction work?Use column-separator & (ampersand) inside newenvironmentPassing arguments to def inside newcommand (TikZ/PGF)Runaway argument error when creating a macro for code that works outside a macroCompiler Error when Creating a Macro/EnvironmentWhat's wrong with my newcommand?Detect duplicates csnames defined via csdefRunaway argument? with defMacro that takes any latex code as an argument






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







6















I'm having trouble with my newcommand when I have a linebreak inside the argument, it is defined as:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
end{document}


The first call is OK, the second call gives me the Runaway argument error and the result is the following:



 bbbb}{xxxx} 
% ^^ up here "Runaway argument"


with error



When I espected some thing like



expectation










share|improve this question









New contributor



LucasT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

















  • 1





    textbf forwards its argument to text@command, which is declared as a short macro, so it can't contain a par in its argument. You can circumvent this by using endgraf instead of the two consecutive newlines, but I don't think it is a good idea and you should change your macro if you want to have a newline there.

    – Skillmon
    19 hours ago






  • 1





    And welcome to TeX.SX!

    – Skillmon
    19 hours ago








  • 1





    Thanks Skillmon, kind of you. I am not used to 'low level' tricks like you are commenting. How should I change my macro to get the right result? Can you gime some directions to undestand its limitations? How can I start to study it?

    – LucasT
    19 hours ago








  • 1





    @LucasT important to note is that there is a slight difference in {<fontswitch> #1} to <textcommand>{#1}, the former doesn't apply any italic correction whereas the latter would (though this shouldn't be an issue for textbf, it could for textit).

    – Skillmon
    19 hours ago






  • 1





    @Rmano LaTeX goes to some length to apply it correctly (and I don't know the entire code it runs to determine the italic correction), but with normal text / should be correct (it's dependent on the current font and the last symbol in #1 and might be dependent on the next symbol in the following text).

    – Skillmon
    18 hours ago


















6















I'm having trouble with my newcommand when I have a linebreak inside the argument, it is defined as:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
end{document}


The first call is OK, the second call gives me the Runaway argument error and the result is the following:



 bbbb}{xxxx} 
% ^^ up here "Runaway argument"


with error



When I espected some thing like



expectation










share|improve this question









New contributor



LucasT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

















  • 1





    textbf forwards its argument to text@command, which is declared as a short macro, so it can't contain a par in its argument. You can circumvent this by using endgraf instead of the two consecutive newlines, but I don't think it is a good idea and you should change your macro if you want to have a newline there.

    – Skillmon
    19 hours ago






  • 1





    And welcome to TeX.SX!

    – Skillmon
    19 hours ago








  • 1





    Thanks Skillmon, kind of you. I am not used to 'low level' tricks like you are commenting. How should I change my macro to get the right result? Can you gime some directions to undestand its limitations? How can I start to study it?

    – LucasT
    19 hours ago








  • 1





    @LucasT important to note is that there is a slight difference in {<fontswitch> #1} to <textcommand>{#1}, the former doesn't apply any italic correction whereas the latter would (though this shouldn't be an issue for textbf, it could for textit).

    – Skillmon
    19 hours ago






  • 1





    @Rmano LaTeX goes to some length to apply it correctly (and I don't know the entire code it runs to determine the italic correction), but with normal text / should be correct (it's dependent on the current font and the last symbol in #1 and might be dependent on the next symbol in the following text).

    – Skillmon
    18 hours ago














6












6








6








I'm having trouble with my newcommand when I have a linebreak inside the argument, it is defined as:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
end{document}


The first call is OK, the second call gives me the Runaway argument error and the result is the following:



 bbbb}{xxxx} 
% ^^ up here "Runaway argument"


with error



When I espected some thing like



expectation










share|improve this question









New contributor



LucasT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm having trouble with my newcommand when I have a linebreak inside the argument, it is defined as:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
end{document}


The first call is OK, the second call gives me the Runaway argument error and the result is the following:



 bbbb}{xxxx} 
% ^^ up here "Runaway argument"


with error



When I espected some thing like



expectation







macros arguments






share|improve this question









New contributor



LucasT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



LucasT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 19 hours ago









Mico

305k33 gold badges421 silver badges830 bronze badges




305k33 gold badges421 silver badges830 bronze badges






New contributor



LucasT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 19 hours ago









LucasTLucasT

312 bronze badges




312 bronze badges




New contributor



LucasT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




LucasT is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • 1





    textbf forwards its argument to text@command, which is declared as a short macro, so it can't contain a par in its argument. You can circumvent this by using endgraf instead of the two consecutive newlines, but I don't think it is a good idea and you should change your macro if you want to have a newline there.

    – Skillmon
    19 hours ago






  • 1





    And welcome to TeX.SX!

    – Skillmon
    19 hours ago








  • 1





    Thanks Skillmon, kind of you. I am not used to 'low level' tricks like you are commenting. How should I change my macro to get the right result? Can you gime some directions to undestand its limitations? How can I start to study it?

    – LucasT
    19 hours ago








  • 1





    @LucasT important to note is that there is a slight difference in {<fontswitch> #1} to <textcommand>{#1}, the former doesn't apply any italic correction whereas the latter would (though this shouldn't be an issue for textbf, it could for textit).

    – Skillmon
    19 hours ago






  • 1





    @Rmano LaTeX goes to some length to apply it correctly (and I don't know the entire code it runs to determine the italic correction), but with normal text / should be correct (it's dependent on the current font and the last symbol in #1 and might be dependent on the next symbol in the following text).

    – Skillmon
    18 hours ago














  • 1





    textbf forwards its argument to text@command, which is declared as a short macro, so it can't contain a par in its argument. You can circumvent this by using endgraf instead of the two consecutive newlines, but I don't think it is a good idea and you should change your macro if you want to have a newline there.

    – Skillmon
    19 hours ago






  • 1





    And welcome to TeX.SX!

    – Skillmon
    19 hours ago








  • 1





    Thanks Skillmon, kind of you. I am not used to 'low level' tricks like you are commenting. How should I change my macro to get the right result? Can you gime some directions to undestand its limitations? How can I start to study it?

    – LucasT
    19 hours ago








  • 1





    @LucasT important to note is that there is a slight difference in {<fontswitch> #1} to <textcommand>{#1}, the former doesn't apply any italic correction whereas the latter would (though this shouldn't be an issue for textbf, it could for textit).

    – Skillmon
    19 hours ago






  • 1





    @Rmano LaTeX goes to some length to apply it correctly (and I don't know the entire code it runs to determine the italic correction), but with normal text / should be correct (it's dependent on the current font and the last symbol in #1 and might be dependent on the next symbol in the following text).

    – Skillmon
    18 hours ago








1




1





textbf forwards its argument to text@command, which is declared as a short macro, so it can't contain a par in its argument. You can circumvent this by using endgraf instead of the two consecutive newlines, but I don't think it is a good idea and you should change your macro if you want to have a newline there.

– Skillmon
19 hours ago





textbf forwards its argument to text@command, which is declared as a short macro, so it can't contain a par in its argument. You can circumvent this by using endgraf instead of the two consecutive newlines, but I don't think it is a good idea and you should change your macro if you want to have a newline there.

– Skillmon
19 hours ago




1




1





And welcome to TeX.SX!

– Skillmon
19 hours ago







And welcome to TeX.SX!

– Skillmon
19 hours ago






1




1





Thanks Skillmon, kind of you. I am not used to 'low level' tricks like you are commenting. How should I change my macro to get the right result? Can you gime some directions to undestand its limitations? How can I start to study it?

– LucasT
19 hours ago







Thanks Skillmon, kind of you. I am not used to 'low level' tricks like you are commenting. How should I change my macro to get the right result? Can you gime some directions to undestand its limitations? How can I start to study it?

– LucasT
19 hours ago






1




1





@LucasT important to note is that there is a slight difference in {<fontswitch> #1} to <textcommand>{#1}, the former doesn't apply any italic correction whereas the latter would (though this shouldn't be an issue for textbf, it could for textit).

– Skillmon
19 hours ago





@LucasT important to note is that there is a slight difference in {<fontswitch> #1} to <textcommand>{#1}, the former doesn't apply any italic correction whereas the latter would (though this shouldn't be an issue for textbf, it could for textit).

– Skillmon
19 hours ago




1




1





@Rmano LaTeX goes to some length to apply it correctly (and I don't know the entire code it runs to determine the italic correction), but with normal text / should be correct (it's dependent on the current font and the last symbol in #1 and might be dependent on the next symbol in the following text).

– Skillmon
18 hours ago





@Rmano LaTeX goes to some length to apply it correctly (and I don't know the entire code it runs to determine the italic correction), but with normal text / should be correct (it's dependent on the current font and the last symbol in #1 and might be dependent on the next symbol in the following text).

– Skillmon
18 hours ago










2 Answers
2






active

oldest

votes


















7
















As suggested in comments, textbf is designed for short things --- not paragraphs. You can just change to a font-selection command:



documentclass{report}
newcommand{noblablabla}[2]{{bfseries #1/}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
% no more "Runaway argument"
end{document}


...look carefully at the { placement ;-).



The / will perform italic correction if necessary (shouldn't be necessary with a bold typeface, but it is font-dependent); thanks to @Skillmon for pointing it out.



output of the code snippet






share|improve this answer




























  • @Mico sorry, I posted the answer before seeing your comment...

    – Rmano
    19 hours ago






  • 1





    No worries! Anyway, providing a standalone answer is considered better form anyway.

    – Mico
    19 hours ago



















2
















When (La)TeX reads and tokenizes input under standard catcode-régime with standard-value for the integer-parameter endlinechar, two consecutive endline-characters—in the .tex-input file they yield an empty line—get tokenized as the token par which usually serves for ending the current paragraph (and having (La)TeX start a new paragraph in case material which triggers switching to horizontal mode follows).



In (La)TeX macros come in two flavours:




  1. Macros where the token par is allowed in the arguments. These are so-called "long macros" because when you wish to define such a macro by means of TeX primitives like def or edef or gdef or xdef, you need to add the prefix long to the definition-primitive in use.

  2. Macros where the token par is not allowed in the arguments. Many people call them "short macros" because when defining them you omit the long-prefix. When an argument of a short macro contains the token par, then you get an error-message about "Runaway argument?... Paragraph ended before ... was complete".


textbf is defined to call such a such a "short" macro whose name is text@command, and to pass its argument as argument to that macro. Therefore the error message. You can easily circumvent that message by not having the token par within the argument and instead having, e.g., the token sequence csname parendcsname in the argument, or the token myparcopy after letmyparcopy=par:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaacsname parendcsname bbbb}{xxxx}
end{document}



documentclass{report}
newcommandmyparcopy{}letmyparcopy=par
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaamyparcopy bbbb}{xxxx}
end{document}





share|improve this answer




























  • LaTeX and Plain already have a myparcopy under the name endgraf

    – Phelype Oleinik
    3 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/4.0/"u003ecc by-sa 4.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
});


}
});







LucasT is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded
















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f508773%2frunaway-argument-error-message-when-line-break-occurs-inside-argument-of-a-macro%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









7
















As suggested in comments, textbf is designed for short things --- not paragraphs. You can just change to a font-selection command:



documentclass{report}
newcommand{noblablabla}[2]{{bfseries #1/}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
% no more "Runaway argument"
end{document}


...look carefully at the { placement ;-).



The / will perform italic correction if necessary (shouldn't be necessary with a bold typeface, but it is font-dependent); thanks to @Skillmon for pointing it out.



output of the code snippet






share|improve this answer




























  • @Mico sorry, I posted the answer before seeing your comment...

    – Rmano
    19 hours ago






  • 1





    No worries! Anyway, providing a standalone answer is considered better form anyway.

    – Mico
    19 hours ago
















7
















As suggested in comments, textbf is designed for short things --- not paragraphs. You can just change to a font-selection command:



documentclass{report}
newcommand{noblablabla}[2]{{bfseries #1/}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
% no more "Runaway argument"
end{document}


...look carefully at the { placement ;-).



The / will perform italic correction if necessary (shouldn't be necessary with a bold typeface, but it is font-dependent); thanks to @Skillmon for pointing it out.



output of the code snippet






share|improve this answer




























  • @Mico sorry, I posted the answer before seeing your comment...

    – Rmano
    19 hours ago






  • 1





    No worries! Anyway, providing a standalone answer is considered better form anyway.

    – Mico
    19 hours ago














7














7










7









As suggested in comments, textbf is designed for short things --- not paragraphs. You can just change to a font-selection command:



documentclass{report}
newcommand{noblablabla}[2]{{bfseries #1/}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
% no more "Runaway argument"
end{document}


...look carefully at the { placement ;-).



The / will perform italic correction if necessary (shouldn't be necessary with a bold typeface, but it is font-dependent); thanks to @Skillmon for pointing it out.



output of the code snippet






share|improve this answer















As suggested in comments, textbf is designed for short things --- not paragraphs. You can just change to a font-selection command:



documentclass{report}
newcommand{noblablabla}[2]{{bfseries #1/}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaa

bbbb}{xxxx}
% no more "Runaway argument"
end{document}


...look carefully at the { placement ;-).



The / will perform italic correction if necessary (shouldn't be necessary with a bold typeface, but it is font-dependent); thanks to @Skillmon for pointing it out.



output of the code snippet







share|improve this answer














share|improve this answer



share|improve this answer








edited 16 hours ago

























answered 19 hours ago









RmanoRmano

10.5k2 gold badges18 silver badges57 bronze badges




10.5k2 gold badges18 silver badges57 bronze badges
















  • @Mico sorry, I posted the answer before seeing your comment...

    – Rmano
    19 hours ago






  • 1





    No worries! Anyway, providing a standalone answer is considered better form anyway.

    – Mico
    19 hours ago



















  • @Mico sorry, I posted the answer before seeing your comment...

    – Rmano
    19 hours ago






  • 1





    No worries! Anyway, providing a standalone answer is considered better form anyway.

    – Mico
    19 hours ago

















@Mico sorry, I posted the answer before seeing your comment...

– Rmano
19 hours ago





@Mico sorry, I posted the answer before seeing your comment...

– Rmano
19 hours ago




1




1





No worries! Anyway, providing a standalone answer is considered better form anyway.

– Mico
19 hours ago





No worries! Anyway, providing a standalone answer is considered better form anyway.

– Mico
19 hours ago













2
















When (La)TeX reads and tokenizes input under standard catcode-régime with standard-value for the integer-parameter endlinechar, two consecutive endline-characters—in the .tex-input file they yield an empty line—get tokenized as the token par which usually serves for ending the current paragraph (and having (La)TeX start a new paragraph in case material which triggers switching to horizontal mode follows).



In (La)TeX macros come in two flavours:




  1. Macros where the token par is allowed in the arguments. These are so-called "long macros" because when you wish to define such a macro by means of TeX primitives like def or edef or gdef or xdef, you need to add the prefix long to the definition-primitive in use.

  2. Macros where the token par is not allowed in the arguments. Many people call them "short macros" because when defining them you omit the long-prefix. When an argument of a short macro contains the token par, then you get an error-message about "Runaway argument?... Paragraph ended before ... was complete".


textbf is defined to call such a such a "short" macro whose name is text@command, and to pass its argument as argument to that macro. Therefore the error message. You can easily circumvent that message by not having the token par within the argument and instead having, e.g., the token sequence csname parendcsname in the argument, or the token myparcopy after letmyparcopy=par:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaacsname parendcsname bbbb}{xxxx}
end{document}



documentclass{report}
newcommandmyparcopy{}letmyparcopy=par
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaamyparcopy bbbb}{xxxx}
end{document}





share|improve this answer




























  • LaTeX and Plain already have a myparcopy under the name endgraf

    – Phelype Oleinik
    3 hours ago
















2
















When (La)TeX reads and tokenizes input under standard catcode-régime with standard-value for the integer-parameter endlinechar, two consecutive endline-characters—in the .tex-input file they yield an empty line—get tokenized as the token par which usually serves for ending the current paragraph (and having (La)TeX start a new paragraph in case material which triggers switching to horizontal mode follows).



In (La)TeX macros come in two flavours:




  1. Macros where the token par is allowed in the arguments. These are so-called "long macros" because when you wish to define such a macro by means of TeX primitives like def or edef or gdef or xdef, you need to add the prefix long to the definition-primitive in use.

  2. Macros where the token par is not allowed in the arguments. Many people call them "short macros" because when defining them you omit the long-prefix. When an argument of a short macro contains the token par, then you get an error-message about "Runaway argument?... Paragraph ended before ... was complete".


textbf is defined to call such a such a "short" macro whose name is text@command, and to pass its argument as argument to that macro. Therefore the error message. You can easily circumvent that message by not having the token par within the argument and instead having, e.g., the token sequence csname parendcsname in the argument, or the token myparcopy after letmyparcopy=par:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaacsname parendcsname bbbb}{xxxx}
end{document}



documentclass{report}
newcommandmyparcopy{}letmyparcopy=par
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaamyparcopy bbbb}{xxxx}
end{document}





share|improve this answer




























  • LaTeX and Plain already have a myparcopy under the name endgraf

    – Phelype Oleinik
    3 hours ago














2














2










2









When (La)TeX reads and tokenizes input under standard catcode-régime with standard-value for the integer-parameter endlinechar, two consecutive endline-characters—in the .tex-input file they yield an empty line—get tokenized as the token par which usually serves for ending the current paragraph (and having (La)TeX start a new paragraph in case material which triggers switching to horizontal mode follows).



In (La)TeX macros come in two flavours:




  1. Macros where the token par is allowed in the arguments. These are so-called "long macros" because when you wish to define such a macro by means of TeX primitives like def or edef or gdef or xdef, you need to add the prefix long to the definition-primitive in use.

  2. Macros where the token par is not allowed in the arguments. Many people call them "short macros" because when defining them you omit the long-prefix. When an argument of a short macro contains the token par, then you get an error-message about "Runaway argument?... Paragraph ended before ... was complete".


textbf is defined to call such a such a "short" macro whose name is text@command, and to pass its argument as argument to that macro. Therefore the error message. You can easily circumvent that message by not having the token par within the argument and instead having, e.g., the token sequence csname parendcsname in the argument, or the token myparcopy after letmyparcopy=par:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaacsname parendcsname bbbb}{xxxx}
end{document}



documentclass{report}
newcommandmyparcopy{}letmyparcopy=par
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaamyparcopy bbbb}{xxxx}
end{document}





share|improve this answer















When (La)TeX reads and tokenizes input under standard catcode-régime with standard-value for the integer-parameter endlinechar, two consecutive endline-characters—in the .tex-input file they yield an empty line—get tokenized as the token par which usually serves for ending the current paragraph (and having (La)TeX start a new paragraph in case material which triggers switching to horizontal mode follows).



In (La)TeX macros come in two flavours:




  1. Macros where the token par is allowed in the arguments. These are so-called "long macros" because when you wish to define such a macro by means of TeX primitives like def or edef or gdef or xdef, you need to add the prefix long to the definition-primitive in use.

  2. Macros where the token par is not allowed in the arguments. Many people call them "short macros" because when defining them you omit the long-prefix. When an argument of a short macro contains the token par, then you get an error-message about "Runaway argument?... Paragraph ended before ... was complete".


textbf is defined to call such a such a "short" macro whose name is text@command, and to pass its argument as argument to that macro. Therefore the error message. You can easily circumvent that message by not having the token par within the argument and instead having, e.g., the token sequence csname parendcsname in the argument, or the token myparcopy after letmyparcopy=par:



documentclass{report}
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaacsname parendcsname bbbb}{xxxx}
end{document}



documentclass{report}
newcommandmyparcopy{}letmyparcopy=par
newcommand{noblablabla}[2]{textbf{#1}-#2}
begin{document}

noblablabla{aaaabbbb}{xxxx} % this is OK

noblablabla{aaaamyparcopy bbbb}{xxxx}
end{document}






share|improve this answer














share|improve this answer



share|improve this answer








edited 3 hours ago

























answered 4 hours ago









Ulrich DiezUlrich Diez

7,1896 silver badges23 bronze badges




7,1896 silver badges23 bronze badges
















  • LaTeX and Plain already have a myparcopy under the name endgraf

    – Phelype Oleinik
    3 hours ago



















  • LaTeX and Plain already have a myparcopy under the name endgraf

    – Phelype Oleinik
    3 hours ago

















LaTeX and Plain already have a myparcopy under the name endgraf

– Phelype Oleinik
3 hours ago





LaTeX and Plain already have a myparcopy under the name endgraf

– Phelype Oleinik
3 hours ago











LucasT is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded

















LucasT is a new contributor. Be nice, and check out our Code of Conduct.













LucasT is a new contributor. Be nice, and check out our Code of Conduct.












LucasT is a new contributor. Be nice, and check out our Code of Conduct.
















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%2f508773%2frunaway-argument-error-message-when-line-break-occurs-inside-argument-of-a-macro%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

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...