Questions tagged [tex-core]

{tex-core} is for questions for syntax, semantics and expected behavior of TeX primitive control sequences, regardless of extensions (eTeX, etc.) formats (Plain or LaTeX) and macro packages (tikz). Such questions usually relate to low-level TeX programming or the behaviour of TeX at an underlying level. Note that even Plain TeX is a format in itself; for questions about it, use {plain-tex}.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Why is "^^62" "v" and "^^6" "b" in TeX?

With TeX, ^^62^6\bye produces vb. Hex 62 is 98 in Dec, bigger than 64, so 98-64=34. From cmr10 table, the 34th slot is ". Why is it v? 6 is smaller than 64, so 6+64=70. From cmr10 table, the ...
Y. zeng's user avatar
  • 1,715
4 votes
2 answers
233 views

Show carriage return by changing its catcode in TeX?

On page 46 of The TeXbook, there is TEX deletes any space characters (number 32) that occur at the right end of an input line. Then it inserts a return character (number 13) at the right end of the ...
Y. zeng's user avatar
  • 1,715
0 votes
2 answers
104 views

What follows the `^^` in TeX? Hex or Dec or symbol?

^^6\bye will produces v. I can understand this. 6 is the symbol of ASCII table, and the DEC of 6 symbol is 54. As 54 is smaller than 64, so 54+64=128. The 128th symbol of ASCII table is v. ^^61 ...
Y. zeng's user avatar
  • 1,715
0 votes
1 answer
51 views

Why can the character number 127 be ouput by default?

On page 44 of The TeXbook, it says, the “dangerous bend” sign used in this manual appears as character number 127 of font manfnt, and that font is selected by the control sequence \manual On page 45 ...
Y. zeng's user avatar
  • 1,715
2 votes
3 answers
852 views

"^^A" does not work in TeX?

On page 45 of The TeXbook, TEX has a standard way to refer to the invisible characters of ASCII: Code 0 can be typed as the sequence of three characters ^^@, code 1 can be typed ^^A, and so on up to ...
Y. zeng's user avatar
  • 1,715
0 votes
3 answers
127 views

How to understand "\appendroman#1#2#3" on page 41 of The TeXbook?

At the bottom of page 41 of The TeXbook, there is a question: Define a control sequence \appendroman with three parameters such that \appendroman#1#2#3 defines control sequence #1 to expand to a ...
Y. zeng's user avatar
  • 1,715
6 votes
2 answers
1k views

Doesn't "\romannumeral1986" equal "mcmlxxxvi" in TeX?

In TeX, \uppercase{\romannumeral1986}\par %\catcode`\m=12 \uppercase{mcmlxxxvi} \bye produces So, doesn't mcmlxxxvi equal \romannumeral1986? What the difference between them? \expandafter can bypass ...
Y. zeng's user avatar
  • 1,715
4 votes
2 answers
477 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{\...
Y. zeng's user avatar
  • 1,715
0 votes
1 answer
55 views

"\escapechar" vs category 0 in TeX

In TeX, \catcode`\|=0 will make escape character to be |, to |TeX will output But at the penultimate paragraph of page 40 of The TeXbook, it says that \escapechar is normally TeX's internal code for ...
Y. zeng's user avatar
  • 1,715
1 vote
1 answer
108 views

To make "\" to category 12, why should convert it to category 13 in TeX?

Exercise 7.5 on page 40 of The TeXbook asks to make \ to category 12. The answer of this question is {\catcode‘/=0 \catcode‘\\=13 /message{/string\}} Why should assign the \ to 13 not 12? The ...
Y. zeng's user avatar
  • 1,715
0 votes
1 answer
73 views

Doesn't "\csname" need contain "\0"?

On page 40 of The TeXbook, Conversely, you can go from a list of character tokens to a control sequence by saying ‘\csname\endcsname’. So \csname TeX\endcsname equals \TeX. However, \TeX contains ...
Y. zeng's user avatar
  • 1,715
0 votes
0 answers
39 views

Why does '\string' convert '\' to "? [duplicate]

