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;
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
add a comment |
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
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
add a comment |
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
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
fractions braces tags
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
I think the last sentence is not correct. TeX findspar
(namely the empty line after]
) before expandingtag
, 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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
I think the last sentence is not correct. TeX findspar
(namely the empty line after]
) before expandingtag
, 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
add a comment |
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.
I think the last sentence is not correct. TeX findspar
(namely the empty line after]
) before expandingtag
, 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
add a comment |
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.
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.
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 findspar
(namely the empty line after]
) before expandingtag
, 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
add a comment |
I think the last sentence is not correct. TeX findspar
(namely the empty line after]
) before expandingtag
, 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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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