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

35
votes
3answers
45k 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. ...
70
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 ...
72
votes
5answers
17k 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?
46
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 ...
95
votes
4answers
17k 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 ...
71
votes
5answers
11k 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 ...
51
votes
5answers
18k 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 ...
36
votes
4answers
5k 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 ...
79
votes
2answers
5k 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 ...
82
votes
3answers
14k 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.
27
votes
1answer
689 views

What does different \fontdimen<num> mean

I know that \fontdimen<num> returns some dimensions associated with the current font. What are they?
60
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?
65
votes
8answers
23k 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 ...
32
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?
26
votes
5answers
2k 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 ...
42
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; ...
57
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 ...
15
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
2answers
1k 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, ...
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
3k 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 ...
52
votes
4answers
7k 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 ...
41
votes
2answers
5k 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 ...
56
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.
29
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 ...
10
votes
3answers
883 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 ...
138
votes
23answers
7k 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 ...
61
votes
2answers
9k 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 ...
24
votes
2answers
5k 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 ...
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 ...
35
votes
2answers
2k 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 ...
22
votes
3answers
924 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 ...
7
votes
3answers
940 views

Showing Solutions of the Questions “separately”

There is a class for LaTeX called exam. Using this class, one can write questions and answers for exams. The answers are displayed under (after) each question. My goal is to have all answers in the ...
24
votes
5answers
592 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.
20
votes
5answers
986 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 ...
19
votes
1answer
383 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 ...
13
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. ...
10
votes
3answers
655 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 ...
48
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 - ...
68
votes
3answers
61k 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: ...
44
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 ...
11
votes
2answers
741 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 ...
21
votes
4answers
504 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
1k views

Which “TeX” should one use?

This question is from my confusion with the editor. In the WinEdt 6.0, there is a button for different kinds of "TeX". How do I know which one I should use and what's the difference?
23
votes
2answers
527 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 ...
13
votes
3answers
901 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 ...
22
votes
2answers
4k views

How do I split a string?

I need to split a string into one or more substrings. I know that I could use the xstring package, but I'd like to do it using only inbuilt TeX/LaTeX commands. So, if I say \def\MyTeXKnowledge{Not ...
6
votes
1answer
365 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
448 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 ...