A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
1
vote
1answer
33 views

Compiling lextex example

I am trying to use the lextex macros. For this, I started by taking a look at the example file. I tried to follow the instructions and run tex &plain example1.tex but this gives the message ...
2
votes
0answers
69 views

How TeX sets glue for \halign entries?

On p.235 of TeXbook it is said: TeX reads an entire \halign{...} specification into its memory before typesetting anything, and it keeps track of the maximum width of each column, assuming that ...
4
votes
1answer
87 views

Why is \halign not centered in display math mode?

This is centered: $$\vbox{\halign{#\cr A\cr}}$$ Why this is not centered? $$\halign{#\cr A\cr}$$ BTW, why \hbox{\halign{#\cr A\cr}} does not work?
5
votes
1answer
203 views

Plain TeX vs. ,,primitive`` TeX

I'm using LaTeX for my day-to-day needs, but in order to avoid cargo-cult document creation, I'm trying to gain a better understanding of the TeX engine itself. As part of this I'm experimenting with ...
10
votes
1answer
166 views

How to interpret ``underfull'' warnings in alignment?

I'm trying to figure out why there are warnings for 125pt case of AT&T table example in TeXbook. While trying to understand the meaning of these warnings, I came across p.302 of TeXbook, that says:...
2
votes
1answer
43 views

How to use \errorcontextlines interactively?

On p.34 of TeXbook it is said: By setting \errorcontextlines=0 at the beginning of your file, you can reduce the amount of information that is reported; TEX will show only the top and bottom ...
3
votes
1answer
45 views

Any way of calculating MD5 or any other checksum of the final output text

At the bottom of the final pdf, I would like to have the md5 of the entire text for control purposes. Anybody came across any similar/same task?
1
vote
1answer
73 views

Why is hyphenation not tried for words followed by em-dash?

Consider the following mystory.tex: \tolerance=10000 \hsize=.7in \leavevmode\nobreak\hskip0pt Drofnats---or ``R. J.,'' \end This is the log: (mystory.tex Overfull \hbox (17.41133pt too wide) in ...
2
votes
1answer
65 views

What does \leavevmode do?

Based on this question and the amazing @egreg's answer, I decided to make some tests to study and learn some boxes behavior. More precisely, to understand the \leavevmode. In the first example, one ...
5
votes
1answer
79 views

Purpose of \expandafter in a particular macro

Consider the following set of definitions... \documentclass[12pt]{article} \def\foreach{% \begingroup \catcode`\^^M=12 \xforeach} {\catcode`\^^M=12 \gdef\xforeach #1^^M{% \first #1,,\...
2
votes
1answer
76 views

Plain TeX macro with float calculation

I am trying to take this TeX snippet and use it as the basis for a macro. \centerline{\def\epsfsize#1#2{0.7#1} \epsfbox{1.01couet.eps}} I am struggling with a bit that is required because I am ...
2
votes
1answer
41 views

Test if a pgfkey is empty in a safe way

I have this little example to check if a key is empty: \documentclass[]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{tikz} \makeatletter \newcount\cnt\cnt=0\relax \...
4
votes
2answers
133 views

How does `\discretionary` work?

In poking around in someone else's package, I found the \discretionary command being used quite a lot. I wanted to hook into the code being used in one of its arguments, but found that my code got ...
1
vote
0answers
78 views

Moving from pdfLaTeX to XeLaTeX

I have this very long preamble and I'm struggling to switch to XeLaTeX. I'm working with PdfLaTeX, but since I want to change some fonts, I would like to switch to XeLaTeX. I tried to load ...
3
votes
4answers
178 views

Prevent hash doubling with \message

Assume a token sequence: Token 1: Explicit hash character of category code 6. Token 2: Explicit 1 of category code 12. Token 3: Explicit hash character of category code 6. Token 4: Control word token ...
4
votes
1answer
202 views

When should I use a \box register rather than \def? [duplicate]

\def is sometimes used as an abbreviation of a box construction, then its output is sometimes the same as the output with a \box register instead of \def. Here is the question. When should I use a \...
4
votes
2answers
212 views

Why isn't there any command to start a paragraph with \vbox?

\vbox does not switch modes and \hbox does not switch modes, as demonstrated by the following two groups of examples. The following two examples produce identical output: \hbox{A} \end \noindent A \...
5
votes
1answer
241 views

Question about exercise 21.10 in The TeXbook

This exercise asks how to store expansion of \chapno at the moment when \write is processed, but \the\count0 must be expanded at the moment of \shipout. Here is a full example: \def\chapno{5} \...
62
votes
4answers
8k views

When is TeX better than LaTeX? [duplicate]

Is there any situation where it is preferable to use TeX (or perhaps plain TeX) rather than LaTeX to write a document?
0
votes
0answers
37 views

How to display the index-number of the current box

In LaTeX (or maybe in TeX), how one can get notified about the "index" to the current LaTeX or TeX-box? For example, say an empty page is created in LaTeX; we firstly add a paragraph and then a ...
0
votes
0answers
107 views

White edge around text when underlining using \contour{white} inside a shaded environment

When using the simple code for adding nice underlines under your text: \usepackage{ulem} \usepackage{contour} \newcommand{\ul}[1]{% \uline{\phantom{#1}}% \llap{\contour{white}{#1}} … a problem ...
1
vote
1answer
68 views

How to add a \addtoreset mechanism to pure TeX \newcount?

I'm using subfig package for sub-figures, thus I'm trying to create a scheme to add a enumeration inside the label to make it easier to describe the sub-pictures. Using \begin{enumerate*} and \begin{...
1
vote
0answers
117 views

Badness: why 100.|z|^3 instead of 100 z^2?

As written here on page 158, the badness penalty is 100|z|^3 instead of 100z^2. Why is "3" in the exponent when we take the absolute value of z? Here z=(L-w)/w^+, where L is the required width and w ...
0
votes
0answers
119 views

Does rulewidth depend on the pdf viewer?

I set rule width like so. \newcolumntype{?}{!{\vrule width 0.001pt}} It renders just fine in my texStudio viewer, as very very faint lines. But when I open the pdf in an external viewer... I get ...
8
votes
1answer
429 views

How come the catcode of ' is 12 while ' is let to be a macro?

' is defined in latex.ltx as follows \def\active@math@prime{^\bgroup\prim@s} {\catcode`\'=\active \global\let'\active@math@prime} \def\prim@s{% \prime\futurelet\@let@token\pr@m@s} \def\pr@m@s{% \...
5
votes
1answer
233 views

Special \relax definition in the unravel package

The unravel package defines an \__unravel_special_relax: command, for which we find in the documentation the following: A special marker slightly different from \relax (its \meaning is \relax but ...
2
votes
2answers
224 views

\vrule and \hrule in \leaders

Those questions were came up when I was looking through The TeXbook around page 225 and solving the exercise 21.6 in there: In \leaders, are \vrule and \hrule essentially the same ? On the other ...
0
votes
1answer
42 views

What is the effect of {} in \eqalign?

$$\eqalign{&{}+7=b\cr}$$ and $$\eqalign{&+7=b\cr}$$ are the same; but $$\eqalign{{}+7=b\cr}$$ and $$\eqalign{+7=b\cr}$$ differ from each other (the first has more space between + and 7)....
2
votes
1answer
28 views

How to pass custom commands to LetLtxMacro?

I think it's fairly common to redefine macros. And I'm creating two functions to help storing and restoring these redefined macros. And so I tried using the following: \documentclass{article} \...
1
vote
1answer
70 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
1answer
150 views

\lowercase trick vs. \gdef

In this MWE I define an environment where a particular letter is active with some meaning once with the \lowercase trick and once with \gdef: \documentclass{article} \begingroup \catcode`\A=\active \...
1
vote
2answers
49 views

Valid values for `\newfont`

I'm using a template for a thesis and want to change the font of the chapter number. The template ("classicthesis") uses: \newfont{\chapterNumber}{eurb10 scaled 7000} with using Eulerfont. I'd like ...
3
votes
1answer
235 views

Knuth's 5 volume TeXbook A,B,C,D and E

Can I freely download the Knuth's 5 volume set books COMPUTERS and TYPESETTING in pdf and the source of TeX and {\sf METAFONT} that these book contain and a compiler for the sources that would ...
6
votes
3answers
820 views

\indent and \noindent: details from Knuth's The TeXbook

On page 286 in Knuth's book he writes: \noindent has no effect in horizontal mode. On the contrary on the page 283 he writes : This is exactly like \indent except that TeX starts out in ...
6
votes
0answers
122 views

Historical imperfections of (La)TeX [closed]

Assume for a moment that all TeX literature, TeX software, TeX files etc. got destroyed in some global cataclysm. All information about TeX survives only in the mind of a few TeX gurus, or something ...
0
votes
0answers
26 views

ERROR Undefined control sequence `\includegraphics` [duplicate]

My question has been asked severals times on the forum but nothing works for me. I would like to insert a picture. Here's a simple example that should work but which doesn't. \documentclass{article} ...
2
votes
1answer
48 views

What does the name “muglue” mean?

I'm wondering what muglue means in LaTeX and what it is an abbreviation/acronym of: m/u/glue. I have some idea though what glue in LaTeX means.
11
votes
2answers
523 views

\the vs. \value: what is the difference

I would like to understand the difference between \the and \value{} when using counters in LaTeX.
1
vote
2answers
44 views

Redefining the length-related commands to have a decimal coefficient

The macro of \! is defined as: \def\!{\mskip-\thinmuskip} and the command of \thinmuskip is initialized as being \thinmuskip = 3mu (Appendix B: p.349, The TeXBook). I couldn't have found the ...
3
votes
1answer
51 views

What is the use of putting the grave accent after \catcode?

Can someone kindly explain why is there and what is the use of the ` in \catcode`@=11? I came across that while I'm learning TeX from The TeXbook. Thank you very much.
4
votes
1answer
86 views

The mechanism that expands a double hyphen into an en-rule

What is the mechanism that transforms -- into –? How do I use the same mechanism to transform an arbitrary sequence of tokens into an arbitrary sequence of symbols?
7
votes
2answers
96 views

Is there a `for each` loop in primitive (La)TeX? [duplicate]

I am trying to iterate over the list of all basic colours: \def\thecolors{black, blue, brown, cyan, darkgray, gray, green, lightgray, lime, magenta, olive, orange, pink, purple, red, teal, violet, ...
1
vote
1answer
58 views

Print out command line used

Is there a way to print out the command line used to compile the latex document? The document is compiled using an editor and I'd like to get what it is specifically using.
7
votes
2answers
236 views

How to have hashes doubled _and_ things expanded?

I'd like to learn some TeX programming technique which I can always apply for handling the same type of situation: The code \newtoks\mytokenregister \def\five{\four5} \def\four{\three4} \def\three{\...
10
votes
2answers
959 views

How to compare integers in TeX?

I do not understand how I can compare integers in TeX. \documentclass[]{article} \begin{document} \if 1<>0 1 is not equal 0. \else 1 equals 0. \fi \end{document} According to this code ...
2
votes
1answer
66 views

How to modify \everypar safely in a package?

This is a follow-up to What does the \the\everypar do? and TikZ Overlay: Inject content at the start of the next paragraph? From a quick grep -R '\\everypar' texmf-dist/tex/latex I can see that \...
0
votes
0answers
108 views

Tex for IT professionals [duplicate]

I'm working as a programmer for about 20 years and invested a lot of time into understanding programming and computers before earning money with it. I've learned to program Java, use Windows, then ...
5
votes
1answer
77 views

Write to screen/console but not to .log file

I use LaTeX without Lua extensions. Is there a platform-independent possibility built into (La)TeX for writing a message to screen only but not to the .log file?
1
vote
1answer
135 views

How to use Optima font in Overleaf with any compiler?

I'm a new LaTeX user with my first use case being math proofs. I want to use Optima font (which came installed on my Mac) for my proof, and as far as I can tell I have to use the XeLaTeX compiler to ...
5
votes
1answer
59 views

TeX truncating output of \showbox command

I am studying Knuth's "The TeXbook". In Chapter 12, he demonstrates the glue that TeX puts between words by looking at the contents of hboxes in internal diagnostic format. I am trying to use \showbox ...