Questions tagged [ifthenelse]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

How do I fix using the \ChapFrame; temporary removal and permanent attachment of the side thumb headings?

MWE \documentclass[a4paper,twoside,openright,10pt]{book} \usepackage{color} \usepackage{tikz} \usetikzlibrary{positioning} \usepackage[explicit]{titlesec} \usepackage{ifoddpage} \usepackage{lipsum} \...
1
vote
1answer
44 views

Implementing nested if-then-else tests

I would like to implement the following processsing for each row of my data, which is read with datatool: if ( (\No = 5 and \B=11111) OR (\No = 5 and \B=22222) ): \inserpageA else if ( (\No = 5) ...
0
votes
1answer
44 views

Sorting newcommands according to one variable

Two reviewers made several comments on my paper, and I am writing a response letter. I defined a newcommand as follows: \newcommand{\response}[3]{Comment by Reviewer #1 \\ Comment: #2 \\ Response: #3}...
0
votes
0answers
24 views

Using if in tables (spreadtab, tabu)

I was trying to build a document with a table which could change its rows depending on whether the customer needs to pay tax or not. I tried to go with http://handyfloss.net/2007.08/latex-programming-...
1
vote
1answer
42 views

if/else to test if a string is empty failing

Using the following \def \ifempty#1{\def\temp{#1} \ifx\temp\empty } \def \mymacro#1{ \ifempty{#1} empty \else not empty \fi } \mymacro{something} % prints "not empty" \mymacro{} % prints "...
1
vote
1answer
30 views

\ifthenelse statement inside includemedia options

I try to enable / disable some options for my 3D view with \ifthenelse. \documentclass[fontsize=12pt,paper=a4]{scrbook} \usepackage{media9} \usepackage{graphicx} \usepackage{ifthen} \begin{document} ...
0
votes
1answer
49 views

Set path using if / else

Depending on the previous text I need to set e path to folder 1 or folder 2. With just one folder everything worked fine, but with the condition it doesn't. What am I missing? \newcommand{\nc}{text-...
0
votes
0answers
35 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
85 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
67 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
1answer
24 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
47 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)...
5
votes
3answers
321 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
45 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
45 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
36 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
137 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
45 views

\ifthenelse command when using expl3 syntax

What is the equivalent of \ifthenelse{<statement>}{<iftrue>}{<iffalse>} when using expl3 syntax?
2
votes
2answers
366 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
33 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
102 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
82 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
414 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
84 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
81 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
58 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
67 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 ...
1
vote
1answer
56 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
53 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
46 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
74 views

\ifthenelse as an argument to \equal

In this example: \documentclass{article} \usepackage{ifthen} \newcommand{\objtitle}[1]{% ...
3
votes
2answers
68 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
531 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
52 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
85 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
436 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{\...
6
votes
2answers
314 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
87 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
239 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
62 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
66 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
162 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
302 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
54 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
44 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
70 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
202 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
57 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
48 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
117 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 ...