All Questions
29
questions
4
votes
2
answers
490
views
"\uppercase{a\lowercase{bC}}" produces "Abc" in TeX?
In TeX, \uppercase{a\lowercase{bC}} produces Abc not ABC, why? As far as I know, TeX will run the inner group before run the outer group, so I think it should be ABC and even \uppercase{a\expandafter{\...
0
votes
2
answers
73
views
Need add a space before character in changing category of character?
At the bottom of page 307 of The TeXbook, it says
TEX always reads the token following a constant before evaluating that constant.
So,
{\catcode‘\>=2 >
is different from
{\catcode\`>=2>
...
0
votes
2
answers
60
views
If one of TEX’s internal parameters is changed within a group, the previous contents of that parameter will be restored when the group ends in TeX?
I see this sentence on page 21 of the book The TeXbook, but I can't understand it. May you show me an example and explain it to me?
If one of TEX’s internal parameters is changed within a group, the ...
0
votes
2
answers
76
views
Without "\global", we can still change "\count0"?
As on page 21 of the book The TeXbook, if we need to change the page number to add 1, we need to use \global\advance\count0 by 1, as \advance\count0 by 1 couldn't change \count0 in other groups. ...
0
votes
1
answer
82
views
Exercise 5.7 in TeX - define control sequences with grouping
I want to solve Exercise 5.7 in the TeXBook by Donald E. Knuth.
Define control sequences **\beginthe**<block name> and **\endthe**<block name>
that provide a “named” block structure.
In ...
13
votes
2
answers
1k
views
Is this the right way to understand \let \def \edef \gdef \xdef \newcommand \renewcommand \providecommand?
I've already looked at at least ten different q&as explaining the differences of a subset of the commands listed above. While experimenting with them and trying to understand the subtle ...
0
votes
0
answers
78
views
How to execute TeX only for side effects
I need to execute a part of my TEX code without printing the text it produces while making \global macros defined by it available.
For example, when I have this group:
{
foo\global\def\bar{baz}
}
I ...
4
votes
2
answers
87
views
smuggling macro out of a group in tex core results in undefined control sequence
I am trying to re-apply changes done in a group directly afterwards with the following code similar to the approach in here
\def\smuggle#1\endgroup{%
\expandafter\endgroup\expandafter\edef\...
3
votes
1
answer
2k
views
"Paragraph ended before ..." error in TeX
While playing around with TeX, I came across a strange error. This is my input file:
\def\twice#1{#1#1}
\def\hello{Hello World.\par}
\twice{\hello} % works
\twice{Hello World. } % works
\twice{Hello ...
4
votes
2
answers
414
views
Text variant vs font switch - bfseries
I stumbled into the following sample
\documentclass[a4paper,11pt]{article}
\usepackage[english, ngerman]{babel}
\begin{document}
Quick test - not yet bold
"\textbf{Bold text for test - part 2}
...
2
votes
1
answer
77
views
When do curly braces disappear in macro definitions? (e.g. \documentclass expansion)
I've been looking into how \documentclass and friends are actually defined, and I noticed something peculiar which I'd like to understand.
Let's say I have \documentclass[11pt, titlepage]{article}. ...
1
vote
1
answer
175
views
Writing expanded macro with space to file
I'm trying to write an expanded macro to a file without the expansion eating the space after it.
I could replace the {} empty group with an explicit \space, but I want this to be fairly robust. Is ...
9
votes
1
answer
158
views
Semantic differences of global definitions in local group relating to save-stack entries
This is a follow-up question on \global variant of \csname…\endcsname, which asks for a solutions to the problem explained there, but doesn't ask for an explanation.
The gist of the problem is that
{...
18
votes
2
answers
697
views
\global variant of \csname…\endcsname
Please consider the following minimal example:
\documentclass{article}
\tracingrestores=1
\def\foo{\bar\foobar}
\def\bar{\gdef\testA{blabb}}
\def\foobar{\expandafter\gdef\csname testB\endcsname{...
7
votes
1
answer
164
views
Parshape has no effect inside group
In the MWE below the \parshape command behaves as expected. However if you add grouping (by uncommenting the two lines marked with a (*)) then it seems to have no effect! How do I make it behave like ...