Why does tag require braces while frac doesn't?Macros with # as the last parameter“Grab to #{” macro argumentsWhy do people use unnecessary braces?Why does TeX remove braces around delimited arguments?Why are text format commands used inside braces?Why don't the curly braces and the mid bar become bigger?Reference equations with eqref while using different tag forms throughout documentWhy does verb take its argument between pipes || rather than braces ?Why fraction (with power) in fraction doesn't work?Why does the equation tag moves when using `hspace`?Why enclose a verb block with curly braces?Why do large and textbf require different usage of braces?

Ghidra: Prepend memory segment in assembly listing view

Are the players on the same team as the DM?

Why do banks “park” their money at the European Central Bank?

Book with the Latin quote 'nihil superbus' meaning 'nothing above us'

Billiard balls collision

Where can/should I, as a high schooler, publish a paper regarding the derivation of a formula?

How to gently end involvement with an online community?

"Opusculum hoc, quamdiu vixero, doctioribus emendandum offero."?

Add 2 new columns to existing dataframe using apply

What names do Cormyr's people use?

I don't have the theoretical background in my PhD topic. I can't justify getting the degree

What stops you from using fixed income in developing countries?

Handling Disruptive Student on the Autism Spectrum

Prison offence - trespassing underwood fence

Boot Windows from SAN

"There were either twelve sexes or none."

Very slow boot time and poor perfomance

The Wires Underground

Nothing like a good ol' game of ModTen

Does this VCO produce a sine wave or square wave

Hangman game in Python - need feedback on the quality of code

Discussing work with supervisor in an invited dinner with his family

Should I stick with American terminology in my English set young adult book?

Duplicate instruments in unison in an orchestra



Why does tag require braces while frac doesn't?


Macros with # as the last parameter“Grab to #{” macro argumentsWhy do people use unnecessary braces?Why does TeX remove braces around delimited arguments?Why are text format commands used inside braces?Why don't the curly braces and the mid bar become bigger?Reference equations with eqref while using different tag forms throughout documentWhy does verb take its argument between pipes || rather than braces ?Why fraction (with power) in fraction doesn't work?Why does the equation tag moves when using `hspace`?Why enclose a verb block with curly braces?Why do large and textbf require different usage of braces?






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








8















I'm used to using tag without braces like tag3 instead of tag3 in Markdown+MathJax, where it works as fine as does frac12 in normal LaTeX. But when I tried to do this in a real .tex source processed with pdflatex, I got some errors.



Here's the code:



documentclass[]article
usepackageamsmath
begindocument

[f(x)=frac32tag1]

enddocument


And this is what pdflatex says




This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex)
restricted write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
No file test.aux.
Runaway argument?
1]
! Paragraph ended before tag was complete.
<to be read again>
par
l.6



When I surround the 1 with braces, it compiles fine, and I get the expected PDF output.
So I wonder, why does tag require braces while frac doesn't? Is there some difference in "type" of the object, like e.g. tag being a package-supplied facility while frac is from the language core (doesn't need usepackage at least) or something like that?










share|improve this question



















  • 7





    yes they are differently defined. Better don't be lazy and avoid argument braces -- as you can see it can break.

    – Ulrike Fischer
    Aug 13 at 12:07

















8















I'm used to using tag without braces like tag3 instead of tag3 in Markdown+MathJax, where it works as fine as does frac12 in normal LaTeX. But when I tried to do this in a real .tex source processed with pdflatex, I got some errors.



Here's the code:



documentclass[]article
usepackageamsmath
begindocument

[f(x)=frac32tag1]

enddocument


And this is what pdflatex says




This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex)
restricted write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
No file test.aux.
Runaway argument?
1]
! Paragraph ended before tag was complete.
<to be read again>
par
l.6



When I surround the 1 with braces, it compiles fine, and I get the expected PDF output.
So I wonder, why does tag require braces while frac doesn't? Is there some difference in "type" of the object, like e.g. tag being a package-supplied facility while frac is from the language core (doesn't need usepackage at least) or something like that?










share|improve this question



















  • 7





    yes they are differently defined. Better don't be lazy and avoid argument braces -- as you can see it can break.

    – Ulrike Fischer
    Aug 13 at 12:07













8












8








8








I'm used to using tag without braces like tag3 instead of tag3 in Markdown+MathJax, where it works as fine as does frac12 in normal LaTeX. But when I tried to do this in a real .tex source processed with pdflatex, I got some errors.



Here's the code:



documentclass[]article
usepackageamsmath
begindocument

[f(x)=frac32tag1]

enddocument


And this is what pdflatex says




This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex)
restricted write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
No file test.aux.
Runaway argument?
1]
! Paragraph ended before tag was complete.
<to be read again>
par
l.6



