Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ifthenelse]

The tag has no usage guidance.

0
votes
0answers
6 views

I want to detect an order placed at the beginning of each theorem

I want to detect an order placed at the beginning of each theorem. \documentclass{article} \usepackage{ifthen,ntheorem} \newtheorem{ex}{Exam} \begin{document} \begin{ex} \LaTeX{} There is the LaTeX ...
4
votes
1answer
65 views

Random Numbers and Variables in Latex

Below is my MWE. I understand the gist of tikz and foreachs, but when it comes to variables I don't understand most yet. I want an arrow pointing from each cell to a module, and them from the module ...
3
votes
1answer
54 views

Display Box A or Box B if then condition

I am using datatool and want to display \posterbox A, hide box B if \TextA = value, if \TextA = blank display \posterbox B and hide box A. Box A & Box B are different: Image, item, color, ...
0
votes
0answers
24 views

Conditionals: “Incomplete \iffalse” [duplicate]

I'm using a boolean variable called flag to toggle extra text being shown or not in tables. I am following this post: Variables for hiding or showing text in Latex \documentclass[12pt, twocolumn]{...
0
votes
1answer
22 views

Print only non-empty variables, with conditional punctuation

I have several variables. I need to print those that are not empty. The first variable printed must be preceded by some text. If there are multiple variables printed, they must be separated by ...
4
votes
2answers
42 views

plain IF structure with one def-ed token and one literal

In some hand-me-down tex i inherited, a control sequence is used as a variable, for instance: \def\accessflavor{ats} it is used to generate postfixes on included tex files (called, i.e., image01_ats)...
6
votes
3answers
316 views

Expand `ifthenelse` immediately

