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

learn more… | top users | synonyms

5
votes
1answer
85 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
417 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 ...
11
votes
1answer
173 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 ...
1
vote
1answer
90 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
183 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
61 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
52 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
504 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
63 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
183 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 ...
0
votes
0answers
70 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 ...
33
votes
0answers
574 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 ...
47
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
167 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
205 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
125 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
51 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
425 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
66 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
116 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
713 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
36 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
108 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
121 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
101 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
724 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
85 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
195 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
469 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 ...
11
votes
1answer
295 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
240 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 ...
18
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
176 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
67 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 ...
9
votes
0answers
84 views

create list of thumbnails for each section

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
135 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
99 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
191 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
136 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. ...
0
votes
0answers
71 views

I need some help debugging this LaTeX macro - TeX “skips past” a bunch of code?

I'm trying to test and debug a collection of LaTeX macros that I've been working on, and I have run into a problem that has me totally stumped. Essentially, the problem is that at a certain point in a ...
1
vote
0answers
62 views

Is it possible to produce a context free grammar for Tikz path? node?

Even further, I would be happy to see a definition of the tikz language in the usual manner programming languages such as Java and Pascal are defined. The reason I ask is that I keep getting ...
26
votes
5answers
744 views

Is there a script that reads a TeX file and replaces every instance of a \newcommand?

I'd like to know if there's a script that reads a .tex file and replace every instance of a non-standard TeX command with whatever it is replacing. I am not sure if what I want is clear but let me ...
4
votes
3answers
98 views

What is the command \csname used for? [duplicate]

Maybe a stupid question...but I often see the usage of \csname in code -- especially in packages. Can someone explain what its purpose is? As far as I see it generates a new command based on an ...
4
votes
1answer
125 views

How to automatically generate the following combinatorical table?

The following shows an example of X possible tables with constraints that will be specified shortly. \documentclass[preview,border=12pt,12pt]{standalone} \begin{document} \begin{tabular}{ccc} n & ...
15
votes
5answers
3k views

How to sort an alphanumeric list

I have been trying to find a package or a method to sort lists of names in an easy manner in TeX/LaTeX. I have tried some of the routines in the xfor package, as well as looked at some of the new ...