Skip to main content

All Questions

Tagged with
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}} % {} % ...
jed's user avatar
  • 235
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 ...
Jérémie's user avatar
  • 3,011
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 ...
Hammerite's user avatar
  • 3,626
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 ...
Brian M. Hunt's user avatar
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} \...
NVaughan's user avatar
  • 8,225
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 ...
Abhinav's user avatar
  • 511
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\...
Andrey Vihrov's user avatar
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 ...
user839768's user avatar
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} \...
Ben's user avatar
  • 143
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 ...
Joris Meys's user avatar