{programming} is about how (La)TeX can be used as a programming language.

learn more… | top users | synonyms

4
votes
1answer
40 views

How to merge two rows of 2 columns into a single row of 4 columns without modifying the data entry?

At the beginning I designed a table with a huge number of rows of acronyms. The table has two columns and occupies \textwidth, as follows. \documentclass{article} ...
15
votes
2answers
164 views

\expandafter with \uppercase ordering

As I understand it, the behavior of \expandafter is such that if \a and \b are macros, then \expandafter\a\b will first expand \b then \a. But my understanding must be wrong, because I don't ...
3
votes
0answers
55 views

How can I programmatically draw a nonlinear writing system with automatic graph relaxation?

Alex Fink & I have a non-linear written language, UNLWS. Maintaining its grammar document in Google Docs is growing excessively cumbersome, however, because of how much time it takes to load each ...
20
votes
2answers
301 views

Embed TeX as a typesetting system for an eBook reading application

Are there any projects or information on how to use TeX to typeset texts for screen reading? That is, I want to get the beautiful output of TeX to render in a browser-like desktop application. I want ...
94
votes
3answers
11k views

Where do I start LaTeX programming?

I'm interested in writing packages for TeX/LaTeX/XeLaTeX. I googled around, but all I found was guides or tutorials about how to prepare documents using LaTeX. I want to know how LaTeX works and how ...
2
votes
1answer
89 views

Three dots instead of \ldots

When writing the TeX-codes we often use the 6-symbols \ldots command. It should be more comfortable to type merely three dots ... instead. Just the same as for TeX-parsing the minus symbols - or -- or ...
2
votes
0answers
72 views

LaTeX3: If next in input stream is command X or environment X, do Y else Z

Because I write my own document class (okay, I try to ...), this question bothers me for weeks as there are many situation, in which I need something like this. Is there a way to test, if the next ...
103
votes
5answers
9k views

LaTeX3 versus pure Lua

Reading this site for the last nearly two years I've learned a lot about LaTeX3 (which I had previously understood to be a defunct pipe dream) and LuaTeX (of which I was previously totally unaware). ...
5
votes
1answer
88 views

Partial expansion: macro arguments and nothing more

I am in search for a package that would allow me to do write a command of the following sort: \tofile{filename}{One}{Two} FROM HERE here is some nonsensical list of commands, ...
7
votes
4answers
260 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}
22
votes
3answers
425 views

How to compile the same input file for each of LaTeX font packages installed in our machine?

Inspired by my question How to create a PDF presentation for each available Beamer theme automatically?, now I want to compile my input file for each available LaTeX font package installed in my ...
1
vote
1answer
99 views

How to open AdobeReader with arara?

... strange question you will think and you are right, but there are some features, that are not shown in the PDF-Viewer from TeXworks, tooltips for example. I tried this rule, which executes an ...
7
votes
1answer
192 views

How can I optimize the arara password program?

I have written the following (runable) arara-program, which creates a password-locked pdf with adjustable prohibited access rights: secure.yaml !config # GhostScript-ps2pdf password-security rule ...
6
votes
2answers
70 views

Reading number from file into variable — How to put a number into my document that increments with every compilation?

I am not that much into TeX/LaTex programming ... but what I want to do is the following: How to put a number into my document that increments with every compilation My ideas so far are: use a ...
3
votes
1answer
53 views

Conditional structure based on \rand value comparison

