{recursion} is the self-referral operation such that particular steps in a program depend on solutions to instances of the same program (as opposed to iteration).

learn more… | top users | synonyms

4
votes
1answer
58 views

Creating a Droste Effect

Is there any way to achieve a Droste effect in LaTeX? For instance, I'd like to generate a floating figure that contains a rendering of the page it is included in.
6
votes
3answers
213 views

How do I make a list of items in Latex using recursion

I was trying to use recursion in LaTeX to create a list of items. I don't have much experience with LaTeX so kindly explain any uncommon commands used. Here's my code for the same. \makeatletter ...
5
votes
2answers
61 views

How to determine if a macro argument contains the macro itself?

I would like to have a way to detect if a particular macro's argument contains that particular macro itself. Consider the following MNWE: \documentclass{article} \usepackage{etoolbox} ...
40
votes
5answers
2k views

Amusing exercise - ouroboros file - Output of TeX includes itself recursively ad infinitum

Clarification: The question may be related to the the quine fun question, but IMHO it is quite distinct. The question here to write an "ouroboros" in TeX, i.e., a file that includes itself as a ...
4
votes
4answers
105 views

Recursive String Parsing

I have been working on writing a recursive stream processor in latex that converts a shorthand version of a set of highly used commands into a much longer form. The code below represents what I had ...
1
vote
1answer
91 views

cryptic plain TeX: Twelve days of Christmas

Many years ago, probably in TUGboat, I saw a shortish piece of \TeX\ that immediately deploys catcodes and very quickly becomes completely unreadable, but when typeset produces the old "twelve days ...
4
votes
3answers
106 views

using a macro to define the body of a tabular / & separator problem

I'd like to create a macro that can create and fill a multiline tabular with 4 entries per line from something like \bidding{3H,4S,5C,X,XX,-} where the number of entries is of course dynamic. I have ...
2
votes
0answers
93 views

How to use sed to comment some lines in tex files (has “%” a particular meaning for sed ?)

I've been reading something in Most useful sed one-liners for TeX users which is related to my problem, but albeit interesting, it is not what I need. I have many tex (beamer class) files in ...
25
votes
5answers
1k views

TikZ - Recursive Arc Drawing

I'm trying to make Farey diagrams similar to those seen here (click) or the screenshot as follows, Namely, I'd like an example of the one seen on the top of page 6. From there I hope I can figure ...
4
votes
0answers
243 views

How to draw this 3D H-layout recursive tree with Tikz? [closed]

Background: This is an extension problem from my last post How to draw the recursive H-Layout tree using Tikz?. The (2D) H-layout tree is actually from the VLSI layout problem in computer science. I ...
11
votes
2answers
426 views

How to draw the recursive H-Layout tree using Tikz?

The following image shows a recursive H-Layout tree. It is called H-Layout because of its H unit consisting of 7 nodes. My problem is: How to draw such tree in a recursive manner instead of ...
7
votes
1answer
164 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 ...
4
votes
4answers
542 views

Recursive drawing, command flow

I am trying to recursively draw Ck x Ck, where Ck is the k-th iteration of a Cantor set. I have a command which recursively calls itself four times. If I pass N as parameter #6, the output ...
2
votes
1answer
162 views

Modifying \title without recursion problem

