{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}.
16
votes
2answers
225 views
What is \box255?
I'm just reading the everyshi manual, and it says:
This package provides the hooks \EveryShipout and \AtNextShipout
whose arguments are executed after the output routine has constructed
...
16
votes
1answer
583 views
What does \marks do?
Recently I had cause to define a macro called \marks. If I try something like
\newcommand{\marks}{fred}
I get the error
! LaTeX Error: Command \marks already defined.
In LaTeX, if I do ...
16
votes
1answer
674 views
What are the differences between TeX counts and LaTeX counters?
The title already states the whole question. It has been answered by Joseph Wright at http://www.texdev.net/2009/11/17/tex-counts-and-latex-counters/, but I have not seen the according answer here at ...
16
votes
1answer
747 views
Knuth's line breaking algorithm
I'm trying to understand the basics of Knuth's line breaking algorithm. At the beginning of Chapter 12: Glue of his TeXbook, there is a figure like the one below.
My question is: where did those ...
16
votes
1answer
451 views
Is it still worthwhile to let TeX try line-breaking without hyphenation?
Here's TeX's line-breaking approach (as I understand it) in a nutshell:
If \pretolerance is positive, try to break a paragraph into lines without inserting discretionary hyphens and without ...
16
votes
2answers
3k views
\nothing, \varnothing and \emptyset
This is probably a question about TeX's history.
Why there is no command \nothing? If there's no \nothing, why \varnothing is called \varnothing instead of \nothing?
If I try to compile a document ...
16
votes
1answer
416 views
When can one use implicit braces instead of explicit braces?
For context, an implicit character is a control sequence that has been \let to a character. For example, both plain TeX and LaTeX use \let\bgroup{ \let\egroup} making \bgroup and \egroup into implicit ...
15
votes
7answers
2k views
What is the canonical way to write a for-loop macro?
At a basic level TeX does not provide a for-loop construct, but allows tail-end recursion, however Knuth defined \loop in the plain macros. Coders have been coming with variations of their own ever ...
15
votes
3answers
406 views
\string command behavior - Plain TeX
I would like to learn Plain TeX and I'm reading Knuth's "The TeXBook". At Chapter 7, Knuth talks about the \string command and how it converts control sequences into lists of characters tokens.
Why ...
15
votes
3answers
563 views
Starting with TeX (not LaTeX)
I've been using LaTeX for 3 years and I'm decided to switch to (plain) TeX. For the moment I'm reading The TeXbook for the third time (I quietly start to read the double-danger signed paragraphs) and ...
15
votes
2answers
2k views
What are vertical and horizontal modes?
Yiannis's answer to a question introduced me to the notion of "vertical mode". Doing a search on the internet turns up relatively little about the different modes of operation; all I've managed to ...
15
votes
3answers
199 views
Is it possible to interact with TeX mid-process?
Quoting from an answer to Typesetting the entire Song That Never Ends
I ran this code once, and aborted the process after it reported producing something like 47,000 pages (in a very short amount ...
15
votes
4answers
294 views
Using the filename in the document?
I have a bunch of documents called wk01.tex wk02.tex and so on up to (eventually) 20. These are weekly handouts for a course I TA. Currently, each document starts with a \def\classweek{5} or whatever. ...
15
votes
2answers
326 views
Difference between \let\foo\relax and \def\foo{} for disabling
When I want some macro to (temporarily) do nothing, I normally write
\let\foo\relax
But somebody asked me why I don't just do
\def\foo{}
and I realized I couldn't answer his question.
So, I ...
15
votes
2answers
1k views
Difference between setting parindent and hangindent
Is there a difference between setting
\parindent to 1em
and to setting
\parindent to 0em, \hangindent to 1em, and \hangafter to -1
that shows in practical use? The nodes created by TeX are ...
15
votes
4answers
352 views
Selectively suppress generation of typeset output
Is it possible put TeX into a "mute" mode in which all typesetting is suppressed?
\documentclass{article}
\pagestyle{empty}
\begin{document}
\suppress
This text will not be seen in the generated ...
15
votes
1answer
106 views
What is the differences between mathcode and catcode and how can I use mathcode?
The command \catcode is often used to change some internals. E.g. the command \makeatletter changes the catcode @. But what is \mathcode and how does it work?
catcodes are well explained here: Wiki ...
15
votes
1answer
213 views
Why are \new… defined as \outer in the plain TeX format?
In plain.tex, D.E.Knuth decided to define as \outer all the macros which allocate registers: \newcount, \newdimen, \newskip, \newread, \newwrite. This forbids them from entering the argument of ...
15
votes
1answer
176 views
Why can words with hyphen char not be hyphenated?
Assume I have a word like Baden-Württemberg. TeX can't hyphenate any of these two word parts. Why?
why isn't it something like this:
where the small ticks indicate possible hyphenation points. A ...
15
votes
2answers
167 views
Test whether \end will really end the run
Can I test whether calling the \end primitive will really end the run?
The naive \ifdim\pagegoal=16383.99998pt yes\else no\fi is not sufficient (even adding to that mix \deadcycles). According to ...
15
votes
1answer
428 views
How do I ‘expand’ a control sequence `\let` to a character?
Consider the following:
\let\1=X
\edef\2{\1}
\show\1 \show\2
The result is
> \1=the letter X.
> \2=macro:
->\1.
Is it possible to ‘expand’ the meaning of \1 so that \2 contains just ...
14
votes
3answers
189 views
Parsing strings containing diacritical marks (macros?)
I apologize that this question may seem very much like several other recent ones I have asked (Parsing leading hardspaces, Parsing a \$ as part of an improved \getargs command). They are all related ...
14
votes
2answers
467 views
How does one publish/promote a new package?
I just took all the wonderful information supplied here, and wrote a small package that makes it possible to use Unicode characters for section, subsection, subsubsection, paragraph, subparagraph and ...
14
votes
4answers
283 views
LaTeX, package documentation look-up
I am on OS X (10.6 Snow Leopard) using TeXLive-2011 to typeset a simple .tex file I am editing in Vim and trying to learn. My problem is: how do I...
gradually learn about what TeX can do for me
get ...
14
votes
3answers
734 views
Does `\noexpand` have to be a primitive?
Background: I'm trying to deepen my understanding of TeX and how the intricacies work (spurred a little by this place, I should say, and hoping one day to not be a "Cargo Cult Programmer" - see When ...
14
votes
2answers
1k views
What are the exact semantics of \detokenize?
How does \detokenize work?
The e-TeX Short Reference Manual states:
When followed by a <general text>,
expands to yield a sequence of
character tokens of \catcode 10
(space) or 12 ...
14
votes
3answers
207 views
How to determine which register a count uses
Suppose there is
\newcount\c@mycountera
\newcount\c@mycounterb
\newcount\c@mycounterc
Each \newcount uses \alloc@ and that has \wlog{\string#5=\string#2\the\allocationnumber}. Thus to determine ...
14
votes
2answers
2k views
What's the difference between \tolerance and \badness ?
I'm having some difficulty understanding this sentence on page 29, Chapter 6 of Knuth's TeXbook:
Run TeX again, and begin this time by
saying
\hsize=2in \tolerance=1600 \input
story
...
14
votes
2answers
295 views
Every possible \meaning that a token can have
In the context of a debugging package that I am writing, I need to analyse an arbitrary token in the input stream. What are the possible outcomes of \meaning<token>?
Macro: (\protected) ...
14
votes
2answers
763 views
How to add a hook to a macro
LaTeX uses hooks extensively, one method employed is the command g@addto@macro. It is defined in source2e as:
\long\def\g@addto@macro#1#2{%
\begingroup
\toks@\expandafter{#1#2}%
...
14
votes
1answer
681 views
How do \lastskip and \ifdim work?
I thought I knew the answer to this question, but I can't understand the following plain TeX code:
\noindent\hskip1pt\ifdim\lastskip=0pt lastskip was 0pt\fi\par
\noindent\hskip1pt\showthe\lastskip
...
14
votes
2answers
131 views
Use TeX macros to store multiple data
I'm trying to use TeX macros to store multiple data such as website url/name. Here is an example :
\documentclass{article}
\def\Google{{http://www.google.com}{Google Search}}
\makeatletter
...
14
votes
3answers
323 views
Unbalanced output routine
The TeX primitive \output behaves almost like a toks register, except in the fact that it is always surrounded by braces. For instance, after \output={\plainoutput}, the result of \showthe\output is ...
14
votes
1answer
177 views
Can one determine the first character of a given math list?
I'm still pursuing my quest to code a better \widebar command. I can do bars over single characters quite well already, but I have problems when it comes to letter combinations such as AW. ...
13
votes
5answers
189 views
Checking if a string contains # with its original catcode
At comp.text.tex the following scheme was suggested for testing if a string contains the parameter character with catcode 6.
\def\endcheck{\endcheck}
\def\second#1#2{#2}
...
13
votes
3answers
1k views
What is the difference between \empty and \@empty?
I want to elaborate a command that would print differently simple differential dx and multidimensional differential d^3x. For this purpose I invented the command \dif with one optional argument. It is ...
13
votes
3answers
1k views
What is the difference between \ifx\somecommand\undefined and \ifdefined\somecommand\else?
What is the difference between \ifx\cyrdash\undefined and \ifdefined\cyrdash\else? \cyrdash is any macro.
13
votes
3answers
103 views
Difference between \mskip and \mkern
What are the differences between \mskip and \mkern? The TeXbook writes the following (ch. 18):
You can insert math glue into any formula just by giving the command
‘\mskip⟨muglue⟩’. [...] ...
13
votes
2answers
255 views
What is “plain TeX”?
I occasionally see a statement that plain TeX is not the same as TeX, because plain TeX is already a format.
What is plain TeX, and what is the difference to TeX proper?
Some answers are here (The ...
13
votes
3answers
616 views
\def taking rest of the line as argument
I know how to define a macro that will take the rest of the paragraph as parameter.
Simply write \def\a#1\par{\textbf{#1}}.
But, how do I write a macro whose argument will extend to the end of the ...
13
votes
2answers
220 views
Difference between one glue and two glues after each other
Is there a difference between
A\hskip 1pt \hskip 0pt plus 1fil B
and
A\hskip 1pt plus 1fil B
?
Are these two glues the same in terms of spacing and (line-)breaking? Or do they just add up, as I ...
13
votes
1answer
311 views
How to print and assign category codes?
Consider the code below, which after giving me some trouble (especially with catcode 9 and 15), prints all the category codes up to catcode 15.
\documentclass{minimal}
\parindent0pt
\begin{document}
...
13
votes
1answer
193 views
How to find out if a math list consists of a single character?
When accents are placed, the TeX engine gives single characters a special treatment; see the TeXbook, Rule 12 on page 443. See also this question and its accepted answer for details. Thus, ...
13
votes
1answer
395 views
How to transpose a table in expl3
I've been very impressed with xparse and expl3, and have written a wonderful document command using \ProcessList that takes a comma separated list and turns it into a (basically) 1 column table.
...
12
votes
3answers
362 views
How to compile the source code of TeX
I am more and more interested in the system TeX (and LaTeX) and I want to study it more deeply. I am not telling that I want to learn how to use it, but I want to understand its mechanism now.
The ...
12
votes
4answers
494 views
File copy without expansion
What is the command for file copy? I want to copy the contents of one file into another without any command expansion. The operative system would use
copy source target
I tried reading the contents ...
12
votes
4answers
2k views
How to make a real backslash (escape) character?
I just want a good way to make a backslash character (or whatever character(s) any given format uses as escape characters), suitable to \write to a file or pass to a pdfTeX primitive.
Let me ...
12
votes
3answers
441 views
Defining commands that are scoped to a particular environment
Is it possible to define commands in a separate namespace so that they only work within a particular environment?
For example, can I create a package named foo that defines a foo environment and a ...
12
votes
2answers
349 views
The revenge of the vboxes
Yes, they're back. With a vengeance. Those pesky little buggers we call \vboxes which I've fought against previously. (And Bruno, too.)
\parskip=0pt
\def\unquo{\unvbox0\smallskip}
...
12
votes
3answers
290 views
Expansion of first token in a tabular cell
Background
I currently do some work on the collcell package which collects the content of a tabular/array cell and provides it to a user defined macro, e.g. using ...