I have a simple code that inserts a complex layout for figures and I would like to randomly alternate the position options (for instance, alternating between top and bottom positioning: ...
22
votes
3answers
523 views

How to compute the remaining space on the current page

Is there a way to compute the remaining space on the current page and issue an optional command?
2
votes
1answer
70 views

The inputenc package slows down LaTeX compilation

When using packages inputenc and fontenc I observed that the inputenc package strongly slows the compilation speed. The situation is as follows. Let we have \usepackage[cp1251]{inputenc} ...
6
votes
4answers
192 views

Multiply fine tuning with a thinspace \,

What I want is a redefinition of command \, to the version \,[N] for given integer N \, % standard usage \,[2] % the same as \,\, \,[3] % the same as \,\,\, and so on The usage of \hspace instead ...
38
votes
0answers
666 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 ...
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 - ...
4
votes
5answers
172 views

macros, category codes, how to pass stuff with cat codes inside?

The original question is below (it was a bad simplification of the problem I had and also before being edited, it also contained major syntax errors). The problem that originated the question is why ...
4
votes
2answers
230 views

Parsing and programming in TikZ

Background: I'be been reading the PGF manual (keys section) and today the TeX Book just arrived in the mail and just started reading chapter 7 (How TeX reads what you type) -- feeling like Mickey ...
5
votes
1answer
127 views

How can I use arara to get a graphics file?

In a standard TeX Live distribution Ghostscript is, to my knowledge, present; it is hidden, but it is there. Edit: Yes, it is under \Texlive\2013\tlpkg\tlgs So to my question: How can I use ...
5
votes
0answers
52 views

Good resources to understand how LaTeX is constructed layer after layer? [duplicate]

I have been a user of LaTeX for a couple of years now, and I would like to start to be involved in the writing packages. The problem is that currently, a lot of things appear to me as "black magic". ...
16
votes
6answers
444 views

How to automatically generate a stack diagram for a PostScript expression?

The following figure shows a PostScript expression and its stack diagrams step by step. Is there any package to generate it out of the box? If there is no such a package, how to generate it ...
5
votes
1answer
72 views

TikZ programming/macros, \list construct

TikZ 3.0 manual, on page 83, we have (not complete code): \list{--}{\topsep=2pt\itemsep=0pt\parsep=0pt \parskip=0pt\labelwidth=8pt\leftmargin=8pt \itemindent=0pt\labelsep=2pt} #5 ...
2
votes
0answers
34 views

How can I get a date object in LaTeX? [duplicate]

I want a date object I can just sprinkle throughout my document at any moment. For example, I might type "Today (\date) happens to be quite nice."
1
vote
0answers
131 views

Dynamic programming of cheapest cost in LaTeX

From How can I automate the generation of this dynamic-programming graph?, Jubobs helped develop a foreach scheme to draw the paths. I was wondering if LaTeX can find the cheapest path by ...
11
votes
2answers
733 views

Make an C programming language array in LaTeX

Im wondering if I can do some kind of table in LaTeX in order to show my C array nicely in text? I did something like this in KolourPaint: Tried to do the same with LaTeX tables, but with no ...
4
votes
1answer
43 views

Biblatex field values and comparisons

I would like to change the behavior of printing author names based on the hash field in biblatex. This mwe should demonstrate what I am having difficulty understanding. MWE: \documentclass{article} ...
4
votes
0answers
35 views

Is there a good reason to define helper macros second? [duplicate]

As a mathematician, my training is to define my terms before I use them. As a computer programmer, I recognize that there are sometimes good reasons to call a method/function/procedure before its full ...
5
votes
2answers
114 views

Boolean key value in xkeyval fails

It is possible to hand over a boolean key value stored in a macro to a command such as \edef\SomeKeyValue{true}% \DummyCommand[DummyBooleanKey=\SomeKeyValue]%%% where DummyBooleanKey is a boolean ...
5
votes
1answer
130 views

Tikz Procedure/Function like abstraction? [closed]

I am pretty new to tikz but, so I do understand the basics, however, I am truly confused on what's the best way to create a procedure like constructs: there seems to be so many mechanism, and I cannot ...
7
votes
1answer
106 views

Make the pattern of a \def depend on another macro

I would like to set up a macro defined something like this: \def\processline string: #1.#2\relax{\gdef\errorline{#1}} The catch is that the string should be given by the contents of another macro. ...
26
votes
2answers
753 views

Create a “List of Effective Pages”

I am considering learning Latex in order to more easily maintain a bunch of manuals for my company. One of the requirements is to have a "List of Effective Pages" towards the beginning of the ...
7
votes
1answer
93 views

Include ALL pdf graphics in document

I have several plots saved as .pdf in a folder and I would like to know if there is a way of adding all of them in a document at once, without typing the path to each file.
7
votes
2answers
89 views

Break line within a macro while writing to a file

I am trying to use (La)TeX as a macro pre-processor for a programming language. My idea is to use the VerbatimOut environment from the fancyvrb package to output essentially verbatim text, but using @ ...
6
votes
1answer
229 views

How to write a bounding box information in PostScript to an external file and read it in TeX at the second compilation?

Scenario I want to create a new environment, e.g., pscanvas that does not need any size specification but just a unique filename. It can contain any graphic objects that pspicture can contain. Thus ...
12
votes
4answers
473 views

Condition within condition

Consider the following logical satatements: If \conditionA != 100 and \conditionB != 100 do ``Something~A'' If \conditionA != 100 and \conditionB = 100 do ``Something~B'' If \conditionA = 100 and ...
12
votes
1answer
310 views

ConTeXt: How do you create your own commands?

There seems to be a Current and Standard way to define new (core) commands in ConTeXt. For example, an e-mail by Wolfgang states: Many of the \define... and \setup... commands are now auto ...
7
votes
2answers
252 views

What are other programming languages with APIs for drawing graphs?

My apologies if this is not the right place to ask this question. If so, I would appreciate it if it could be told to me where I should post it instead. Recently I came across a question which I ...
19
votes
3answers
2k views

Delete an element from a comma delimited list

LaTeX's low-level programming is poorly documented and the section on what is called control commands is even more so. LaTeX provides the \@for macro. This works by repeatedly assigning list items ...
5
votes
1answer
193 views

Creating a simple list of symbols

Inspired by this great answer I tried to manually create a glossary-style environment for a simple list of symbols. Basically I wanted to create a command newsymbol that can be executed from anywhere ...
0
votes
0answers
74 views

Software/Programm: latex-based math trainer

I need some help, because I searched the internet for quite a long time, but I wasn't successfull in getting a solution: I'm looking for a program/software, which helps me to practice math, which is ...
10
votes
0answers
98 views

create list of thumbnails for each section [closed]

I want to create a cooking book. There I want to define for each receipe a thumbnail image. At the beginning of each chapter I want to show instead of a TOC a gallery of thumbnails of each subsection ...
5
votes
2answers
137 views

The least intrusive and most elegant for removing \documentclass?

Here is the context: I have a file named (say) 00.tex, which I use in the following elaborate way. Compiling the file, generates auxiliary tex files, which in turn execute \include{00.tex}. The ...
5
votes
2answers
103 views

Is it possible to make \usepackage depend on paper size? [duplicate]

I currently have a document (.tex source files), where I define the paper size and one sided design as class options. I use the KOMA-Script class scrbook. in A4 format for printing on usual printers ...
4
votes
1answer
199 views

Tips for effective 3-dimensional authoring: tikz, animation, and text flow

I work hard these days on writing animated graphical beamer presentation, which sometimes contain over 100 slides. I find that I need to think across three interacting dimensions: The time ...
3
votes
1answer
143 views

Is there a GUI, package, or plugin that I can use to create InDesign-like textboxes that contain LaTeX markup?

I'm not very spatially aware and I'm looking for an app, program, plugin, or extension that would allow me to create indesign-like text boxes (that I can drag around a page and select) that can ...
0
votes
0answers
29 views

Tikz \foreach: How to iterate over a list stored in a macro? [duplicate]

The title says it all. I would like to create a list in a macro, and then iterate over it using TikZ's \foreach macro. Alas, as usual, superimposition does not work here, as the following MWE shows. ...