EDIT: Much shorter problem definition Having defined a title by \title[short]{long} how can I later add something to the title? The simple assumption \title[\insertshorttitle]{\inserttitle plus ...
4
votes
1answer
128 views

Stack overflow / endless recursion when using menukeys

since I've upgraded from TeX Live 2012 to TeX Live 2013, I have some trouble with a custom package. The package provides some commands that are intended to be used either as standalone commands or ...
8
votes
1answer
104 views

How do the \xx_case: functions work?

In the process of answering expl3 switch for booleans: Is there a \bool_case:Nnn?, I tried to make sense of the various \xx_case: functions Expl3 provides. Here, for example, is \tl_case:Npn: ...
8
votes
3answers
3k views

Commands that may take a variable number of arguments

I have a situation where I want to define a command that takes a variable number of arguments, where the number of arguments is known programmatically via a \count, and process the parameters in some ...
3
votes
1answer
114 views

Recursive Multiple subscripts and superscripts with xparse (Modified Version)

How can I modify the command below to obtain a version (of the question: recursive multiple subscript and superscript with xparse) which does not stack the sub/superscripts horizontally but moves all ...
8
votes
2answers
413 views

Drawing iterations of a recursive structure in TikZ / using node names defined in a loop

This is my first time using TikZ, and I'm trying to draw something related to the Hilbert space-filling curve, based on a recent popular article (HTML, PDF). Specifically, I'm trying to draw the first ...
9
votes
2answers
224 views

recursive multiple subscript and superscript with xparse

How can I define a new command with xparse, something like this: \NewDocumentCommand\tensorkor{ m >{\SplitList{,}}o >{\SplitList{,}}o } { ????? } that i can execute $ ...
7
votes
2answers
213 views

Making a lattice with numbers on vertices

Anyone who is familiar with the problem of counting up/right going paths in a rectangle from bottom left corner to upper right corner knows that one way of doing this is doing it by recursion. I want ...
11
votes
2answers
457 views

Recursive Stern-Brocot tree definition

I am trying to build a Stern-Brocot tree (enumeration of rationals). The result is nearly acceptable, but I am still dissatisfied with the following points. The edge from the parents goes to the ...
48
votes
5answers
3k views

Self-replicating (La)TeX document

Since TeX and LaTeX can print out any text, it should be possible to write a self-replicating document, i.e., a document that is typeset as a PDF/DVI of itself. Have you seen something like that?
11
votes
4answers
975 views

How to make a recursive Latex macro with comma separated argument list

I would like to make a macro that takes two arguments, the second of which is a comma separated list and then produces a nested commutator of argument1 with each entry of argument2. I've been ...
8
votes
5answers
416 views

Define a command (possibly recursively) to wrap text in a command n times

I'm trying to define a new command \multiboxed in LaTeX so that I can put n boxes around an equation without having to manually nest \boxed commands. So far I have (using the pgffor package): ...
5
votes
2answers
611 views

Recursively defined macros in TeX

After receiving a nice answer to a previous question, I got enthousiastic and tried to create a macro \sum such that \sum<1+2+3> would be expanded into 6. My idea was to work recursively, using ...
12
votes
4answers
1k views

Thumbnails of other frames in beamer

I would like to make a presentation with beamer, and have a few frames (at the start or the end) containing thumbnails of the other frames, hyperlinked to them, with something like 4x3 or 5x4 ...
6
votes
2answers
303 views

How can I define a macro that adds a row to a table that has not yet been printed?

I want to generate a list of technical abbreviations and acronyms that I use. Currently, I'm defining all acronyms with a macro I have designed. Now, I want the macro to call another macro, called ...
0
votes
2answers
86 views

How do I add a static number to \recurselevel?

I currently have: \dorecurse{8}{ \startcombination[3*3] {\externalfigure[confcard.pdf][page=\recurselevel, width=98mm]}} {\externalfigure[confcard.pdf][page=\recurselevel+2, width=98mm]}{} ...
3
votes
2answers
570 views

How to make a recursive macro in (La)TeX?

The following MWE is the code of my attempt translating my working algorithm in C# to (La)TeX. I don't understand why it does not work. Can you probe the source of problem? Remarks: #1 is a list of ...
5
votes
1answer
439 views

How to configure latexmk to work recursively? (PDF Thumbnails)

I'm writing a book which will include and explain a handful of different memoir page layouts. Setting the scene In the book, I want to imbed thumbnails of pages from PDFs generated with the page ...
3
votes
1answer
234 views

Recursion - splitting a group.

I've been trying to understand the notion of recursion in TeX - not easy given that my background is the high-level stuff in LaTeX. The only examples I can (just about) understand are very basic ...
5
votes
1answer
7k views

Recursive algorithms with the »algorithms« package?

I need to write a recursive algorithm, using the algorithms package. I thought of writing something like this: \begin{algorithmic} \IF {$x=1} \RETURN 1 \ELSE \RETURN recurse$(x-1)$ \ENDIF ...
7
votes
3answers
488 views

Strange recursive macro output

Strange recursive macro output The code that follows describes a macro that can iterate recursively (i.e, a forloop) and uses e-TeX numexpr. It is based on an example found in the e-TeX manual (page ...