13 questions linked to/from How do I calculate n modulo 3 in LaTeX?
1k views

### How can I color parentheses depending on the nesting level (like emacs' rainbow-delimiters)?

Is it possible to have a custom setup for lstlistings for LISP-like languages and have matching parentheses coloured with a same colour taken from a palette? What I am looking for is something like ...
5k views

### Simple way to multiply two values

I have a macro to define the scale of my figures: \newcommand{\myscale}{0.35} Now I have a figure that needs to be scaled twice as big, so I tried to use something like this: \begin{figure}[hbt] \...
615 views

### input tokens through the unicode position

With luatex I can inject tokens with a command through their unicode positions (see the following example). I'm wondering if this could be done with pdflatex too. It doesn't need to have all the ...
1k views

### Is there a better way to check divisibility in LaTeX?

I want to draw a trimmed ruler, for example, from 2.3cm to 3.9cm where the distance between two consecutive marks is 1mm. I have difficulty to efficiently check whether or not the counter is a ...
1k views

### Different headers/borders for each page

I'd like to apply a different heading/border for each page. The footers will all be the same. I want it to look like this: I can make the first two pages different but I don't know how to get ...
2k views

### Modulo calculation in PGFplots tick label

I am printing a diagram and want to use a_[0...3] as tick labels on the x-axis. Right now I have a[0...7] as labels and look for a way to print a[\tick mod 4] (i.e. a_0, a_1, a_2, a_3, a_0, a_1, a_2, ...
195 views

### Selecting grammatical form depending on programatically defined cardinal number (a la ngettext)

There are many languages where grammatical form depends on number of elements described. In English it is singular and plural form (plural usually but not always is generated by adding suffix 's', ...
681 views

### Is a page modulo 4?

If I want to test whether a page is odd/even (i.e. modulo 2) then I can use the following: \ifthenelse{\isodd{\thepage}}{}{} What can I do if I want to test whether a page is modulo 4? A minimal ...
232 views

### How to create pgfplotstable confusion matrix?

How to create pgfplotstable confusion matrix ? Situation I want to create a confusion matrix (for example like this), reading data from a file and displaying it flexibly. Moreover, I found these two:...
63 views

### Row Numbering for every n-th multiple

I'm working in a tabular environment. I am a writing a set of 20+ rows in the environment. At first, I was going to number each row (automatically). But then it occurred to me that I could just number ...
65 views

### Setting \thecounter to user-defined format

I'm trying to get my counter (which has a value between 1--4) to display as a character (namely, the corresponding char from the string SWOT). The following looks right to me but does not do the trick:...