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

29
votes
3answers
35k 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. ...
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 ...
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?
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 ...
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 ...
47
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 ...
71
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.
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 ...
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 ...
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 ...
26
votes
1answer
527 views

What does different \fontdimen<num> mean

I know that \fontdimen<num> returns some dimensions associated with the current font. What are they?
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 ...
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?
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?
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 ...
17
votes
5answers
1k views

Are there purely expandable variants of \MakeUppercase?

\MakeUppercase and \uppercase use TeX's uccode, and they are not purely expandable. Say, \edef\temp{\MakeUppercase{abc}} will fail. Sometimes purely expandable macros are very useful. They are ...
14
votes
3answers
2k 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 ...
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 ...
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.
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 ...
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; ...
13
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 ...
10
votes
3answers
829 views

`\write` non-printable ASCII characters to a file

\immediate\write\SomeStream{x} writes x to the file open in \SomeStream. I would like to write non-printable ASCII characters, such as ``, to a file. My naive guess is \begingroup %To keep ...
25
votes
1answer
2k views

Definition of \strut explained

Can anyone explain me the fine details of the \strut macro. Why is the box \copyied in mathmode but \unhcopyied otherwise? % latex.ltx, line 484, but identical in plainTeX ...
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 ...
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 ...
27
votes
2answers
2k 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 ...
23
votes
2answers
4k views

How to form “if … or … then” conditionals in TeX?

I feel really stupid for asking this, but how do you form more complex if conditionals in TeX? I'm looking for something like: \ifnum\x=1 OR \ifnum\x=14 {do this} \else {do that} \fi I ...
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 ...
21
votes
3answers
764 views

Display hyphenation options for a specific word

When TeX produces Overfull box, is puts something like this in the log: Overfull \hbox (15.47195pt too wide) in paragraph at lines 7--9 []\OT1/cmr/m/n/10 I re-ally re-ally want to get dis-played the ...
11
votes
2answers
938 views

Breakable vboxes

In Plain TeX how can I make vboxes breakable, and can I handle/measure them separately? What I'm trying to do, is that I have a portion of text, that is treated separately (no indention, narrower, ...
7
votes
3answers
1k views

What TeX software to write technical papers with?

I am a noob when it comes to TeX, however, I do use LaTeX for typing mathematical and engineering formulas, etc. Recently I have taken it upon myself to try and write some technical papers to try ...
23
votes
5answers
574 views

Can one define a '\superexpandafter{n}' that would expand to 2^n-1 '\expandafter's?'

This question was inspired by comment banter in this question. See title.
18
votes
1answer
295 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 ...
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 - ...
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?
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: ...
21
votes
4answers
462 views

Can one define an expandable command that removes control sequences from its argument?

I am trying to create an expandable command that accepts a single argument that may contain control sequences, and expands to that same argument with all control sequences and braces removed. That is: ...
11
votes
2answers
691 views

Tricks to make macros expandable

Expandable macros are useful (I find working in the lion's mouth super cool). But they are difficult to write. Can more experienced users give hints that help achieve expandability? For example, we ...
23
votes
2answers
503 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 ...
20
votes
5answers
895 views

Where do I find \futurelet's nasty behaviour documented?

Until recently, I thought that execution of \futurelet\testtoken<token1><token2>... has the following effect: The control sequence \testtoken is \let to <token2> and ...
13
votes
3answers
816 views

How can I open a file in “append” mode?

Could not find anything in the TeXBook, but this could be just me. I guess it is always possible to open the file for reading, copy its content to another file, and then continue writing to that ...
6
votes
1answer
348 views

Use \csname … \endcsname to compute the starred-version of some command

I want to define some commands declaring paired delimiters using the mathtools package in LaTeX. For example, \paren{...} should result in \left(...\right), whereas \paren[Big]{...} should give ...
14
votes
4answers
369 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 ...
13
votes
1answer
714 views

How to change \hsize in the middle of a paragraph at pagebreak, especially for two-column?

The original question is: How to get two columns with different width in LaTeX? I know this older question: How can I create a two-column layout with different widths (and texts) for the two columns? ...
12
votes
2answers
507 views

Why is \baselineskip not inserted before an \unvbox?

It seems that \setbox0=\vbox{\hbox{abc}}\unvbox0 is not equivalent to \hbox{abc}: the former does not insert a \baselineskip in the following situation. \vbox{% \hbox{XY}% \hbox{abc}% ...
12
votes
2answers
1k views

Write to log without wrapping

I'd like to to generate some metadata in the log file that I can copy to another application. But the log file is wrapped to 80 columns and I end up with newlines embedded in what I'm putting there. ...
15
votes
3answers
288 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 ...
13
votes
4answers
468 views

Dividing dimensions to get a count

Is there a way to divide two dimens and get a count? For example, if I have a box that doesn't fit on a single page, and I want to know the number of pages I'd need for the box (i.e., \heightofbox / ...
10
votes
3answers
437 views

Check for empty macro argument

There is a description on how to check whether the argument of a macro is empty in What does \ifx\\#1\\ stand for? Unfortunately, I can't get any of the examples there to work. Among others, I have ...