Tagged Questions

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

learn more… | top users | synonyms

1
vote
0answers
26 views

How to make listing program ConTeXt at LaTeX ?

I want make listing program Context at LaTeX, my MWE like this : \documentclass[]{article} \usepackage{listings} \usepackage[dvipsnames]{xcolor} \lstset { frame=single, framesep=\fboxsep, ...
20
votes
3answers
224 views

How to access the last line of a paragraph with LuaTeX

Consider the following code, using traditional TeX programming that through a series of boxing and unboxing, grabs the last line of a paragraph and centers it. \documentclass{article} ...
4
votes
3answers
74 views

Claim Check Set From A List of Clients

I don't know that this fits here, but here's my question: I'd like to make a set of claim checks from a list of clients so that they can all be printed together within the same PDF. I'm looking for ...
4
votes
1answer
64 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
170 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
81 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 ...
2
votes
2answers
97 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 ...
1
vote
1answer
108 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 ...
6
votes
2answers
88 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
57 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: ...
7
votes
1answer
199 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 ...
2
votes
1answer
72 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
197 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 ...
2
votes
1answer
108 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 ...
4
votes
5answers
177 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
262 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
131 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". ...
5
votes
1answer
77 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
147 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 ...
20
votes
2answers
311 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
756 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
62 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 ...
7
votes
1answer
108 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. ...
7
votes
1answer
94 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
92 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
477 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 ...
16
votes
6answers
458 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 ...
7
votes
2answers
262 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
274 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 ...
5
votes
1answer
226 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
81 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
101 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
142 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
110 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
90 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
213 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. ...
0
votes
0answers
84 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
71 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 ...
4
votes
3answers
107 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
133 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
144 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
123 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
227 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 ...
6
votes
1answer
186 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 ...
8
votes
1answer
98 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 ...