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.

2
votes
2answers
109 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
38 views

\ifthenelse command when using expl3 syntax

What is the equivalent of \ifthenelse{<statement>}{<iftrue>}{<iffalse>} when using expl3 syntax?
2
votes
2answers
296 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
25 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
80 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
58 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
340 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
56 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
56 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
50 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
56 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
37 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
39 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
43 views

\ifthenelse as an argument to \equal

In this example: \documentclass{article} \usepackage{ifthen} \newcommand{\objtitle}[1]{% ...
3
votes
2answers
48 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
383 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
48 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
45 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
253 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
109 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
78 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
220 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
54 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
42 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
120 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
228 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
46 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
42 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
67 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
148 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
50 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
41 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
97 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
69 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
98 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
56 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
51 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
66 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
278 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}} ...
2
votes
2answers
66 views

Conditional output into section works, but not into chapter

I built a custom language-switch macro for my document. It seems to be working fine in some cases, but not in others. How to make this work in any case, e.g. just output the content of the first or ...
1
vote
2answers
153 views

Expanding a macro as the argument to \input results in undefined control sequence error

I'm creating a package which defines a command that looks something like this: \newcommand{\mycommand}[2]{ \input{|"\mypackage@buildcommand{#1}{#2}"} } mypackage@buildcommand uses the ifthen ...
2
votes
2answers
163 views

“\ifthenelse” in minipage or tabular with “\\” in command argument

\documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} \RequirePackage{ifthen} \begin{document} \makeatletter \newcommand{\coreitem}[3]{% \ifthenelse{\equal{#1}{}}{}{#1 \\}% \begin{...
4
votes
4answers
306 views

Is it possible to have a tcblisting environment within an \ifthenelse?

I would like to choose which code to print according to a boolean flag. If I use my \ifthenelse with plain text it works perfectly, but if I put a tcblisting environment instead of the plain text, it ...
1
vote
0answers
157 views

Using \@currenvir in \ifthenelse [closed]

I have looked over several questions on these forums but I seem to be missing something. I am writing a macro in LaTeX to perform one function if it is used inside an enumerate environment, another ...
1
vote
3answers
153 views

`enumdepth` and `ifthenelse`

I would like to generate text based on my current depth of the enumeration. After a little search, I found this. It seems ifthenelse is not respecting enumdepth properly. Am I doing something wrong? ...
0
votes
1answer
40 views

if FinalCompilationBooleanIsOn { use pst packages and input figures }

How to replace the C-like code ? \documentclass{book} % C-like code : #define FinalCompilationBooleanIsOn 1 % C-like code : if FinalCompilationBooleanIsOn { \usepackage{pst-all} \usepackage[...
1
vote
1answer
73 views

Using ifthen to hide page number on certain pages with a page numbering style such as roman

In my document, I want to hide certain things from the headers/footers using ifthen (rather than defining new page styles). For example, I'd like to hide the page number on the first few pages: \...
1
vote
2answers
250 views

moderncv: How to extract the style information and use it in if-statements

I use moderncv for my CV and changed the header for the classic and the casual style (but not the other three styles), following the advice from this post: Moderncv adding date of birth to personal ...
1
vote
1answer
533 views

Remove empty white line in between items (twentysecondcv)

I am still quite a novice at using LaTeX. I'm currently using this particular template to write my CV https://www.latextemplates.com/template/twenty-seconds-resumecv Sometimes I don't want to use ...