All Questions
Tagged with grouping conditionals
10
questions
3
votes
1
answer
150
views
Lost global definition after \ifthenelse using package xifthen
I created my MWE with the help of this Q&A.
MWE:
\documentclass{article}
\usepackage{xifthen}% provides \isempty test
\newcommand{\GlobalDef}[1][]{ %
\ifthenelse{\isempty{#1}} %
{} %
...
6
votes
2
answers
398
views
Why can't I use braces in an \if... \fi group?
I am starting to use \newif in a LaTeX class definition to finally stop carrying around all my definitions and imports from article to article.
Since I am trying to define options, I am ending ...
1
vote
0
answers
364
views
Ending a tikzpicture environment in conditional causes "Missing } inserted"
I want to create a number of tikzpictures. I have a number of items I want to draw. Each tikzpicture takes up a whole page and may contain up to 4 items. (It is not good enough to to have each item in ...
4
votes
2
answers
1k
views
Variable persist outside environment
I am using the ifthen package for some conditional formatting. I am storing state in some booleans, but it seems that there is an issue with lexical scope. In particular, when a boolean is set within ...
15
votes
1
answer
565
views
First occurrence of a command
I'm writing some macros that need to behave differently after first occurrence. I decided to use the etoolbox package's toggle. My MWE is as follows:
\documentclass{article}
\usepackage{etoolbox}
\...
41
votes
3
answers
13k
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 ...
31
votes
3
answers
7k
views
What does \begingroup\expandafter…\endgroup do?
I often see code of the following form in package implementations (this example is from the LaTeX3 sources):
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\...
5
votes
3
answers
5k
views
TeX Nested Loops With \iftoggle
This forum has helped me understand how to use nested loops in TeX, but now I am having trouble using \iftoggle (from the etoolbox package) with loops. My goal is to have a toggle that can keep track ...
4
votes
1
answer
721
views
Booleans fail in tabular environment
I've got a workaround for this problem, but maybe someone knows a cleaner way to fix it. I'm using the standard packages in TexLive 2009.
Here's the code that doesn't work:
\documentclass{article}
\...
6
votes
1
answer
858
views
How to display some text based on a condition inside a tabular environment?
I defined a variable \@afwezig that holds people that were not present at a certain meeting.
\long\def\@afwezig{}
\def\afwezig#1{\def\@afwezig{#1}}
Now I want to make the header of the meeting ...