{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)

44
votes
1answer
1k 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 ...
24
votes
1answer
1k views

What is an \if?

I'm reading TeX by Topic, but in little chunks (rather than from first page to last) and just read the stuff on conditionals. I want to be sure that I understand what's going on when TeX starts ...
41
votes
3answers
1k 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 ...
23
votes
1answer
369 views

The \lowercase trick

We have a number of questions or rather answers using (and explaining) the \lowercase “trick”. \begingroup \lccode`\~=`\. \lowercase{\endgroup\def~}#1{foo with #1} However, after reading on ...
33
votes
3answers
858 views

Why doesn't TikZ's \foreach iterate over the last element of the list?

This code \documentclass{report} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[dashed] (1,-1) -- (1,2) node[above] {$1$}; \draw[dashed] (2,-1) -- (2,2) node[above] {$2$}; \foreach ...
26
votes
3answers
1k views

How to know whether or not we need \expandafter?

The following is quoted from Peter Grill's answer on question LaTeX dynamic macro definition. The \expandafter is requried as the \newcommand needs to be dealt with after the \csname. As a ...
23
votes
2answers
1k views

\@ne \tw@ \thr@@

The LaTeX (2e) source code is quiet hard to read. There are a lot of macros with @ symbol. I understand those are "latex macros". There is, in particular, a series of macros called \@ne, \tw@, \thr@@ ...
22
votes
3answers
457 views

Making a zip macro

