{xifthen} is for questions addressing issues related to conditionals.

learn more… | top users | synonyms

6
votes
2answers
94 views

Branching statement issue (TikZ)

I am using a branching statement in a tikzpicture as presented in the TikZ & PGF Manual (p. 634). Here is a MWE : \documentclass{article} ...
3
votes
3answers
111 views

How to easily write conditional pages? [closed]

Is there any easy way to make latex write only some of the pages? My current idea is to make a function using the ifthen-package in the following way: \newcommand{\WhatDoYouWantToWrite}[1]{ ...
3
votes
1answer
50 views

Requirements and inputvalidation

I want to recreate my current makros to work in every document. Currently I am working on the task, if a package is loaded, the command will be provided as desired. Look at the following MWE, which ...
1
vote
2answers
47 views

Tracking revisions with external txt file

I made the following code to add a revision number to my latex header. I rely on a .txt file, which is assumed to exist in the same directory. always have a number. Anything else will probably make ...
3
votes
2answers
143 views

Conflict between xifthen and fixme?

Given the following MWE: \documentclass[draft]{scrbook} \usepackage{xifthen} \usepackage{fixme} \newcommand\needscitation[1][]{% \fxwarning{citation needed% \ifthenelse{\isempty{#1}}% {}% ...
2
votes
1answer
91 views

Retrieving text from a “database text” file

I refer to my question and the solutions in String comparison in \ifthenelse I hope I can make my question clear enough, I am not a technician. I use a kind of database file (simple text file) with ...
4
votes
1answer
96 views

How to automate introduction of section titles in book

I'm using Spundun's method for automating inputing the entries in a diary, in turn inspired by Peter Grill (Using LaTeX to keep a diary), and I would like to add section dividers by year. This should ...
14
votes
2answers
733 views

String comparison in \ifthenelse

I want find a certain line of text in a data file cities.txt: A;London B;Berlin C;Paris with the xstring and [xifthen][2] packages: \documentclass[12pt, a4paper]{article} \usepackage{xstring} ...
5
votes
1answer
188 views

Using `ifthenelse` to combine two related functions into one

This question is based on Peter Grill's answer to "Table including rows of a master table".. The function PrintDTLTable was in Peter's original answer. I wanted a version that would run over all ...
5
votes
2answers
603 views

(x)ifthen in TikZ

I am searching for a way to conditionally handle some items in a TikZ \foreach specially using an \ifthenelse condition. However, the compiler responds ! Undefined control sequence. <argument> ...
7
votes
1answer
285 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 ...
8
votes
1answer
150 views

Compare the height of arguments

I'm trying to define a \newcommand with three arguments. I'd like to: compare the height of these arguments choose the largest height to create frames (with that height) around the arguments. ...
6
votes
2answers
377 views

How to select conditional text?

I've three variable statements : Statement1 = You are Great Student. Statement2 = You are average Student. Statement3 = You Need improvement on list of topics mentioned below. In the report ...
2
votes
0answers
22 views

Behavior of \global when used with xifthen package [duplicate]

I'm trying to calculate the sum of some numbers in my document. I want to allow non-integer values, so I'm using lengths, which works just fine. In my document it's often necessary to specify the ...
5
votes
2answers
226 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 ...
2
votes
1answer
216 views

Use result from pgfmath with xifthen

I try to use the results of pgfmath calculations with cnttest from xifthen, but it fails: \documentclass{article} \usepackage{pgf,xifthen} \begin{document} \pgfmathparse{42+77}% ...
5
votes
2answers
367 views

Boolean based environments

I know that this question is basically identical to that of Hide custom environment content based on boolean Except I want to avoid using the environ package, which, otherwise, would be the best ...
6
votes
2answers
312 views

How to extend a macro for e-mail addresses to support multiple arguments?

I prepared the following macros to format e-mail adresses in a e-mail header. \usepackage{xifthen}% Provides \ifthenelse and \isempty % E-Mail header strings with format. ...
4
votes
1answer
308 views

PGF loop variables in string comparisons

In a bigger context, I need to check whether an integer parameter is contained in a set of numbers. I decided to encode sets as strings; elements are separated by !. I don't know whether this is the ...
2
votes
2answers
389 views

Test equality between number of the current page and the one of one reference indicated

In the following code, I have one problem with the test \ifthenelse{\equal{\pageref{#1}}{\thepage}}{...}{...}. Why doesn't this detect the equality hoped if the reference is in the same page where it ...