Stack Exchange Network

Stack Exchange network consists of 174 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.

3
votes
0answers
56 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
56 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
2answers
252 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
49 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
44 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
votes
0answers
28 views

if statement to remove spacing between lines

i am working on a resume using a latex template. in the template, there is spacing in case you wish to add an additional bullet point. however, if you don't add that bullet point, the spacing stays ...
1
vote
1answer
42 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
33 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
53 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
25 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
37 views

\ifthenelse as an argument to \equal

In this example: \documentclass{article} \usepackage{ifthen} \newcommand{\objtitle}[1]{% ...
3
votes
2answers
43 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
324 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
47 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
36 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
152 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
75 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
72 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
212 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
51 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
39 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
79 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
216 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
45 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
41 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
63 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
115 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
48 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
38 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
83 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
58 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
84 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
47 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
59 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
250 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
57 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
149 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
144 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
285 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
137 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
140 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
39 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
64 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
238 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
462 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 ...
2
votes
1answer
30 views

“Intelligent” selection between “;” or “.” depending if there is one of next parameters set

\documentclass[a4paper,10pt]{article} \usepackage{ifthen} \begin{document} \newcommand{\ABC}[4]{foo} \renewcommand{\ABC}[4]{% \textbf{#1:}\\ \ifthenelse{\equal{#2}{}}{}{A #2.\ }% \ifthenelse{\equal{#3}...
3
votes
1answer
67 views

Condition on whether filename belongs to a list of filenames

From this site, I've learned how to condition on the name of my latex file. This code below returns the first line of the conditional iff the file is called test.tex \begin{document} \...
2
votes
0answers
432 views

ifthenelse no else with string comparison [closed]

Answer below Issue I am using the package xifthen to try and check if a string variable is equal to a specific string in order to input something. I only want to do something in case the test is ...