On page 40 of the TeXbook, it says, \string\cs will produce tokens to be calssied to 12. But \string\TeX will produce `"TeX" as I once thought that the result should be \TeX. Why is there &...
Y. zeng's user avatar
  • 1,715
0 votes
2 answers
69 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> ...
Y. zeng's user avatar
  • 1,715
2 votes
1 answer
118 views

What is the '\oops' in 'I\errorcontextlines=100 \oops' and where should they be placed in TeX file?

At the bottom of page 34 of The TeXbook, there is If you use TEX format packages designed by others, your error messages may involve many inscrutable two-line levels of macro context. By setting \...
Y. zeng's user avatar
  • 1,715
2 votes
1 answer
220 views

Does '\centerline' really define '\ERROR' in TeX?

In a .tex file, there is \centerline{\bf A SHORT \error STORY}, which will cause error as l.3 \centerline{\bf A SHORT \ERROR STORY} ? ! Emergency stop. <...
Y. zeng's user avatar
  • 1,715
3 votes
1 answer
246 views

"Underfull" or "Loose" box in TeX?

When badness exceeds \hbadness, there should be Underfull. When badness exceeds \tolerance, there should be Overfull. Origin story.tex file is \hrule \vskip 1in \centerline{\bf A SHORT STORY} \vskip ...
Y. zeng's user avatar
  • 1,715
4 votes
1 answer
105 views

Same badness cause different space in the same sentence in TeX?

On page 29 of The TeXbook, Mr. Knuth show the same sentence with the same badness, but those have different space between their word. What is the reason and how to understand the badness here?
Y. zeng's user avatar
  • 1,715
3 votes
2 answers
405 views

Is "plain.fmt" equal "plain.tex" in TeX?

When tex was input in terminal, there is preloaded format=tex. Is preloaded format=tex equal plain.tex? When input &plain \input story after the tex command, there is Sorry, I can't find the ...
Y. zeng's user avatar
  • 1,715
0 votes
3 answers
80 views

numbers greater or equal condition

can't believe that there is a language in which such a simple thing requires so much effort. well i want to do a greater or equal to comparison of an argument in a macro. My current try is not right. ...
user1850133's user avatar
0 votes
2 answers
53 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 ...
Y. zeng's user avatar
  • 1,715
0 votes
2 answers
66 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. ...
Y. zeng's user avatar
  • 1,715
2 votes
1 answer
110 views

"\kern0pt" could correct the "\/" before comma or period in TeX?

For easier use of {\it text}, we can define a control sequence such as \def\ital#1{{\it #1\/}}, which is suggested at the bottom of page 20 of the TeXbook. Since it will add extra space, which is not ...
Y. zeng's user avatar
  • 1,715
5 votes
1 answer
452 views

"\tenrm" is not built into TEX. but why can it be used directly?

On page 15 of the book The TEXbook : a complete user's guide to computer typesetting with TEX, Mr. KNUTH said that Each font used in a TEX manuscript is associated with a control sequence; for ...
Y. zeng's user avatar
  • 1,715
4 votes
1 answer
156 views

String-separated arguments in LaTeX

One of the features I like best in Plain TeX is the ability to write macros with arguments separated by a sensible delimiter. For example \def\translate#1 = #2 (#3){...} What is the LaTeX way of ...
richardIII's user avatar
3 votes
2 answers
457 views

Get upright italic fonts in TeX

I can get italic fonts in TeX by \it command, but I see there is upright italic font on page 13 of the book The TeXbook. How did the author achieve this style? See the words while the letters in ...
Y. zeng's user avatar
  • 1,715
1 vote
1 answer
150 views

Why there are 256 different control sequences of length 2 and 256^2 of length 3 in TeX?

On page 11 of the book The TeXbook, there is a question: How many different control sequences of length 2 (including the escape character) are possible? How many of length 3? The answer is: There ...
Y. zeng's user avatar
  • 1,715
3 votes
1 answer
140 views

"\null?" doesn't add a space after the question mark

On the page 34 of the book TEX for the Impatient, there is: TEX normally adds some extra space after what it thinks is a punctuation mark at the end of a sentence, namely, ‘.’, ‘?’, or ‘!’ followed ...
Y. zeng's user avatar
  • 1,715
6 votes
4 answers
1k views

How does \if work?

In the definition of \if on page 209 in TeXbook it is said: unless the current equivalent of that control sequence has been \let equal to a non-active character token Do I understand it correctly ...
Igor Liferenko's user avatar
-2 votes
3 answers
278 views

How does TeXbook macro \stest work?

Let's put the \stest macro from TeXbook to file stest.tex with some formatting and adding line numbers for reference. 1 \newif\ifspace \newif\iffunny \newif\ifexplicit \newif\ifactive 2 \def\stest#...
Igor Liferenko's user avatar
3 votes
1 answer
244 views

Why space is [not] ignored in macro arguments?

Test 1 prints SPACE IGNORED. From this we conclude that space from \s is ignored while argument scanning. Test 2 differs from test 1, that * is appended to parameter list. If space is ignored while ...
Igor Liferenko's user avatar
1 vote
1 answer
47 views

how to toogle tex boolean inside lualatex code

I have classical tex boolean: \newif\ifprintanswers \printanswersfalse I also have luacode that can read some environment variable: \begin{luacode} if os.getenv('C') == '1' then tex....
Bob Morane's user avatar
0 votes
0 answers
22 views

Opmac Footnotes with no newline

I'm using OPMAC footnote macros in Plain TeX. I am trying to format multiple footnotes on one page so they are next to each and not positioned on a new line. At the moment it formats like But I need ...
maxwell79's user avatar
0 votes
0 answers
74 views

Code positioning [duplicate]

Does Latex allow the true and false statements to be placed on the same line ? \IfNoValueTF {#5} { \hspace{0.5cm} } { \ (#5) \par\smallskip } rather than \IfNoValueTF {#5} { \hspace{0.5cm} } { ...
user avatar
0 votes
0 answers
31 views

Is there a package offering a command inserting a or an depending on whether a fovel follows? [duplicate]

The question is already the headline: is there a package which provides a command say \a which expands to an if a spoken vowel follows, else to a? Maybe this is a bit too specific, because it refers ...
user2609605's user avatar
2 votes
1 answer
316 views

new LuaTeX primitives documentation

Compared to pdfeTeX, which primitives have been added to LuaTeX? Besides the rearrangement of the standard pdfeTeX PDF primitives, and the somewhat odd (as compared to XeTeX) beaviour of \font (which ...
jarnosz's user avatar
  • 4,257
1 vote
1 answer
608 views

Failed to install MikTeX

Today, I tried to install the current MikTeX version (basic-miktex-23.10-x64.exe, published on 10/06/2023), which was downloaded from the MikTeX homepage. Unfortunately, I get the following bizarre ...
Gabriel Frahm's user avatar
5 votes
1 answer
116 views

Why does a \catcode-changed underscore work in math mode also without \mathcode set to "8000?

Something is puzzling me... consider %\begingroup %\catcode`\_=13 %\gdef_{\sb} %\endgroup \catcode`\_=11 \def\foo_bar{Foo bar} \foo_bar\ $a_b$ \bye Uncommenting the commented code yields (One can ...
campa's user avatar
  • 29.8k
9 votes
7 answers
562 views

Detect catcode of next character?

I use only lualatex, but I suspect this is a general question, having something to do with core TeX. Is there such a thing as \ifnextcatcode ? Pseudo-code: \def\wanted{\ifnextcatcode{12}{\dothis}{\...
rallg's user avatar
  • 1,327
-2 votes
1 answer
83 views

Descriptions for n, N, V, T, F [closed]

Where can I find descriptions for n, N, V, T, F. What are they called ? Generally found after commands.
Veak's user avatar
  • 1
3 votes
2 answers
150 views

TeX program conceivable at all which produces output other than .dvi or .pdf directly, e.g., .rtf/.doc/.docx

Donald E. Knuth's TeX outputs .dvi files. Hàn Thế Thành's pdfTeX outputs .pdf files. Is a program rtfTeX or docTeX or docxTeX conceivable that instead of .dvi or .pdf directly outputs Word .rtf or ....
Cattleya's user avatar
  • 349
0 votes
1 answer
34 views

pdflatex error due to empty *.pfb file in VSCode with LaTex Workshop

I'm working with jupyter notebooks in vscodeto export *.ipynb files to *.pdf. This works very well, but I'm not happy with the generated output. So I decided to make a *.tex file, to format it to my ...
John Goofy's user avatar
0 votes
2 answers
191 views

Pandoc PDF method for two-column layout in bibliography list section

I am seeking a method to format a document in two columns, including both the body and the bibliography reference list at the end. My current workflow uses markdown columns within the body correctly, ...
t3dr's user avatar
  • 23
3 votes
0 answers
64 views

Are there tricks for detecting whether a `\csname..\endcsname`-thingie went wrong and, if so, delivering additional messages explaining the issue?

For the sake of having expandable tokens expanded before stringification I sometimes combine \csname..\endcsname-expansion with \string as in \chardef\stopromannumeral=`\^^00 \edef\gobbleToPrefix{% \...
Ulrich Diez's user avatar
  • 27.5k
3 votes
1 answer
226 views

Where is the definition of the math mod environment `$$...$$`?

I have a problem with display math modes $$...$$ and \[...\], see The display math mode and the `center` environment. So, I want to find the definition of the display math mode $$...$$ for ...
phchon's user avatar
  • 51
3 votes
1 answer
291 views

TeX capacity exceeded, sorry [grouping levels=255]

I have a tikz graph of 484 nodes, about twice as many edges. As the error suggests, I am hitting some limit, but I am not sure which. A graph of about 250 nodes renders fine. To add to my confusion, I ...
user443854's user avatar
4 votes
1 answer
178 views

How to get the width of the gap actually produced in the output-file due to \hskip?

How to get the width of the gap actually produced in the output-file due to \hskip? I wonder if there is a way in Knuthian TeX of getting the width of the gap actually produced in the output-file due ...
Cattleya's user avatar
  • 349
4 votes
3 answers
412 views

How does TeX distinguish between variables and procedures?

Every computer program evaluating anything has to distinguish between variables and procedures. This is a typical example from SICP: (define (eval exp env) (cond ((self-evaluating? exp) exp) ...
ceving's user avatar
  • 699
0 votes
1 answer
70 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 ...
GarretW's user avatar
0 votes
3 answers
128 views

How do \left | and \right | actually work?

How do \left | and \right | actually work, specifically when packages like fontspec or mathspec are involved and unicode fonts are used? I sort of understand how other kinds of brackets and ...
yury10578's user avatar
  • 159
5 votes
2 answers
504 views

Exercise 8.6 of The TeXbook

Exercise 8.6. Assume that the category codes of plain TEX are in force, except that the characters ^^A, ^^B, ^^C, ^^M belong respectively to categories 0, 7, 10, and 11. What tokens are produced from ...
Atom's user avatar
  • 513

1
2 3 4 5
40