In functional languages, there often is a function called zip, which can be handy in many situations; for example in ruby, one can say: %w(a b c).zip(%w(d e f)) to get an array of arrays [["a", ...
15
votes
4answers
641 views

Detokenizing without extra spaces?

I have a need to pass through potentially arbitrary characters untouched and found this macro: \def\test#1{\expandafter\zap@space\detokenize{#1} \@empty} The problem is that \detokenize inserts ...
32
votes
2answers
746 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 ...
13
votes
7answers
2k views

Can I see a plain TeX source file please?

all the LaTeX-tutorials tell me how LaTeX is an extention simplifying the building of TeX documents. Understandably, no one uses plain TeX anymore, right? But I seem to learn better when I grasp the ...
9
votes
2answers
481 views

Where to find official (!) and extended documentation for tex/latex's commandline options (especially -interaction modes)?

Today I tried to learn more about the several interaction modes for tex/latex/pdflatex etc. The manpages turned out to be not very helpful: $ man tex ... -interaction mode Sets the ...
9
votes
1answer
1k views

Why does \@gobble take one argument

I understand what \@gobble, \@gobbletwo etc. do, but I don't understand why \@gobble allows for an argument. I believe that the definition of the macro is \long\def\@gobble#1{}. Why is this argument ...
8
votes
2answers
275 views

Normal \relax vs. frozen \relax

With \edef\x{\ifnum0=0\else\fi} being \relax and with \def\y{\relax} we see that \ifx\x\y is false. Why? See also \ifcsname when it isn't apparent that the command is \relax'ed.
8
votes
2answers
803 views

Selecting optical size?

For some time I've seen LaTeX-produced documents that had slight differences in fonts. When you looked at them, they had the same Computer-Modern or Latin-Modern, however, they looked more stylized ...
45
votes
4answers
6k 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?
25
votes
4answers
2k views

Test success of write18

For the new version of my package and class standalone I like to call external programs: further (pdf)latex runs to optionally compile included standalone files, and to convert the resulting PDF to ...
20
votes
2answers
1k views

TeX's algorithms for “breaking paragraph into lines” and “setting the glue”

I want to learn more about the implementation of TeX's text-justification algorithm (setting the glue). After scanning through ch.12 of Knuth's TeXbook, I'm guessing that setting the glue must ...
19
votes
3answers
4k 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.
16
votes
2answers
608 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 ...
13
votes
2answers
706 views

Is a TeX macro defined?

I am looking for a way in TeX to check if a macro was defined. Currently I use a rather tangled way. I exploit a sort of side effect when comparing two macros via \ifx; this command returns: true, ...
11
votes
5answers
1k views

Teach me how to use \loop…\repeat constructs, etc

The following code snippet is a part of the solution given here: \def\IncludeOutput#1{ \parskip=2mm \def\examplename{#1} \pdfximage{\Directory/\examplename.pdf}% ...
11
votes
2answers
623 views

How to get the catcode of a token?

For debugging a complicated macro I would like to print out the catcode of a token. Optimally I would like to have a macro \getcatcode such that, for example, \getcatcode{a} would expand to 10. How ...
10
votes
1answer
145 views

Macro parameter delimited by more than one delimiter

TeX user can simply create the macro with a parameter delimited by an arbitrary sequence of tokens. For example \def\macro #1delimiter{...#1...} Is it possible to create a macro with a parameter ...
8
votes
3answers
233 views

Detecting which version of the LaTeX format is in use

ltxcmds provides \ltx@ifpackagelater, \ltx@ifclasslater, \ltx@iffilelater and there is \@ifpackagelater - but is there any "if TeX later" or some other way to (automatically) get the used TeX version ...
26
votes
3answers
741 views

When is it better to use \par than \endgraf?

Just yesterday I had to patch a package file (changing the description to indicate that the file had changed) to replace some \par to \endgraf because the code had bad interactions with non-\long ...
22
votes
6answers
5k views

What is \iffalse for?

So this is something I've wondered about for a while. What use is a conditional that always evaluates to false? I guess it's a neat way to "hide code from LaTeX" but apart from that, is it ever ...
22
votes
2answers
1k views

What’s behind \over?

Typically a TeX command have arguments coming after it. But the command \over, which is used to produce fractions, can access the token before it. How exactly is it implemented and can I define a ...
18
votes
2answers
4k 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 ...
15
votes
2answers
459 views

Why does `x_\text y` work?

As far as I have understand the tokenization in LaTeX, x_\text y will be split up into x _ \text y Now the _ will consume/bind to the next token. However, \text takes an argument as well. If _ ...
15
votes
3answers
1k 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⟩’. [...] ...
15
votes
4answers
722 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. In a command line driven operating system one would use copy source target I ...
13
votes
1answer
218 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, ...
12
votes
4answers
1k views

Making efficient use of \writes

I'm currently trying to compile my thesis using LaTeX and have run up against the old ! No room for a new \write . problem. After some googling it seems the only way to actually resolve this problem ...
11
votes
1answer
657 views

How to do \scantokens inside \edef without triggering “Runaway definition”

I'm trying to find a way to use the e-TeX \scantokens command inside [the equivalent of] an \edef (well, actually an \xdef, but presumably this does not make any real difference since that's just the ...
9
votes
2answers
952 views

How to avoid underfull vbox in combination with \vsplit?

In the following example I am using the command \vsplit. I can't see the reason why \vsplit produced an overfull \vbox \documentclass{article} \parindent0pt \def\exampletext{Text Text Text Text Text ...
9
votes
6answers
1k views

Function like macro?

If you have programmed in a high level programming language, you must be familiar with the concept of functions, subroutines which return a value. For example, if you write in C, you can write a ...
5
votes
3answers
237 views

Possible CSS type features?

Hi I am doing a project for my 10th grade Graphic design class and we have to make up an inspirational type thing with the emotion words Bold, in a bigger size and capitalized and I was wondering if ...
4
votes
5answers
706 views

Continuously-sizable fonts?

Why are we stuck with a finite number of font sizes in LaTeX? Modern fonts are fully vector-based and scalable - why can't LaTeX do this? Or maybe it can, and I just don't know how. Also see the ...
23
votes
2answers
527 views

Backward definition of (La)TeX commands

Again and again I see, that TeXnicians define commands and do several things with them in the reverse order, I would do this as amateur. See this example: In his answer to scrpage2: Three ...
16
votes
4answers
690 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 ...
10
votes
1answer
361 views

Interwoven alignment preambles are not allowed - what exactly does this mean?

I admit that this post is purely idle curiosity. But I recently stumbled upon a little factoid saying that the TeX error "Interwoven alignment preambles are not allowed" has the following explanation ...
9
votes
1answer
752 views

Trapping LaTeX error/warning

Is there a way to trap an error/warning in LaTeX during compile time? I'm thinking of something similar to the VB script On Error Goto <blah>, but this time for LaTeX in something like ...
8
votes
5answers
362 views

What sequence of documents should I read to know “all of” TeX and then LaTeX?

I know that there are a already number of questions on this site about good instructional (La)TeX materials for users at different levels. What I am interested in, though, is what set of documents ...
7
votes
2answers
160 views

Delimited arguments and using a macro inside of itself

I wanted to play with delimiter sizing without using the \delimiterfactor, -shortfall, etc. and made the following: \newdimen\bigdim \bigdim = 1.9743ex \newdimen\Bigdim \Bigdim = 2.671ex ...
7
votes
2answers
120 views

Is there a way of defining a command \nullifyifmoved{arg} that will normally act like its argument but act like a no-op if the macro is “moved”?

I'm interested in a macro \nullifyifmoved that takes one argument arg and acts like arg in normal contexts, except it acts like a no-op wherever it is written to a file. Some background: Martin ...
4
votes
2answers
224 views

alternative syntax of subscripts using tex

I would like to sometimes write subscripts using different syntax, instead of $u_{xx} blahblah$ write something like $u⎵xx blah blah$, or even $u⎵xx+blah blah$ where either space following the x ...
4
votes
2answers
379 views

What is the ConTeXt or plain TeX equivalent of \nolinebreak?

The command \nolinebreak[4], if placed between two characters, should prevent a line break from appearing in that location. This command does not seem to be defined in ConTeXt. Is there an equivalent ...
3
votes
3answers
15k views

Error Latex TeX capacity exceeded, sorry [input stack size=5000]

I want to test this template http://students.engr.scu.edu/~sschaeck/latexforthesis/. when i run the makefile i get this error .Please what does it mean this error here the code : ...
15
votes
1answer
473 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 ...