12
votes
4answers
460 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 ...
2
votes
1answer
74 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 ...
6
votes
2answers
306 views

Expand command read from file

I have a file, that contains a list of latex commands each command per line. Now I want to read this file line per line and execute/expand the macros automatically. I tried the following but this only ...
12
votes
3answers
241 views

Gobbling an argument if it starts with #

My problem comes from pandoc and markdown, but it is not directly related with these tools, but instead with "customizing" the resulting pdf via some tex macro programming, so I think it is on topic. ...
10
votes
1answer
215 views

querying whether a font feature has been activated via a fontspec command

A LaTeX package I'm currently writing makes use of -- and definitely requires -- some of the power of LuaLaTeX. I would like to make my package's user interface -- in particular, the options that need ...
6
votes
1answer
108 views

Package providing fully expandable conditionals

Is there a package providing a collection of fully expandable conditionals like this one: \newcommand\myif@num[1] {\ifnum#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} Background: ...
5
votes
2answers
137 views

\let versus conditionals for customizing macro behavior

I have a large collection of macros that do different things but all eventually use the same macro internally (call this macro \tasks). Sort of like this, but with better macro names: ...
1
vote
1answer
233 views

keyvalue with kvoptions and switch structure

I am using kvoptions for a key-value syntax. However I need a switch syntax for the evaluation. Since boolexpr is problamatic (see here) I use now the other solution of this question. However the ...
2
votes
1answer
112 views

Check if multiple column types are defined fails

Using the commands of the discussion How to check if a column type is defined? and How to implement a command that checks for loaded packages? I have build an enviroment to check if more than one ...
3
votes
1answer
380 views

latex @temps(wa) commands

I would like to know more about the temporary commands of LaTeX, such as \@tempa, \@tempswatrue especially for the following construct, where I wonder if my replacement is correct: % Provide bool for ...
9
votes
3answers
665 views

How to implement a command that checks for loaded packages?

I use the following code to check if a package is loaded: \RequirePackage{ltxcmds} \newcommand{\IfPackageLoaded}[2]{\ltx@ifpackageloaded{#1}{#2}{}} However, sometimes I want to check if more than ...
0
votes
2answers
185 views

Conditional \endinput

I want to prevent processing rest part of a package in case if it is loaded not from lualatex. For some reason I cannot load ifluatex package, so I borrowed definition of \ifluatex from that package ...
7
votes
2answers
334 views

how to compare two booleans?

I want to test if either inputenc or selinput are loaded. My problem now is to do complex boolean expressions and I have no clue how to do that with LaTeX. The basic code would be something like ...
24
votes
3answers
6k views

When to use @ in an \if statement

I am new to LaTeX and so this question might come across as rather basic. It might also reflect my biases/assumptions from my C/C++ programming days. I was seeing the code of the 'exam' class and ...
12
votes
2answers
336 views

How does one detect whether one is in the preamble or not?

In LaTeX, I'd like to know whether a documentclass has been loaded and whether code is inside a \begin{document}. In other words, is there a \ifpreamble similar to \ifvmode and friends? ...
6
votes
1answer
193 views

Asserting reference inequality

Is there a way for including assertions in a LaTeX document? I want to check that some condition is true, and only allow compilation of the document if it is (or at least complain otherwise). ...