When I surround the 1 with braces, it compiles fine, and I get the expected PDF output.
So I wonder, why does tag require braces while frac doesn't? Is there some difference in "type" of the object, like e.g. tag being a package-supplied facility while frac is from the language core (doesn't need usepackage at least) or something like that?










share|improve this question














I'm used to using tag without braces like tag3 instead of tag3 in Markdown+MathJax, where it works as fine as does frac12 in normal LaTeX. But when I tried to do this in a real .tex source processed with pdflatex, I got some errors.



Here's the code:



documentclass[]article
usepackageamsmath
begindocument

[f(x)=frac32tag1]

enddocument


And this is what pdflatex says




This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex)
restricted write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
No file test.aux.
Runaway argument?
1]
! Paragraph ended before tag was complete.
<to be read again>
par
l.6



When I surround the 1 with braces, it compiles fine, and I get the expected PDF output.
So I wonder, why does tag require braces while frac doesn't? Is there some difference in "type" of the object, like e.g. tag being a package-supplied facility while frac is from the language core (doesn't need usepackage at least) or something like that?







fractions braces tags






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 13 at 11:57









RuslanRuslan

1753 bronze badges




1753 bronze badges










  • 7





    yes they are differently defined. Better don't be lazy and avoid argument braces -- as you can see it can break.

    – Ulrike Fischer
    Aug 13 at 12:07












  • 7





    yes they are differently defined. Better don't be lazy and avoid argument braces -- as you can see it can break.

    – Ulrike Fischer
    Aug 13 at 12:07







7




7





yes they are differently defined. Better don't be lazy and avoid argument braces -- as you can see it can break.

– Ulrike Fischer
Aug 13 at 12:07





yes they are differently defined. Better don't be lazy and avoid argument braces -- as you can see it can break.

– Ulrike Fischer
Aug 13 at 12:07










1 Answer
1






active

oldest

votes


















11















The macro frac is defined (robustly) as



frac#1#2 -> begingroup #1 endgroup @@over #2


where @@over is (a copy of) the TeX primitive. So in this case you can indeed write frac12 and it will be the same as frac12. A lot of people, included myself, will tell you not to do this. (Although for such short fractions I don't always follow my own advice...)



On the other hand, at the beginning of displaymath tag is let to tag@in@display, whose definition reads



deftag@in@display#1#relaxtag@in@display@a#1


The tricky bit is the # before the opening brace of the replacement text. TeX looks for the first argument up to an opening brace (later it will check if this first argument is a star *). For details on how this mechanism works I refer to the questions Grab to #{ macro arguments (in particular Martin Scharrer's answer) and Macros with # as the last parameter. But the short answer is: TeX is scanning for an opening brace to collect the argument #1 and at some point finds the empty line (which is converted to a new paragraph), which isn't allowed, and hence the Paragraph ended error.






share|improve this answer



























  • I think the last sentence is not correct. TeX finds par (namely the empty line after ]) before expanding tag, while it is scanning for its argument. It isn't looking for a closing brace but scanning for the opening brace delimiting that argument.

    – schtandard
    Aug 13 at 21:54











  • @schtandard Yeah, that's absolutely true. I've edited.

    – campa
    Aug 14 at 7:18













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%2f504042%2fwhy-does-tag-require-braces-while-frac-doesnt%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









11















The macro frac is defined (robustly) as



frac#1#2 -> begingroup #1 endgroup @@over #2


where @@over is (a copy of) the TeX primitive. So in this case you can indeed write frac12 and it will be the same as frac12. A lot of people, included myself, will tell you not to do this. (Although for such short fractions I don't always follow my own advice...)



On the other hand, at the beginning of displaymath tag is let to tag@in@display, whose definition reads



deftag@in@display#1#relaxtag@in@display@a#1


The tricky bit is the # before the opening brace of the replacement text. TeX looks for the first argument up to an opening brace (later it will check if this first argument is a star *). For details on how this mechanism works I refer to the questions Grab to #{ macro arguments (in particular Martin Scharrer's answer) and Macros with # as the last parameter. But the short answer is: TeX is scanning for an opening brace to collect the argument #1 and at some point finds the empty line (which is converted to a new paragraph), which isn't allowed, and hence the Paragraph ended error.






share|improve this answer



























  • I think the last sentence is not correct. TeX finds par (namely the empty line after ]) before expanding tag, while it is scanning for its argument. It isn't looking for a closing brace but scanning for the opening brace delimiting that argument.

    – schtandard
    Aug 13 at 21:54











  • @schtandard Yeah, that's absolutely true. I've edited.

    – campa
    Aug 14 at 7:18















11















The macro frac is defined (robustly) as



frac#1#2 -> begingroup #1 endgroup @@over #2