Consider this script: \documentclass{report} \usepackage{ifthen} \newcommand{\thesissize}{SHORT} \begin{document} \setcounter{page}{ %3 \ifthenelse{ \equal{\thesissize}{SHORT} }{3}{...
2
votes
1answer
33 views

help with nomenclature groups and ifthenelse

I am grouping my nomenclature symbols. I'm using the answer from this post: How to make section in Nomenclature? The syntax I've used is this: \renewcommand{\nomgroup}[1]{% \ifthenelse{\equal{#1}...
2
votes
1answer
30 views

Use \ifthenelse{\equal{ on a number called from reference

I want to store an answer key for an exam and then automatically move the multiple choice answer choices around for each question match its predetermined answer. (I need to conform my multiple choice ...
1
vote
0answers
31 views

Conditionally include a line based on an option with pgfpackages

I am trying to design a small package, mostly for test purpose. Currently the package looks like this: % eqbox.sty \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{eqbox}[2019/01/01 Boxed ...
2
votes
2answers
127 views

Detecting subscript in command argument

I have defined a command low that adds a subscript to an argument: \newcommand{\low}[1]{{#1}_{l_{\mathcal{A}}}} However, if the argument of low contains subscripts itsself (for example in the case ...
1
vote
0answers
41 views

\ifthenelse command when using expl3 syntax

What is the equivalent of \ifthenelse{<statement>}{<iftrue>}{<iffalse>} when using expl3 syntax?
2
votes
2answers
352 views

Proper if statement

I have real trouble getting an if statement to work properly.... here is a link to a zip file with all code needed: https://www.dropbox.com/s/ojsj33oe9ac4g09/latex-rechnung.zip?dl=0 My code: \...
1
vote
1answer
31 views

Ifthen statement with array value as an entry

Whenever I try to use an element of an array as an entry for a \ifthenelse statement I get the error Incomplete \iffalse; all text was ignored after line 6. Here's a MWE. \documentclass{memoir} \...
3
votes
1answer
94 views

Error by using changes (\listofchanges) with documentclass amsart

I want to use the package changes with the document class amsart, however, I get the following error message: ! Undefined control sequence. <argument> \equal {\Changes@loc@...
3
votes
1answer
63 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
3answers
390 views

Seven segment display with TikZ

Consider the following MWE: \documentclass[border=5pt,tikz]{standalone} \usepackage{ifthen} \newcommand{\binary}[3]{ \pgfmathsetmacro\number{int(#1*2^0+#2*2^1+#3*2^2)} } \newcommand{\sieben}[1]{ ...
2
votes
1answer
63 views

advancing dates in a 3-day syllabus

I am trying to adapt this advance date method for a 3-day syllabus without success. The goal is to create a M-W-F class schedule. The method in the link above is for a two-day schedule. It takes the ...
1
vote
2answers
64 views

Conflict with \fi in figure captions

I have the following preamble: \documentclass[11pt]{book} % PACKAGES % graphics packages \usepackage{graphics} \usepackage[pdftex]{graphicx} % negative phantoms (\nphantom, \nhphantom, \...
1
vote
1answer
53 views

Conditionals used in a new environment of detection of how many lines of quotation and with the selection of a language in XeLaTeX

I would like that a new environment of quotation/quote detect how many lines a text has, then will increase or decrease the quotation length/margin. For example: \newenvironment{citacao}[1]% {\...
2
votes
1answer
63 views

Indentation of footnotes depending on number of digits in footnote marks on the same page

I wanted to adjust the left indentation of footnotes depending on the number of digits of the footnote mark. Thus, footnotes with one digit are aligned a the length of single \parindent (which is set ...
2
votes
1answer
55 views

How do I get permission for exam materials?

MWE \documentclass{minimal} \usepackage{ulem} book = 1 phone = 0 photocopy = 1 internet = 0 tablet = 1 \begin{document} Book, \xout{phone}, photocopy, \xout{internet}, tablet, \ldots\ free or open. ...
1
vote
1answer
43 views

How to use boolean to toggle display of environment that may contain verbatim?

I'd like to create an environment solution that either displays its contents or nothing depending on whether the boolean solutions is set. Currently I'm trying: \documentclass{article} \usepackage{...
0
votes
1answer
42 views

Protect fragile variable in file path. Case of \ifthenelse in \includegraphics{}

In this script: \documentclass{article} \usepackage{ifthen} \usepackage{graphicx} \newcommand{\myfigure}[1]{% ...
2
votes
1answer
56 views

\ifthenelse as an argument to \equal

In this example: \documentclass{article} \usepackage{ifthen} \newcommand{\objtitle}[1]{% ...
3
votes
2answers
52 views

Add tocline depending on string compare

!! Attention !! Because this topic developed some amount of complexity, I tried to restructure the topic considering the newly gathered information. Please see this post to find the latest detail: ...
5
votes
2answers
407 views

Problem with nested if statements

I'm trying to use some nested if statements to decide if a file exists and what kind of loadings are possible: \IfFileExists{./emoji.sty}{ \ifxetex \usepackage[bw,font=seguiemj.ttf]{emoji} \...
1
vote
1answer
49 views

My if condition does not work. Any idea why?

I have just one question. My if condition does not work. I dont know why. Here is the if condition: \ifthenelse{\boolean{somevariable}}{split dir tree auto,}{} %IF ABFRAGE FUNKTIONIERT NICHT I set \...
0
votes
1answer
63 views

Error with ifthenelse

The code \newcommand{\variableBackgroundColor}{% \ifthenelse{1=1}%\(\boolean{Colle} \OR \boolean{DM}\)} %then {black!10!white} %else {white} } \tcolorboxenvironment{private_exo}{boxrule=...
2
votes
2answers
343 views

Nested if-then-else statements

I try to use nested if-then-else conditions: \documentclass[10pt]{article} \usepackage{ifthen} \newcommand{\printTrueOrFalseA}[1]{% \ifthenelse{\equal{#1}{true}}{true}{false}% } \newcommand{\...
5
votes
2answers
190 views

How test value of a command with `\ifthenelse` and `\equal`?

Revised question (Trying to follow suggestion in comment by David Carlisle.) I want to assign a string as the value of a command and then take alternative actions (by means of ifthenelse) according ...
3
votes
3answers
83 views

Macro that calls ifthen's \equal doesn't work in section heading. Why?

In the following MWE, I have a macro \mytest that tests whether its argument is a or b, returning "yes"/"no", respectively. This macro uses (a) \ifthenelse and (b) \equal from the if then package. ...
4
votes
2answers
232 views

Problem with nesting macros

I have written a macro to denote either the Fourier transformation (curly F by itself) or the Fourier transform of a function (curly F followed by a function and enclosed in \left( and \right) ). It ...
0
votes
1answer
59 views

Getting started with latex and conditional typeset

I'm new to latex and really do not master its dialect and concepts...sorry inadvance. I came to it because I need to create documents that will look different based on the targeted audience. To be ...
2
votes
1answer
52 views

Ifthen and tabularx environment

I want to have the beginning and end of a tabularx table appear only in some cases, but this does not seem to be possible. I get a "Runaway argument error". Why is wrong, or is this kind of ...
2
votes
2answers
137 views

Conditional If-then-else/xIf-then-else Packages

I'm currently working on a presentation about the packages mentioned in the title. The problem I have is, I don't really understand why anyone would use conditional statements in a LaTeX document. ...
6
votes
2answers
259 views

Using \ifthenelse inside an option

I'm trying to create a \newcommand for images which takes width as an optional parameter. This is my current command which works (but doesn't use the parameter): \newcommand{\introimg}[3]{ \begin{...
2
votes
2answers
51 views

Hyphenation of camelCase inside an \ifthenelse while using custom hyphenation command

While writing software documentation, the need arose for a command that automatically hyphenates camelCase words at uppercase letters, e.g. camel-Case. Furthermore, these camelCase words are typeset ...
3
votes
1answer
43 views

Checking a command with \equal and then using that command for another command?

I am trying to check the definition of a command (either arabic, roman, Roman, Alph etc.) and from this information change the formatting of section titles, while making use of the command definition ...
4
votes
2answers
68 views

Alter arguments in custom command

I would like to modify my func command in such a way that the domain/codomain arguments can be altered, e.g. so that arg=R^n yields $\mathbb{R}^n$. \documentclass[a4paper]{article} \usepackage{...
4
votes
1answer
177 views

Why does this test with ifthenelse not compile?

Why does the following test using \ifthenelse not compile: \documentclass[border=30pt, tikz]{standalone} \usepackage{tikz,tikz-3dplot} \usepackage{ifthen} \usepackage{animate, calc}%%%%%%%%%%%% \...
1
vote
1answer
54 views

List of Figures + Beamer? (followup)

I'm interested in making a list of figures in Beamer so that I don't have to cite each image in its caption and I can save slide space. The following example (per users Marco Daniel and Carsten) is ...
0
votes
1answer
46 views

How can I use a conditional into the ganttchart?

I've been trying use a conditional inside my Gantt chart in order to become the process of change color automatically. In this case, I just wanna color red the bars that have progress minor them 100%. ...
2
votes
2answers
109 views

automatically rescaling a document to have an even number of pages

I am trying to use the ifthen package to automatically rescale some custom vertical spaces so that if the document has an odd number of pages on the first compilation, a second compilation will reduce ...
4
votes
1answer
79 views

comparing substrings

I would like to get the following code running, but the second test fails with ! Argument of \@secondoftwo has an extra }. What do I miss? \documentclass{article} \usepackage{xstring,ifthen} \...
1
vote
1answer
118 views

newcommand - conditional execution when parameter empty

I have following command definition (it's entry of an entrylist) which works fine: \newcommand{\entry}[4]{% #1&\parbox[t]{11.2cm}{% #2% \hfill% #3% \\#4% }\\} Now I have a ...
1
vote
1answer
65 views

ifthen condition fails for gitinfo2 metadata

I am using the gitinfo2 package (2.0.7) together with the ifthen package (v1.1c), both from TeXLive 2017, in order to include Git metadata in my document: \documentclass{article} \usepackage[local]{...
2
votes
1answer
58 views

Piping a return value from one command to another command

I am making some elaborate truth tables, and I want to be able to define the further columns in terms of the initial few atomic variables, so that I don't manually have to update the whole thing for ...
3
votes
2answers
72 views

Error when checking for empty list element

When I run this MWE \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{ifthen} \usepackage{xifthen} \usepackage{etoolbox} \newcommand{\Entry}[6][\textwidth-3cm-16pt]{ ...
8
votes
2answers
305 views

\ifthenelse + \equal behaves weirdly

Here's a minimal example of my issue: % test.tex \documentclass{article} \usepackage{ifthen} \begin{document} \ifthenelse{\equal{\string\jobname}{test}} {TRUE} {FALSE} \ifthenelse{\equal{test}{test}} ...