2
votes
1answer
245 views

How to render LaTeX in programs?

Recently I'm writing a calc program, on android. As a frequent LaTeX user, it comes to be compelling to use LaTeX rendering in displaying the inputs and outputs. Is there any possibilities to use a ...
13
votes
1answer
180 views

What practices are there regarding the use or avoidance of “internal” TeX or LaTeX commands?

What practices are there regarding the use or avoidance of "internal" TeX or LaTeX commands? (About "command" vs "macro", there is some discussion in this TeX.SX answer, though I don't know whether ...
29
votes
1answer
912 views

How to generate “You can't use \unskip in vertical mode”?

We all know (or believe so) that \unskip is not possible in main vertical mode and this statement can be found in various answers on the site. And yes LaTeX does a lot of gymnastics in \addvspace or ...
11
votes
1answer
370 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: ...
24
votes
0answers
396 views

Can TeX generate “heap dumps” to analyze+optimize out-of-memory situations?

As package author of the memory-extensive package pgfplots, I have been asked to analyze some out-of-memory situation. I could identify the "culprit"; it was some call to \pdfmdfivesum in which it ...
31
votes
2answers
1k 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
203 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
246 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 ...
11
votes
1answer
135 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 ...
24
votes
3answers
844 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 ...
7
votes
1answer
196 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 ...
32
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
221 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
260 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
239 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 ...
21
votes
2answers
623 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
225 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}
15
votes
2answers
1k 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
731 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 ...
16
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 ...
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 - ...