Tagged Questions
3
votes
1answer
28 views
\setbool not respected in footnote?
Can someone explain why \setbool (from etoolbox) is not respected when used in a command only used in a footnote?
\documentclass[12pt]{article}
\usepackage{etoolbox}
\newcommand{\longshort}[1][]{%
...
15
votes
2answers
150 views
Difference between \newbool and \newtoggle from etoolbox package
Paul Gaborit's answer to How to detect if option provided via \tikzset uses
\newbool to define a new boolean
\booltrue to set a boolean, and
\ifbool to perform a conditional operation
all from ...
3
votes
1answer
76 views
how to comment text depending on a number
I have a latex document with 24 questions labeled with numbers from 1 to 8. I want to give a number x between 1 and 8 to latex in the preamble so that all the questions become commented except the ...
6
votes
1answer
138 views
Applying condition around \intertext and \shortintertext leaves excess vertical space
When I try to make either \intertext or \shortintertext conditional I get excess vertical spacing prior to the conditional text as per the MWE below. Note the excess vertical spacing prior to "Albert ...
1
vote
1answer
62 views
generalize \iftoggle in etoolbox
I am using nested loop conditional \iftoggle of etoolbox, is there any other generalized conditional? Usually it works as:
\newtoggle{name}
\settoggle{name}{true}
\iftoggle{name}{do if name is ...
3
votes
1answer
130 views
etoolbox's iftoggle vs verbatim
My problem is that I can set up toggles, using etoolbox's \newtoggle{x}, set it to true with \toggletrue{x} and even use it with iftoggle{x}{this for true}{this for false}. However, if I try to put a ...
1
vote
1answer
102 views
Using toggles from etoolbox to switch Sweave Schunks of code on and off
I would like to use the toggles from etoolbox to direct Sweave to evaluate or not evaluate chunks of code. Example:
\newtoggle{FirstTime}
\toggletrue{FirstTime}
%\togglefalse{FirstTime}
...
6
votes
1answer
584 views
Switch Between Bibliography and Appendix in fancyhdr
What I am trying to accomplish is a fancyhdr that places Appendix or Bibliography in the header with one single definition. So if I am in the bibliography it should display Bibliography, but should ...
3
votes
1answer
149 views
Code fails when loading boolexpr
I use this code to check for existing column style (see also this question)
But it fails as soon as I load the package boolexpr. Is this incompatible with etoolbox?
\documentclass[]{scrbook}
...
9
votes
1answer
280 views
Hiding section titles when the section is empty
I have created a macro like this:
\newcommand{\showsection}[2]{
\ifstrequal{#2}{}{}{\section{#1} #2}
}
It should be used like this in the document:
\showsection{Books}{
Do you know any ...
17
votes
6answers
1k views
Checking if a number is a multiple of 4
Using etoolbox, ifthen, or another form of conditional checking, how can I check if a value is a multiple of 4? E.g. if the number is 4, 8, 12, 16, etc., then it returns "true".
8
votes
2answers
528 views
Checking if two conditionals are met
I am using the etoolbox package to check some variables. I can use \ifnumless{a}{b}{True}{False} to check if "a" is less than "b" and output "True" if true and "False" if false". How can I check if ...
13
votes
5answers
531 views
Placing many conditionals in a series
I frequently need to do something like this:
IF x < 1, DO a
ELSE IF x < 2, DO b
ELSE IF x < 3, DO c
ELSE, DO d
Using etoolbox, I end up nesting a lot of ifnumless, like this:
...
6
votes
2answers
342 views
etoolbox: environment hooks in boolean switch
What did I wrong, that the following does not work here:
(Edit: I mixed up the true and false parts, but I don't want to change the code, because the answers refer to this in a way confusing one.)
...
3
votes
1answer
269 views
latex @temps(wa) commands
I would like to know more about the temporary commands of LaTeX, such as \@tempa, \@tempswatrue especially for the following construct, where I wonder if my replacement is correct:
% Provide bool for ...
9
votes
1answer
1k views
Comparing an argument to a string when argument is a result of a command with etoolbox
I've got an example like that:
\documentclass{article}
\usepackage{etoolbox}
\newcommand{\ab}{a}
\newcommand{\aORb}[1]{%
\ifstrequal{#1}{a}{"a" was given}{not a}, %
...
2
votes
3answers
460 views
TeX Nested Loops With \iftoggle
This forum has helped me understand how to use nested loops in TeX, but now I am having trouble using \iftoggle (from the etoolbox package) with loops. My goal is to have a toggle that can keep track ...
5
votes
1answer
495 views
Changbars to indicate location of conditional text
I am using etoolbox as per this question on LaTeX conditional expression, and would like to modify the conditional to print some sort of indicator (like a vertical change bar in the margin) to show ...
7
votes
3answers
394 views
\expandafter, \csname issue related to test for macro being defined
Just when I think I starting to understand \expandafter I run into this problem where I am trying to test if \ConditionG, \ConditionH, etc are defined in a loop. I tried all the combinations I could ...
5
votes
1answer
260 views
Biblatex: Idiom for testing contents of list field
I am creating a Biblatex bibliography style for legal citations. In one particular case, I need to format the citation (of a court decision, i.e. jurisdiction) differently depending on the particular ...
10
votes
5answers
844 views
How to test if a number is negative
Is there an easy way to test if a number is negative?
I don't need a general solution, but it does need to be able to handle a floating point value. I was using this solution from tex.ac.uk until I ...
4
votes
1answer
336 views
Booleans fail in tabular environment
I've got a workaround for this problem, but maybe someone knows a cleaner way to fix it. I'm using the standard packages in TexLive 2009.
Here's the code that doesn't work:
\documentclass{article}
...
6
votes
3answers
466 views
etoolbox conditional causes unwanted empty row in tabular
This code leaves an empty row at the bottom:
\documentclass{article}
\usepackage{etoolbox}
\def\somedef{foo}
\begin{document}
\begin{tabular}{|l|}
\hline
First row, not important \\ \hline
...
12
votes
4answers
1k views
Making switch/case with etoolbox's \ifdefequal
I've got a define such as \def\doctype{SomeString}. \doctype can take on one of five values. I want to do something like a switch statement in a programming language, i.e. (pseudocode):
switch ...
