Does leavevmode leave any tokens in the input stream
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
The standard (plain TeX) definition of is
defleavevmodeunhboxvoidb@x
where voidb@x
is a permanently empty box. This will force TeX to leave vertical mode, and so is widely used to start horizontal mode material (particularly in LaTeX). Does this definition have any other influence on the processing of input?
tex-core
add a comment |Â
up vote
3
down vote
favorite
The standard (plain TeX) definition of is
defleavevmodeunhboxvoidb@x
where voidb@x
is a permanently empty box. This will force TeX to leave vertical mode, and so is widely used to start horizontal mode material (particularly in LaTeX). Does this definition have any other influence on the processing of input?
tex-core
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
The standard (plain TeX) definition of is
defleavevmodeunhboxvoidb@x
where voidb@x
is a permanently empty box. This will force TeX to leave vertical mode, and so is widely used to start horizontal mode material (particularly in LaTeX). Does this definition have any other influence on the processing of input?
tex-core
The standard (plain TeX) definition of is
defleavevmodeunhboxvoidb@x
where voidb@x
is a permanently empty box. This will force TeX to leave vertical mode, and so is widely used to start horizontal mode material (particularly in LaTeX). Does this definition have any other influence on the processing of input?
tex-core
tex-core
asked 19 mins ago
Joseph Wrightâ¦
197k21544864
197k21544864
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
When the standard leavemode
is executed in vertical mode, the unhbox
primitive switches TeX to horizontal mode. The unhbox
token remains in the input stream at that point. This can be seen if we arrange to grab the first token in a paragraph using everypar
:
deftemp#1deftemp#1showtemp
everypartemp
leavevmode A
bye
which yields
> temp=macro:
->unhbox .
This could potentially be an issue if some kind of look-ahead is in use. Of course, the unboxed empty box has no 'residual' effect on the vertical list being constructed.
The standard leavevmode
is the best definition with TeX90. However, when e-TeX is available, it is possible to use
protecteddefleavevmodeifvmodeexpandafterindentfi
With this indention, TeX executes indent
before everypar
is inserted. Thus there is nothing 'stray' in the input. (Try the demo above to see this.)
The reason this needs protected
is the behaviour of TeX at the start of an halign
. There, TeX will expand normal macros but (probably surprisingly) ifvmode
is true. Thus the result would be 'wrong':
halign#cr leavevmode acr acr
defleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
protecteddefleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
bye
The e-TeX protected
mechanism avoids this, making the indent
-based leavevmode
approach viable.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
When the standard leavemode
is executed in vertical mode, the unhbox
primitive switches TeX to horizontal mode. The unhbox
token remains in the input stream at that point. This can be seen if we arrange to grab the first token in a paragraph using everypar
:
deftemp#1deftemp#1showtemp
everypartemp
leavevmode A
bye
which yields
> temp=macro:
->unhbox .
This could potentially be an issue if some kind of look-ahead is in use. Of course, the unboxed empty box has no 'residual' effect on the vertical list being constructed.
The standard leavevmode
is the best definition with TeX90. However, when e-TeX is available, it is possible to use
protecteddefleavevmodeifvmodeexpandafterindentfi
With this indention, TeX executes indent
before everypar
is inserted. Thus there is nothing 'stray' in the input. (Try the demo above to see this.)
The reason this needs protected
is the behaviour of TeX at the start of an halign
. There, TeX will expand normal macros but (probably surprisingly) ifvmode
is true. Thus the result would be 'wrong':
halign#cr leavevmode acr acr
defleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
protecteddefleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
bye
The e-TeX protected
mechanism avoids this, making the indent
-based leavevmode
approach viable.
add a comment |Â
up vote
4
down vote
When the standard leavemode
is executed in vertical mode, the unhbox
primitive switches TeX to horizontal mode. The unhbox
token remains in the input stream at that point. This can be seen if we arrange to grab the first token in a paragraph using everypar
:
deftemp#1deftemp#1showtemp
everypartemp
leavevmode A
bye
which yields
> temp=macro:
->unhbox .
This could potentially be an issue if some kind of look-ahead is in use. Of course, the unboxed empty box has no 'residual' effect on the vertical list being constructed.
The standard leavevmode
is the best definition with TeX90. However, when e-TeX is available, it is possible to use
protecteddefleavevmodeifvmodeexpandafterindentfi
With this indention, TeX executes indent
before everypar
is inserted. Thus there is nothing 'stray' in the input. (Try the demo above to see this.)
The reason this needs protected
is the behaviour of TeX at the start of an halign
. There, TeX will expand normal macros but (probably surprisingly) ifvmode
is true. Thus the result would be 'wrong':
halign#cr leavevmode acr acr
defleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
protecteddefleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
bye
The e-TeX protected
mechanism avoids this, making the indent
-based leavevmode
approach viable.
add a comment |Â
up vote
4
down vote
up vote
4
down vote
When the standard leavemode
is executed in vertical mode, the unhbox
primitive switches TeX to horizontal mode. The unhbox
token remains in the input stream at that point. This can be seen if we arrange to grab the first token in a paragraph using everypar
:
deftemp#1deftemp#1showtemp
everypartemp
leavevmode A
bye
which yields
> temp=macro:
->unhbox .
This could potentially be an issue if some kind of look-ahead is in use. Of course, the unboxed empty box has no 'residual' effect on the vertical list being constructed.
The standard leavevmode
is the best definition with TeX90. However, when e-TeX is available, it is possible to use
protecteddefleavevmodeifvmodeexpandafterindentfi
With this indention, TeX executes indent
before everypar
is inserted. Thus there is nothing 'stray' in the input. (Try the demo above to see this.)
The reason this needs protected
is the behaviour of TeX at the start of an halign
. There, TeX will expand normal macros but (probably surprisingly) ifvmode
is true. Thus the result would be 'wrong':
halign#cr leavevmode acr acr
defleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
protecteddefleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
bye
The e-TeX protected
mechanism avoids this, making the indent
-based leavevmode
approach viable.
When the standard leavemode
is executed in vertical mode, the unhbox
primitive switches TeX to horizontal mode. The unhbox
token remains in the input stream at that point. This can be seen if we arrange to grab the first token in a paragraph using everypar
:
deftemp#1deftemp#1showtemp
everypartemp
leavevmode A
bye
which yields
> temp=macro:
->unhbox .
This could potentially be an issue if some kind of look-ahead is in use. Of course, the unboxed empty box has no 'residual' effect on the vertical list being constructed.
The standard leavevmode
is the best definition with TeX90. However, when e-TeX is available, it is possible to use
protecteddefleavevmodeifvmodeexpandafterindentfi
With this indention, TeX executes indent
before everypar
is inserted. Thus there is nothing 'stray' in the input. (Try the demo above to see this.)
The reason this needs protected
is the behaviour of TeX at the start of an halign
. There, TeX will expand normal macros but (probably surprisingly) ifvmode
is true. Thus the result would be 'wrong':
halign#cr leavevmode acr acr
defleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
protecteddefleavevmodeifvmodeexpandafterindentfi
halign#cr leavevmode acr acr
bye
The e-TeX protected
mechanism avoids this, making the indent
-based leavevmode
approach viable.
answered 19 mins ago
Joseph Wrightâ¦
197k21544864
197k21544864
add a comment |Â
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%2f454161%2fdoes-leavevmode-leave-any-tokens-in-the-input-stream%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