Using a macro with parameters in everypar fails
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
Out of curiosity, I wonder why this fails:
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
begindocument
begingroup
obeylines
everypar=bla
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
with the error: Argument of bla has an extra }.
I did look at par in the parameter text (as an argument delimiter) and vbox#1 in an everypar macro but these are not delimited arguments to a macro.
tex-core
add a comment |Â
up vote
4
down vote
favorite
Out of curiosity, I wonder why this fails:
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
begindocument
begingroup
obeylines
everypar=bla
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
with the error: Argument of bla has an extra }.
I did look at par in the parameter text (as an argument delimiter) and vbox#1 in an everypar macro but these are not delimited arguments to a macro.
tex-core
Is there a reason you wantobeylines
here? It makes the explanation longer ... though fundamentally the same
â Joseph Wrightâ¦
1 hour ago
No. It was part of an earlier experiment...
â sgmoye
1 hour ago
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
Out of curiosity, I wonder why this fails:
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
begindocument
begingroup
obeylines
everypar=bla
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
with the error: Argument of bla has an extra }.
I did look at par in the parameter text (as an argument delimiter) and vbox#1 in an everypar macro but these are not delimited arguments to a macro.
tex-core
Out of curiosity, I wonder why this fails:
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
begindocument
begingroup
obeylines
everypar=bla
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
with the error: Argument of bla has an extra }.
I did look at par in the parameter text (as an argument delimiter) and vbox#1 in an everypar macro but these are not delimited arguments to a macro.
tex-core
tex-core
asked 1 hour ago
sgmoye
3,64711125
3,64711125
Is there a reason you wantobeylines
here? It makes the explanation longer ... though fundamentally the same
â Joseph Wrightâ¦
1 hour ago
No. It was part of an earlier experiment...
â sgmoye
1 hour ago
add a comment |Â
Is there a reason you wantobeylines
here? It makes the explanation longer ... though fundamentally the same
â Joseph Wrightâ¦
1 hour ago
No. It was part of an earlier experiment...
â sgmoye
1 hour ago
Is there a reason you want
obeylines
here? It makes the explanation longer ... though fundamentally the sameâ Joseph Wrightâ¦
1 hour ago
Is there a reason you want
obeylines
here? It makes the explanation longer ... though fundamentally the sameâ Joseph Wrightâ¦
1 hour ago
No. It was part of an earlier experiment...
â sgmoye
1 hour ago
No. It was part of an earlier experiment...
â sgmoye
1 hour ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
TeX is in vertical mode when it reads your C
start-of-paragraph text. The starts a group but does not change mode. That happens when TeX reads
C
, which must be in horizontal mode and so starts a paragraph. The everypar
tokens are inserted, and your macro grabs C
as #1
(you can see this if you use a macro with only one argument). In the current case, you then have a in the input stream. That can't be
#2
, so you get a TeX error.
Probably the easiest way to avoid this is to force TeX to leave vertical mode. The standard leavevmode
won't work as it inserts some tokens that come after everypar
. We can fix that with an e-TeX definition for leavevmode
protecteddefleavevmodeifvmodeexpandafterindentfi
which can then be inserted
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
protecteddefleavevmodeifvmodeexpandafterindentfi
begindocument
begingroup
everypar=bla
leavevmode
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
1
What is e-tex specific here? The protected naturally, but it seems to work also without it.
â Ulrike Fischer
1 hour ago
Somewhere in the TeXBook there is a warning about beginning a paragraph with{
-- can't find it now, but that should have made me think... This was a nice lesson.
â sgmoye
1 hour ago
Actually, having TeXed the code, I find that does not work. The first line works correctly giving typesetC.G! skdjfs;ldjkf;sjkf
but the second line gives typesetE.R!ERTERT djkfsjdfl;ksjdf;l
. The code works ifleavevmode
is placed before each line.
â sgmoye
26 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
TeX is in vertical mode when it reads your C
start-of-paragraph text. The starts a group but does not change mode. That happens when TeX reads
C
, which must be in horizontal mode and so starts a paragraph. The everypar
tokens are inserted, and your macro grabs C
as #1
(you can see this if you use a macro with only one argument). In the current case, you then have a in the input stream. That can't be
#2
, so you get a TeX error.
Probably the easiest way to avoid this is to force TeX to leave vertical mode. The standard leavevmode
won't work as it inserts some tokens that come after everypar
. We can fix that with an e-TeX definition for leavevmode
protecteddefleavevmodeifvmodeexpandafterindentfi
which can then be inserted
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
protecteddefleavevmodeifvmodeexpandafterindentfi
begindocument
begingroup
everypar=bla
leavevmode
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
1
What is e-tex specific here? The protected naturally, but it seems to work also without it.
â Ulrike Fischer
1 hour ago
Somewhere in the TeXBook there is a warning about beginning a paragraph with{
-- can't find it now, but that should have made me think... This was a nice lesson.
â sgmoye
1 hour ago
Actually, having TeXed the code, I find that does not work. The first line works correctly giving typesetC.G! skdjfs;ldjkf;sjkf
but the second line gives typesetE.R!ERTERT djkfsjdfl;ksjdf;l
. The code works ifleavevmode
is placed before each line.
â sgmoye
26 mins ago
add a comment |Â
up vote
5
down vote
accepted
TeX is in vertical mode when it reads your C
start-of-paragraph text. The starts a group but does not change mode. That happens when TeX reads
C
, which must be in horizontal mode and so starts a paragraph. The everypar
tokens are inserted, and your macro grabs C
as #1
(you can see this if you use a macro with only one argument). In the current case, you then have a in the input stream. That can't be
#2
, so you get a TeX error.
Probably the easiest way to avoid this is to force TeX to leave vertical mode. The standard leavevmode
won't work as it inserts some tokens that come after everypar
. We can fix that with an e-TeX definition for leavevmode
protecteddefleavevmodeifvmodeexpandafterindentfi
which can then be inserted
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
protecteddefleavevmodeifvmodeexpandafterindentfi
begindocument
begingroup
everypar=bla
leavevmode
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
1
What is e-tex specific here? The protected naturally, but it seems to work also without it.
â Ulrike Fischer
1 hour ago
Somewhere in the TeXBook there is a warning about beginning a paragraph with{
-- can't find it now, but that should have made me think... This was a nice lesson.
â sgmoye
1 hour ago
Actually, having TeXed the code, I find that does not work. The first line works correctly giving typesetC.G! skdjfs;ldjkf;sjkf
but the second line gives typesetE.R!ERTERT djkfsjdfl;ksjdf;l
. The code works ifleavevmode
is placed before each line.
â sgmoye
26 mins ago
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
TeX is in vertical mode when it reads your C
start-of-paragraph text. The starts a group but does not change mode. That happens when TeX reads
C
, which must be in horizontal mode and so starts a paragraph. The everypar
tokens are inserted, and your macro grabs C
as #1
(you can see this if you use a macro with only one argument). In the current case, you then have a in the input stream. That can't be
#2
, so you get a TeX error.
Probably the easiest way to avoid this is to force TeX to leave vertical mode. The standard leavevmode
won't work as it inserts some tokens that come after everypar
. We can fix that with an e-TeX definition for leavevmode
protecteddefleavevmodeifvmodeexpandafterindentfi
which can then be inserted
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
protecteddefleavevmodeifvmodeexpandafterindentfi
begindocument
begingroup
everypar=bla
leavevmode
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
TeX is in vertical mode when it reads your C
start-of-paragraph text. The starts a group but does not change mode. That happens when TeX reads
C
, which must be in horizontal mode and so starts a paragraph. The everypar
tokens are inserted, and your macro grabs C
as #1
(you can see this if you use a macro with only one argument). In the current case, you then have a in the input stream. That can't be
#2
, so you get a TeX error.
Probably the easiest way to avoid this is to force TeX to leave vertical mode. The standard leavevmode
won't work as it inserts some tokens that come after everypar
. We can fix that with an e-TeX definition for leavevmode
protecteddefleavevmodeifvmodeexpandafterindentfi
which can then be inserted
documentclassarticle
usepackagexparse
NewDocumentCommandblamm#1.#2!
protecteddefleavevmodeifvmodeexpandafterindentfi
begindocument
begingroup
everypar=bla
leavevmode
CG skdjfs;ldjkf;sjkf
ERTERTERT djkfsjdfl;ksjdf;l
endgroup
enddocument
answered 1 hour ago
Joseph Wrightâ¦
197k21544863
197k21544863
1
What is e-tex specific here? The protected naturally, but it seems to work also without it.
â Ulrike Fischer
1 hour ago
Somewhere in the TeXBook there is a warning about beginning a paragraph with{
-- can't find it now, but that should have made me think... This was a nice lesson.
â sgmoye
1 hour ago
Actually, having TeXed the code, I find that does not work. The first line works correctly giving typesetC.G! skdjfs;ldjkf;sjkf
but the second line gives typesetE.R!ERTERT djkfsjdfl;ksjdf;l
. The code works ifleavevmode
is placed before each line.
â sgmoye
26 mins ago
add a comment |Â
1
What is e-tex specific here? The protected naturally, but it seems to work also without it.
â Ulrike Fischer
1 hour ago
Somewhere in the TeXBook there is a warning about beginning a paragraph with{
-- can't find it now, but that should have made me think... This was a nice lesson.
â sgmoye
1 hour ago
Actually, having TeXed the code, I find that does not work. The first line works correctly giving typesetC.G! skdjfs;ldjkf;sjkf
but the second line gives typesetE.R!ERTERT djkfsjdfl;ksjdf;l
. The code works ifleavevmode
is placed before each line.
â sgmoye
26 mins ago
1
1
What is e-tex specific here? The protected naturally, but it seems to work also without it.
â Ulrike Fischer
1 hour ago
What is e-tex specific here? The protected naturally, but it seems to work also without it.
â Ulrike Fischer
1 hour ago
Somewhere in the TeXBook there is a warning about beginning a paragraph with
{
-- can't find it now, but that should have made me think... This was a nice lesson.â sgmoye
1 hour ago
Somewhere in the TeXBook there is a warning about beginning a paragraph with
{
-- can't find it now, but that should have made me think... This was a nice lesson.â sgmoye
1 hour ago
Actually, having TeXed the code, I find that does not work. The first line works correctly giving typeset
C.G! skdjfs;ldjkf;sjkf
but the second line gives typeset E.R!ERTERT djkfsjdfl;ksjdf;l
. The code works if leavevmode
is placed before each line.â sgmoye
26 mins ago
Actually, having TeXed the code, I find that does not work. The first line works correctly giving typeset
C.G! skdjfs;ldjkf;sjkf
but the second line gives typeset E.R!ERTERT djkfsjdfl;ksjdf;l
. The code works if leavevmode
is placed before each line.â sgmoye
26 mins ago
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453789%2fusing-a-macro-with-parameters-in-everypar-fails%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Is there a reason you want
obeylines
here? It makes the explanation longer ... though fundamentally the sameâ Joseph Wrightâ¦
1 hour ago
No. It was part of an earlier experiment...
â sgmoye
1 hour ago