{tex-core} is for questions that are independent of formats and macro packages. 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}.
66
votes
4answers
10k views
When to use \edef, \noexpand, and \expandafter?
I'm quite happy hacking TeX macros and cobbling together bits and pieces from different style files to suit my own ends, but I have a suspicion that my resulting hacks are not quite as elegant as they ...
60
votes
5answers
3k views
Cunning (La)TeX tricks
Writing (La)TeX code sometimes requires a degree of guile. Here (in no particular order) are two of my favourite examples.
Macros ending with spaces
Pete asked how to see the implementation of ...
58
votes
8answers
20k views
Why are there no alternatives to TeX, or, why is TeX still used? [closed]
I'm fairly new to TeX and LaTeX, having been drawn in by the Big Idea — creating a document programmatically. However, my experience of TeX (and its libraries — LaTeX, ConTeXt, …) has been almost ...
58
votes
2answers
2k views
What are penalties and which ones are defined?
Very often you can find solutions by changing the penalty. One is widowpenalty. However what are penalties and is there a small list of every defined penalty.
There is a German site which does ...
52
votes
3answers
865 views
Why isn't everything expandable?
TeX's macro processor does its work in a process called expansion. For an input stream of tokens, the macro processor repeatedly expands them until non-expandable tokens remain. The resulting stream ...
49
votes
9answers
2k views
Are there any disadvantages of TeX being Turing complete?
I have read that TeX is Turing complete. I was wondering if making TeX Turing complete gave raise to unwanted effects.
48
votes
3answers
8k views
What is the difference between \let and \def?
What is the difference between the \let and \def commands in TeX/LaTeX?
Ideally please provide a simple example that will illustrate the difference between them.
46
votes
5answers
7k views
What is the difference between TeX and LaTeX?
I know LaTeX and I've heard that LaTeX is a set of macros in TeX.
But what does it exactly mean?
42
votes
3answers
1k views
What is the difference between \relax and {}?
As I understand it, the point of \relax is to stop a macro from swallowing up subsequent material (such as whitespace). But {} (\bgroup\egroup) serves the same function. Why do we need both?
42
votes
4answers
3k views
What is the difference between 'fil' and 'fill'?
TeX provides the commands \vfil and \vfill (and their corresponding horizontal versions \hfil and \hfill).
These commands are actually defined as:
\vskip 0cm plus 1fil
\vskip 0cm plus 1fill
where ...
42
votes
0answers
1k views
A LaTeX log analyzer application (visualizing TeX expansion)
Consider the following MWE, test.tex:
\documentclass[12pt]{article}
\begin{document}
\tracingassigns=1
\tracingmacros=1
\def\aaa{something}
\def\bbb{else \aaa, else}
\edef\ccc{third \bbb, level}
...
40
votes
3answers
804 views
Why/When should I pay attention to warnings?
I often see warnings in the compilation-log of my tex-files.
I searched in the internet and did not find a good answer to this question.
And in my opinion there must be a reason why tex warns me about ...
39
votes
4answers
3k views
Shortest code causing “Emergency stop.” error
This question is purely academic. TeXing a file containing
\valign{\halign#\cr!
causes an ! Emergency stop. error. Is that the shortest code which produces a fatal error in TeX?
39
votes
10answers
3k views
What is the best way to learn TeX?
As opposed to LaTeX, which is addressed in another question.
Most of the references I've seen get too complex too quickly. I'm looking for something that gives me a top-down view of the language - ...
38
votes
5answers
5k views
What exactly do \csname and \endcsname do?
What exactly do \csname and \endcsname do? What are their job?
I have glanced at the Texbook and some other books, but none of them was clear enough to me.
Can anyone please give a simple example to ...
38
votes
3answers
30k views
\vspace vs. \vskip
What is the difference between \vspace{-1em} and \vskip -1em, for example? I guess the first is LaTeX, and the latter is TeX. When is the proper time to use one and not the other, and why?
38
votes
1answer
5k views
When should one use \begingroup instead of \bgroup?
Is there ever a case when the use of \begingroup is preferred to \bgroup? Obviously, \bgroup is necessary in cases where you need to have balanced braces and thus cannot use {, but when is it ...
36
votes
1answer
1k views
The differences between TeX engines
I am confused about what TeX and its offspring (LaTeX, pdfTeX/pdfLaTeX, e-TeX, ConTeXt, LuaTeX, etc.) are.
Some, like LaTeX, seem like add ons to TeX (maybe a change to the eyes and mouth, but not ...
36
votes
2answers
893 views
Can you explain how this code works?
I found this code somewhere on the Tex archives and have been puzzling over it for some time. Can anyone describe how it works?
% Date: Thu, 7 Feb 91 12:20:50 -0500
%From: ...
35
votes
4answers
1k views
Typesetting limitations of LaTeX
What are the typesetting limitations of LaTeX? In other words what are the things that desktop publishing and word processing programs do better than LaTeX? I am not really interested in things that ...
35
votes
3answers
775 views
Advantages and disadvantages of fully expandable macros
As I currently understand them, fully-expandable macros are analogous to pure/effect-free functions in functional programming. Correspondingly, things that are not expandable, such as \def, are ...
34
votes
2answers
1k views
Is there a \show for lengths?
The \show command is extremely useful for figuring out what's going on with a particular macro. Similarly, using \the can tell me the value of a counter. I'd like to know if there's something ...
34
votes
2answers
567 views
Electronic version of Knuth's “TeXbook”?
I have a printed copy of the TeXbook (from D.E. Knuth) at home. Now that I travel a lot, I don't want to take my library with me every time. Question:
Is there a legal way to obtain (=purchase) a PDF ...
33
votes
3answers
485 views
Why no vertical-mode Knuth-Plass?
I have only basic knowledge of the TeX internals, so I hope what I am saying here is not complete nonsense. If I understand correctly, in TeX, horizontal positioning / line breaking is done using a ...
33
votes
3answers
2k views
What is the difference between \let and \edef?
When you write
\edef\a{\b}
\let\a\b
the results are often identical. What is the difference between these two commands? When do they behave the same? When do they not?
(The question isn't for me; ...
31
votes
2answers
417 views
Will cruft from a previous compile ever change the final look of my document
Ok, this has been bugging me for a while; Will cruft left over from a previous run of LaTeX ever change how my document looks?
Would the following procedures ever give me different results:
I ...
30
votes
3answers
8k views
How to expand TeX's “main memory size”? (pgfplots memory overload)
I'm compiling one pretty simple LaTeX file with few dozen of pgfplots. Now, I can compile part by part, but am unable to compile it all at once. I really need good precision for all those plots (noise ...
30
votes
2answers
365 views
What is a token?
Please forgive such a basic question, but I did some Google searching and looked around on this site, and while there are many threads and online resources that involve tokens, I can't seem to find a ...
29
votes
3answers
979 views
Is it really bad to use \makeatletter and \makeatother in a package or class file?
In my answer to this question What do \makeatletter and \makeatother do? I apparently wrote:
The commands should not be used within .sty and .cls files themselves as they may conflict with the ...
28
votes
4answers
1k views
A critique of TeX?
Is there any informative critique of TeX along one or all the lines below:
TeX, the typesetting engine (including its algorithms)
TeX, the typesetting language
TeX, the programming language
TeX, the ...
28
votes
2answers
583 views
No \makeatletter required?
In typing up some small examples that might create errors in LaTeX (for Documents with typical LaTeX errors), I tried the following:
\documentclass{article}
\def\my@macro#1{-#1-}% This is magic
...
27
votes
2answers
385 views
What is truecm?
In examples found around the web, some people specify lengths such as width=5truecm with \includegraphics or the geometry package. How is this different from regular 5cm?
27
votes
1answer
2k views
Is it \catcode or \catcode`?
I've noticed that \catcode is poorly documented in the TeXbook. The primitive is defined as \catcode but every time it is used, it is used as \catcode` ... the backquote is never discussed. ` itself ...
26
votes
5answers
1k views
Confused with TeX terminology: height, depth, width
The LaTeX reference card states for example
\strut box w/ ht and depth of “(”, zero width
I came to see text as a two dimensional feature, but I must be missing out on something...
(following ...
26
votes
5answers
737 views
When does it make sense to use TeX only and skip LaTeX?
In what applications doesn't LaTeX give you much?
26
votes
1answer
238 views
When is TeX in “no mode”?
TeX can be in 7 distinct modes:
Vertical mode: this is the mode in which TeX starts, and build pages.
Internal vertical mode: TeX is in this mode within \vbox{...}.
Horizontal mode: when ...
25
votes
4answers
924 views
What are category codes?
Following on from this question, I'd like to ask a more general question:
What are category codes, and what can I achieve by changing them?
25
votes
3answers
841 views
Does TeX always insert the macro \par?
When the input processor encounters two characters with category code 5 in a row (in other words, a blank line), it inserts the \par macro.
When \vbox{Abc.} ends, TeX ends the current paragraph, but ...
25
votes
2answers
748 views
What language is TeX implemented in?
I read on Wikipedia that the first version of TeX was written in SAIL. However, does anyone know what language later versions (i.e the current one) are implemented in?
25
votes
2answers
1k views
Components of (La)TeX's memory usage
After reading Increase LaTeX capacity and not being able to summon Gandalf1, I am curious to know what contributes to the components of memory usage during a (La)TeX compilation. Take the above post's ...
25
votes
1answer
346 views
Why six \noexpand in a row?
Trying to understand TeX's rules for parsing dimensions, I came up with the following weird behaviour:
\dimen0=1\noexpand\noexpand\noexpand\noexpand\noexpand\empty pt
is valid, but
...
25
votes
1answer
376 views
What exactly is a “single character” or “symbol” in math mode?
There are at least three instances where single symbols in math mode receive a special treatment by the TeX engine: 1. when accents are placed, 2. when a math operator is created with ...
24
votes
6answers
2k views
Test whether token list is empty
Is it possible to test whether a token list register is empty without expanding it?
24
votes
2answers
3k views
What is the basic mechanism for writing something to an aux file?
I am interested in the basic mechanism behind writing stuff to the .aux file. (Or some other auxiliary file).
Let's say I want to write myself a basic package for making notes on my files. (I know ...
24
votes
4answers
2k views
How to check if a macro value is empty or will not create text with plain TeX conditionals?
I have a macro which holds some text value, e.g. \macro{some text}. If it is empty, I would like for nothing to appear in the document, but it has some content of any kind which would produce text ...
24
votes
4answers
432 views
Why isn't a command defined by \newcommand with an optional argument expandable?
In trying to fix a problem with a nested macro repeatedly calling itself, I tried expanding the inner call before passing it as an argument to the outer one. This failed miserably because the macro ...
23
votes
5answers
1k views
Showcase of brace tricks: }, \egroup, \iffalse{\fi}, etc.
There have been a few questions about braces recently, specifically about when to use them (see this and that question). Note: I had mistakenly stated that SamB was the author of both questions.
But ...
23
votes
4answers
294 views
unexpected interaction between \raggedright and \parshape
While answering Random start of line, I came upon a strange interaction between \raggedright and \parshape.
If a ragged-right paragraph ends in a short line, this line will be "the most ragged".
...
23
votes
6answers
975 views
What reasons (if any) are there for compiling in interactive mode?
I'm a command-line junkie and often compile with a simple pdflatex filename.tex from a terminal, and I forget (or am too lazy) to type -interaction=nonstopmode or interaction=batchmode. Hence, when I ...
23
votes
2answers
426 views
Benchmarking various operations of TeX
TeX offers plenty of ways of doing some things, and it is sometimes difficult to predict which one will be quickest. For instance, how do
a macro assignment
a toks assignment
a macro expansion
a ...

