Tagged Questions
9
votes
1answer
132 views
Using \toks registers
I was reading this tutorial for TeX programming:
http://pgfplots.sourceforge.net/TeX-programming-notes.pdf
recommended in the 2-nd answer here: Where do I start LaTeX programming?
It says:
...
25
votes
2answers
745 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?
7
votes
3answers
162 views
When to use or avoid grouping?
For writing my own TeX code, grouping (\begingroup, \endgroup) helps on automatically saving and restoring TeX "variables".
(La)TeX "variables" are either macros or registers. The registers can
...
3
votes
0answers
220 views
What makes TeX so easy to write? [closed]
I have tried various different markup/markdown languages and have found myself coming back to TeX for the ease of typing. I have always wondered what are the features which make TeX such an ...
10
votes
1answer
107 views
How many different concepts of “token equivalence” are there in TeX?
I was living in the delusion that the "token equality" tested by \ifx was the only thing you need to remember about this subject, but this week I learned otherwise (thanks to David Carlisle).
Now ...
22
votes
3answers
519 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 ...
6
votes
1answer
162 views
TeX equivalent to #line
In C there is #line which allows stating the origin of a particular line of code. This is useful for autogenerated C source files: The (unreadable) code in the generated file is mapped back to the ...
28
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 ...
0
votes
2answers
179 views
TeX Programming questions (and stuff about parcolumns)
I'm trying to modify the inner workings of parcolumns. I'm starting to understand the TeX macro "programming" language a bit but I have some issues.
In paracolumns there are three issues I want to ...
8
votes
2answers
224 views
How do I redefine a macro when any group begins, then again when that group ends?
Okay, I know this is a pretty tall order, but I'm working on a package based on my answer here, and I'm including Ahmed Musa's environment which redefines \par. The problems are:
Some environments ...
5
votes
2answers
225 views
how to write content of a command into a file
This question is a possible solution to question Code fails with Emergency stop, when using \expandafter\csname and such in listings, though not really an answer.
I have defined a command which may ...
20
votes
2answers
522 views
Which is better: a dimension or a macro?
When messing around with TikZ/PGF then I frequently find myself wanting to store a length for later use. By "length" here, I mean the word in its non-TeX meaning. As I'm doing stuff in TikZ/PGF then ...
6
votes
3answers
204 views
Removing duplicates from a list
Is there a LaTeX kernel command to remove duplicates from a list?
The list has the structure
\def\alist{john,mary,george,australia,australia}
14
votes
2answers
760 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}%
...
7
votes
2answers
554 views
Problem with dynamic table creation
I've wandered into uncharted territory with a package I'm writing. At one point I need to create a table of 'n' columns (n supplied by user in doc). Creating a variable in the preamble of the tabular ...
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 ...
39
votes
10answers
3k 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 - ...
