Questions tagged [ifthenelse]

\ifthenelse{⟨test⟩}{⟨then clause⟩}{⟨else clause⟩} evaluates ⟨test⟩ as a boolean function, and then executes either ⟨then clause⟩ or ⟨else clause⟩. ⟨test⟩ is a boolean expression using the infix connectives, \and, \or, the unary \not and parentheses \( \).

20 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
1 answer
66 views

Code optimization: Boolean token equivalent to \ifdefempty, which can combine with \OR or \AND

I'm a new LaTeX user looking for some guidance. I wish to optimize the following code, since lines 3 and 5 are unnecessarily repeated, because I am using \ifdefempty{}{}{}, instead of some Boolean ...
BhaveshDiwan's user avatar
1 vote
0 answers
19 views

I want Section 1 and chapter one the same page. otherwise the section on the new page

\usepackage{ifthen} \ifthenelse{\value{section}=1\OR \value{section}=0} {\renewcommand*{\thesection}{\arabic{section}} \let\bkdsection\section \renewcommand*\section{\bkdsection}} {\...
Trần Văn Quang's user avatar
1 vote
0 answers
162 views

Error "Extra \else" statement with "ceurart"

I am getting an error when I run pdflatex command on the following .tex document. \documentclass[ % twocolumn, % hf, ]{ceurart} \usepackage{minted} \setminted{breaklines=true} \def\UrlBreaks{\do\/\...
A J's user avatar
  • 73
1 vote
0 answers
57 views

How can I switch quickly betwen two style files?

I would like to switch between two styles in a simpler way, I have two sty files (say a.sty and b.sty) and a different bibstyles for each file (say a.bst and b.bst). In order to switch between two ...
SagarM's user avatar
  • 133
1 vote
0 answers
43 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 ...
Vincent's user avatar
  • 4,527
1 vote
0 answers
156 views

\ifthenelse command when using expl3 syntax

What is the equivalent of \ifthenelse{<statement>}{<iftrue>}{<iffalse>} when using expl3 syntax?
noibe's user avatar
  • 2,044
0 votes
0 answers
31 views

Remove \thechapter in the Introduction

I'm using classicthesis with scrbook class, and my headings are defined as follows: \renewcommand{\sectionmark}[1]{\markright{\textsc{\MakeTextLowercase{\thesection}} \spacedlowsmallcaps{#1}}} \lehead{...
Guille Carrion's user avatar
0 votes
0 answers
17 views

Is there a way to change multiple lines depending on a condition?

I'm working on my resume, and I have two versions -- one more tailored towards the Biology/premed side of my experience, and another focused more on my computational side. Right now, whenever I'm ...
asdlkjsadflkj's user avatar
0 votes
0 answers
17 views

Omit page reference if target is on the same or the facing page

I'm working on a two-side scrbook in which references are made to other sections, figures, etc. If the target is on the very same page, I want to omit a page reference in the text (i.e., if we're on ...
hschmauder's user avatar
0 votes
0 answers
21 views

Error Missing Number, treated as zero after two If

I have trouble with \tikzset. When I create a function (here foo), the parameter \lfvert is not recognize on the second if statement. (The node didn't print it anymore) And that give me the following ...
Disatiler's user avatar
0 votes
0 answers
46 views

\newcommand for \ifdefined

Is there a possibility to design a \newcommand for the if-structure? I want to shorten the \ifdefined\todo text \fi into something where I simply need to write \todo text without the \fi.
Steven Schneiders's user avatar
0 votes
0 answers
32 views

How to adapt titlespacing to odd or even pages

\documentclass[a4paper,12pt,twoside]{report} \usepackage{titlesec} \titleformat{\chapter}[display]{}{\chaptername}{-2pt}{\hskip5cm \centering \Huge \bfseries \mbox} \titlespacing{\chapter}{0pt}{-...
superHenry's user avatar
0 votes
1 answer
352 views

Define new environment with conditions

I would like to define a new environment with conditions in my template file. My environment consists in a lign of header filled by a title (given at the environment in an argument) and then at the ...
jg35's user avatar
  • 1
0 votes
0 answers
49 views

Using a variable (?) to change color definition on STY file

I am trying to use a variable I define with \newcommand in a tex file (\profile) in an if-else loop to define a color (\main_color) in the style-file I am using. So when \profile is np \main_color ...
karkraeg's user avatar
  • 101
0 votes
0 answers
51 views

Calculated solution is not recognized as value

In the code below it should be checked if treq<t. In TEST 1, treq is specified as 2.93. The condition treq<t is met and turns blue (or red). \ifthenelse condition works fine. In TEST 2, xreq is ...
PaulJGD's user avatar
  • 199
0 votes
0 answers
102 views

if statement in nested foreach in tikzpicture not working - wrong syntax?

I attempt to place dots on certain grid locations by using a nested \foreach command as follows, but TeXstudio rejects the use of the second variable \y with an error 'unrecognized command'. Strangely ...
Maestro13's user avatar
  • 113
0 votes
0 answers
98 views

Generating multiple versions of a document using a command inside \ifthenelse

I'd like to be able to generate different versions of a document using some kind of print command inside an \ifthenelse statement. Here's an example of what I would like to do. I'd like to do it this ...
Lisa's user avatar
  • 123
0 votes
0 answers
37 views

Changing command definition depending on the font size / location

Currently I define my multiplication with \newcommand{\m}{ \!\cdot\!}} but I would like to have the \! only there if the font is large enough. How do I check for the size of the font? The important ...
Make42's user avatar
  • 1,732
0 votes
0 answers
66 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-...
Make42's user avatar
  • 1,732
0 votes
0 answers
45 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 ...
Anh Tuấn Trần's user avatar