where @@over is (a copy of) the TeX primitive. So in this case you can indeed write frac12 and it will be the same as frac12. A lot of people, included myself, will tell you not to do this. (Although for such short fractions I don't always follow my own advice...)



On the other hand, at the beginning of displaymath tag is let to tag@in@display, whose definition reads



deftag@in@display#1#relaxtag@in@display@a#1


The tricky bit is the # before the opening brace of the replacement text. TeX looks for the first argument up to an opening brace (later it will check if this first argument is a star *). For details on how this mechanism works I refer to the questions Grab to #{ macro arguments (in particular Martin Scharrer's answer) and Macros with # as the last parameter. But the short answer is: TeX is scanning for an opening brace to collect the argument #1 and at some point finds the empty line (which is converted to a new paragraph), which isn't allowed, and hence the Paragraph ended error.






share|improve this answer



























  • I think the last sentence is not correct. TeX finds par (namely the empty line after ]) before expanding tag, while it is scanning for its argument. It isn't looking for a closing brace but scanning for the opening brace delimiting that argument.

    – schtandard
    Aug 13 at 21:54











  • @schtandard Yeah, that's absolutely true. I've edited.

    – campa
    Aug 14 at 7:18













11














11










11









The macro frac is defined (robustly) as



frac#1#2 -> begingroup #1 endgroup @@over #2


where @@over is (a copy of) the TeX primitive. So in this case you can indeed write frac12 and it will be the same as frac12. A lot of people, included myself, will tell you not to do this. (Although for such short fractions I don't always follow my own advice...)



On the other hand, at the beginning of displaymath tag is let to tag@in@display, whose definition reads



deftag@in@display#1#relaxtag@in@display@a#1


The tricky bit is the # before the opening brace of the replacement text. TeX looks for the first argument up to an opening brace (later it will check if this first argument is a star *). For details on how this mechanism works I refer to the questions Grab to #{ macro arguments (in particular Martin Scharrer's answer) and Macros with # as the last parameter. But the short answer is: TeX is scanning for an opening brace to collect the argument #1 and at some point finds the empty line (which is converted to a new paragraph), which isn't allowed, and hence the Paragraph ended error.






share|improve this answer















The macro frac is defined (robustly) as



frac#1#2 -> begingroup #1 endgroup @@over #2


where @@over is (a copy of) the TeX primitive. So in this case you can indeed write frac12 and it will be the same as frac12. A lot of people, included myself, will tell you not to do this. (Although for such short fractions I don't always follow my own advice...)



On the other hand, at the beginning of displaymath tag is let to tag@in@display, whose definition reads



deftag@in@display#1#relaxtag@in@display@a#1


The tricky bit is the # before the opening brace of the replacement text. TeX looks for the first argument up to an opening brace (later it will check if this first argument is a star *). For details on how this mechanism works I refer to the questions Grab to #{ macro arguments (in particular Martin Scharrer's answer) and Macros with # as the last parameter. But the short answer is: TeX is scanning for an opening brace to collect the argument #1 and at some point finds the empty line (which is converted to a new paragraph), which isn't allowed, and hence the Paragraph ended error.







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 14 at 7:17

























answered Aug 13 at 13:25









campacampa

7,1172 gold badges18 silver badges43 bronze badges




7,1172 gold badges18 silver badges43 bronze badges















  • I think the last sentence is not correct. TeX finds par (namely the empty line after ]) before expanding tag, while it is scanning for its argument. It isn't looking for a closing brace but scanning for the opening brace delimiting that argument.

    – schtandard
    Aug 13 at 21:54











  • @schtandard Yeah, that's absolutely true. I've edited.

    – campa
    Aug 14 at 7:18

















  • I think the last sentence is not correct. TeX finds par (namely the empty line after ]) before expanding tag, while it is scanning for its argument. It isn't looking for a closing brace but scanning for the opening brace delimiting that argument.

    – schtandard
    Aug 13 at 21:54











  • @schtandard Yeah, that's absolutely true. I've edited.

    – campa
    Aug 14 at 7:18
















I think the last sentence is not correct. TeX finds par (namely the empty line after ]) before expanding tag, while it is scanning for its argument. It isn't looking for a closing brace but scanning for the opening brace delimiting that argument.

– schtandard
Aug 13 at 21:54





I think the last sentence is not correct. TeX finds par (namely the empty line after ]) before expanding tag, while it is scanning for its argument. It isn't looking for a closing brace but scanning for the opening brace delimiting that argument.

– schtandard
Aug 13 at 21:54













@schtandard Yeah, that's absolutely true. I've edited.

– campa
Aug 14 at 7:18





@schtandard Yeah, that's absolutely true. I've edited.

– campa
Aug 14 at 7:18

















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%2f504042%2fwhy-does-tag-require-braces-while-frac-doesnt%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

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form