{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}.

learn more… | top users | synonyms (1)

133
votes
23answers
6k views

Are there any open research problems in the world of TeX?

For a year-long capstone project in computer science, I have to do some 'original research.' I'm still not entirely sure what this entails, but it just struck me that perhaps I can do research and ...
83
votes
4answers
15k 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 ...
73
votes
2answers
4k 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 ...
72
votes
3answers
13k 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.
72
votes
2answers
6k views

What's new in TeX, version 3.14159265?

The new Knuth TeX has been released in early this month, and its version number is 3.14159265 now. It can be downloaded here. What's new in this release? And a further-more question, where can one ...
68
votes
5answers
4k 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 ...
62
votes
8answers
22k 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 ...
61
votes
5answers
13k 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?
59
votes
3answers
51k 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?
59
votes
1answer
2k 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} ...
55
votes
5answers
9k 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 ...
55
votes
1answer
8k 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 ...
54
votes
9answers
3k 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.
54
votes
3answers
1k 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 ...
53
votes
3answers
2k 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?
51
votes
3answers
3k views

2013, year of the TeX bugs report. Will pdfTeX, XeTeX, etc. be changed accordingly?

Barbara Beeton said (TUGboat vol. 34, pag. 4): As noted on Don Knuth's TeX web pages, www-cs-faculty.stanford.edu/~knuth/abcde.html, he "intend[s] to check on purported bugs again in the ...
51
votes
2answers
1k views

If LaTeX is only a macro package, why does it have its own executable?

From other answers on this site and the FAQ of the TeX User Group my understanding is that: TeX is the original typesetting program, written by Knuth Omega, eTeX, pdfTeX, XeTeX, LuaTeX are engines. ...
51
votes
4answers
6k 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 ...
49
votes
5answers
798 views

\let\foo\bar vs \let\foo=\bar

Both uses of the \let primitive often lead to the same result. Is this even true for every case? What was the thought process behind it. And if they are actually not equivalent, are there particular ...
48
votes
5answers
14k 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 ...
45
votes
4answers
5k 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?
45
votes
1answer
2k 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 ...
43
votes
5answers
2k 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 ...
43
votes
10answers
4k 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 - ...
43
votes
2answers
2k 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 ...
42
votes
4answers
1k views

What is “expansion”?

I'm relatively new to (La)TeX, but I have a reasonable amount of experience with computational programming languages. Until I began learning (La)TeX, I'd never heard of "expansion"... So, what is ...
41
votes
3answers
1k 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 ...
41
votes
3answers
1k 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 ...
41
votes
3answers
857 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 ...
41
votes
3answers
3k 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; ...
41
votes
3answers
742 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 ...
40
votes
2answers
1k 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: ...
40
votes
1answer
620 views

On the basics of writing to & reading from auxiliary files (.aux, .toc, etc.)

Some actions (such as generating the Table of Contents) require two passes of the TeX compiler: during the first pass, some data get written to an auxiliary file, only to be retrieved during the ...
38
votes
2answers
4k 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 ...
37
votes
2answers
2k 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 ...
37
votes
2answers
443 views

How to implement (low-level) arrays in TeX

Update: I have revised my question based on the comment by Bruno Le Floch and some further research. As some may know, I'm implementing a huge TeX macro package which has to do a lot of internal ...
36
votes
3answers
2k 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 ...
36
votes
4answers
2k views

How does your mind bend \expandafter to its will?

Expansion is often cited as one of the most arcane aspects of TeX, more akin to witchcraft than to something easily picked up by the newcomer. There are many great questions and great answers about ...
35
votes
2answers
1k 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 ...
34
votes
1answer
3k 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 ...
33
votes
4answers
4k 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 ...
32
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 ...
31
votes
4answers
1k 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?
31
votes
2answers
692 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 ...
31
votes
2answers
1k 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?
30
votes
3answers
2k views

Difference between \if and \ifx

I try to understand the subtleties of TeX programming, but it is not always easy. For example, in the following code : \def\first{abc} \def\second{abc} \ifx\first\second OK!\else false \fi I ...
29
votes
5answers
2k 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 ...
29
votes
3answers
36k views

Escape character in LaTeX

I need to output the below text but since \ is a special character, I cannot: [RegularExpression(@"\d+")] Also sometimes I need use dollar sign $ as well but it seems to be a special char, too. ...
29
votes
1answer
926 views

How to generate “You can't use \unskip in vertical mode”?

We all know (or believe so) that \unskip is not possible in main vertical mode and this statement can be found in various answers on the site. And yes LaTeX does a lot of gymnastics in \addvspace or ...
28
votes
2answers
480 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?