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

learn more… | top users | synonyms

3
votes
0answers
37 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 ...
11
votes
2answers
617 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
19 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
34 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 ...
7
votes
1answer
94 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. ...
6
votes
1answer
82 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
60 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 @ ...
12
votes
4answers
458 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 ...
15
votes
5answers
361 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 ...
6
votes
2answers
193 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 ...
6
votes
1answer
138 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 ...
4
votes
1answer
133 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
50 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 ...
8
votes
0answers
59 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
129 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
89 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 ...
5
votes
1answer
62 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, ...
4
votes
1answer
159 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
104 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
44 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
58 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 ...
3
votes
3answers
86 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
120 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 & ...
5
votes
1answer
94 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 ...
5
votes
2answers
85 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 ...
4
votes
2answers
144 views

Passing parameters to tikz picture?

I wrote a tikz diagram, which resides in its own dedicated file. I would like to include this file several times in my document, each time highlighting a different node in it. I tried defining a macro ...
4
votes
0answers
142 views

How to fix the error when importing EPS images with spaces in their path?

I am using Windows. The objective is to import all images in a sub directory. I divide into 2 categories, for PNG and EPS, separately as follows. For PNG This category works without problem. So you ...
6
votes
0answers
58 views

How to mimic LINQ's query method for macro's key-value?

Inspired by LINQ's query method, such as deck.Take(randomCount) .Where (card => card.Suit == "Hearts") .Skip(2) .Take(5) .OrderBy (card => card.FaceValue); The deck which is ...
0
votes
1answer
114 views

Document management system [closed]

Is there any free / open source DMS for latex documents , which is simple to install and manage, not bulky (enterprize grade), help search the document and has revision control if possible? (I've ...
20
votes
3answers
320 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
124 views

Why does \numexpr integer division round rather than truncate?

In my use of \numexpr's integer division / I have never gotten any advantage from the fact that it rounds rather than truncates. TeX's own \divide truncates. If we were dealing with floating point ...
3
votes
2answers
92 views

Is there another way to avoid name clash in nested multido?

Constraints I want to use the same name for inner and outer loop. I am reluctant to append @ and make use of \makeatletter...\makeatother. Is there any name-spacing construct to use? MWE The ...
5
votes
2answers
107 views

How to buffer the extreme value of f(x) to draw a line representing a range of f(x)?

Please consider the following animation. \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-plot} \def\f{x^2-x-6} \psset{unit=3,algebraic} \def\Atom#1{% ...
4
votes
1answer
84 views

Why does \includegraphics[\varone]{\vartwo} not compile?

I want to convert each EPS image imported from within the input file to a PDF version and save it with its original name separately. The code below simulates the real condition in which we don't want ...
30
votes
3answers
1k views

Programming Conway's Game of Life in LaTeX

My aim is to program Conway's Game of Life in LaTeX, and make the output into an animated PDF. I intend to use PGF/TikZ for this, especially pgfmath, but I'm stuck at the moment because I need to ...
6
votes
2answers
73 views

Prime as an argument of command

Suppose we are in math-mode and I want to use command \E with the following behaviour. If one or two primes follow the command, i.e. \E' or \E'', then I want to have in these cases certain ...
7
votes
3answers
89 views

How to iterate through all user-defined control-words?

\documentclass[preview,border=12pt,varwidth]{standalone} \usepackage{pgffor} \def\Person#1{% \ifcsname#1\endcsname \else \expandafter\def\csname #1\endcsname{#1}% \fi ...
2
votes
1answer
72 views

Conditional assignment in a loop

Objective: I want to compile the temporary.tex file containing PSTricks code twice. One with -jobname=Rotated and the other one with -jobname=Unrotated. The resulting Rotated.ps will be passed to ...
7
votes
1answer
139 views

Macros with binary trees as arguments

I would like to have some macros which have binary trees as arguments. For the purpose of these macros, a binary tree is either root or it is {branch1}{branch2} for two binary trees branch1 and ...
5
votes
2answers
81 views

How to redeclare $$ or the \[, \] pair

There might be probably many reasons not to do it, but what would be the proper way to redeclare the $$ sequence or the \[,\] pair to open by default some special display math environment, such as ...
5
votes
1answer
67 views

Making uses of cleveref packages standalone

I have used cleveref package for referring to equations, figures, etc in an article. However, I wish to compile my tex file on another system which only has a basic version of tex. I wish to make my ...
1
vote
0answers
56 views

Programing in Latex, if and? [duplicate]

I know about \ifthenelse. Is it possible to programming in LaTeX like in C, with loops and arrays?
3
votes
0answers
2k views

Programmatically generating LaTeX with Python [closed]

I'm fairly new to LaTeX and I want to generate some reports using Python. Here is some code that creates a simple table. After coding this up I began to wonder if there isn't a better way to do ...
8
votes
3answers
155 views

Simple Key Events table

Consider the simple time-line table shown in the image below (extracted from a book). and the MWE below defining it as an environment, \documentclass[twocolumn,10pt]{article} ...
6
votes
2answers
271 views

How to code an auto-increment counter in LaTeX

When typesetting letters is common practice to have a reference such as: XXX-yl-0001 Where the last number is incremented for each successive letter. Normally, I hand-code the number. When ...
3
votes
1answer
79 views

How to begin a package (newbie style)

I am kinda new in LaTeX, but I'm trying to make a "package" to display abstract structs algorithms in beamer. Ex: \binarytree[]{a->b.c, c->e.f} and my plan is to make this visual algorithm to ...
2
votes
1answer
182 views

Hooking in before \documentclass

In the consequence of a previously asked question (Is it possible to hook in after options have been processed in a certain package or class?) I had the idea of a hook that adds code even before ...
3
votes
1answer
51 views

Is it possible to hook in after options have been processed in a certain package or class?

In other words: Is it possible to scan the input stream of a .sty or .cls file (without using Perl) for \ProcessOptions\relax and nest some given code afterwords? (The filehook or etoolbox package ...
5
votes
1answer
158 views

Special daily calendar for whole year needed

I need to print out a special daily calendar sheet for every day of 2014. The solution here: Page a day calendar problems no longer is available, the link to mattjy.me is dead. The whole daily sheet I ...