{etoolbox} is a package which provides several macros which take advantage of the {e-tex} extension of (La)TeX.

learn more… | top users | synonyms

3
votes
3answers
66 views

Separation space between tableofcontents items in beamer

In beamer, I guess, the separation space between the items from tableofcontents is stretchable: Can you set it to a fixed value? e.g. to equal the value used in the itemize environment. Partial ...
15
votes
2answers
115 views

Does etoolbox's \ifboolexpr use lazy evaluation?

In other words, is bool{testB} evaluated at all in this example code? \newbool{testA} \newbool{testB} \booltrue{testA} \booltrue{testB} \ifboolexpr{ bool{testA} or bool{testB} }{OK}{Something's ...
5
votes
1answer
20 views

How to use \patchcmd to change section size in an AMS Article?

I am trying to change the size of the section title in the AMS Article document class from \normalsize to \large. Here is what I tried: \documentclass[]{amsart} \usepackage{etoolbox} ...
3
votes
1answer
40 views

Wrong placement for \preto using etoolbox

I'm observing that the adding a text to a list of tables (or figures) through \preto from etoolbox does not work properly when the table is placed on the next page if it does not fit the page where it ...
7
votes
1answer
57 views

\apptocmd into a conditional—why it does not work?

Why the following MWE does not work while if I comment the conditional it works? \documentclass{beamer} \makeatletter \@ifclassloaded{beamer}{ \usepackage{bookmark} \usepackage{etoolbox} ...
4
votes
1answer
48 views

Navigation circles shown for title page with patch for no-subsections

I'm trying to create a custom theme for beamer. However, when I tried to patch the navigation circles to be automatically included without subsections (using the solution of Beamer navigation circles ...
1
vote
1answer
72 views

Newcommand returning a boolean value

I'm using etoolbox. How can I create a new command that returns a boolean value? For example if I create the following command: \newcommand\ifkeyempty[1]{ \def\novalue{\pgfkeysnovalue}% ...
1
vote
1answer
41 views

Remove empty row inserted by etoolbox

I generate table with some conditional expression using toolbox package. \documentclass{article} \usepackage{etoolbox} \begin{document} \providetoggle{ch} \begin{tabular}{ |l|c|} \hline ...
7
votes
1answer
92 views

Hide an environment and show it later in the document

I am trying to set up an environment for making exercises with corresponding answers for students. Idea I would like to be able to write the text for an exercise in an environment, and directly ...
5
votes
0answers
26 views

Comparing last character(s) of the output of \ref to manipulate output [duplicate]

I am trying to write a command that will replace \ref in a special way. It will add some text next to the number based on the last character(s) of the number \ref outputs. I will try to explain this ...
1
vote
0answers
26 views

etoolbox preto command doesn't work when tocloft package is used

So I am trying to use: \preto\tableofcontents{ ... } to add something before ToC (and same thing for LoF and LoT) in the Class file (i.e. neither adding ... in the real .tex file, nor making ...
4
votes
1answer
52 views

change background if frame has no title

I would like to change my background canvas according to whether my frame has a title. This is the form I'm using (etoolbox): \setbeamertemplate{background canvas}{ ...
1
vote
1answer
60 views

Can a latex IF loop take a perl variable?

I have a script written in perl which harvest data from an sql database, then produces a printed report in latex. I was looking to put an IF loop in the latex part of the script to print one set of ...
6
votes
3answers
71 views

Tabular alignment issue in a loop

I'm getting some odd table alignment issues with a table that I'm constructing inside of a \whileboolexpr. The .tex file is the following: \documentclass{article} \usepackage{etoolbox} ...
4
votes
2answers
108 views

Concatenate macro with string

I try to expand a macro containing a string with another string. It is in the document and thus I want to avoid using @. I tried the following using etoolbox ...
4
votes
1answer
43 views

Strange behaviour of \iftoggle inside tikzpicture

I want to set flag from inside of decoration which I want to check outside of the decoration. I set the flag (call \toggletrue{} or \togglefalse{}) but when I check this flag it always false. For MWE ...
2
votes
1answer
81 views

Adding tables to list of tables with custom chapter breakdown

Running the code below is supposed to modify my list of tables to show the Chapter number above each set of tables related to that chapter. \usepackage{etoolbox} \preto\table{% ...
4
votes
1answer
78 views

\ifnumcomp + \ref

I have a definition with 20 cases or so, and a proof about that definition has one case for each case of the definition. I'd like the proof cases to reorder themselves automatically when I reorder ...
5
votes
2answers
85 views

Boolean key value in xkeyval fails

It is possible to hand over a boolean key value stored in a macro to a command such as \edef\SomeKeyValue{true}% \DummyCommand[DummyBooleanKey=\SomeKeyValue]%%% where DummyBooleanKey is a boolean ...
11
votes
2answers
94 views

how to disable/enable etoolbox global command effect at different locations in a document?

I am not able to figure how to do this, and I did look at the etoolbox documentation The problem is simple to explain: I use etoolbox to append a \clearpage before any \section in a large document ...
10
votes
1answer
83 views

Extra space due to \patchcmd

It seems that \patchcmd from etoolbox adds three unwanted spaces, as shown below: \documentclass{minimal} \usepackage{etoolbox} \begin{document} \tracingall% 3 spaces in ...
8
votes
2answers
119 views

Append \centering to \begin{subfigure} (from subcaption package)

How can I append \centering to \begin{subfigure} (from subcaption package)? I tried using the etoolbox , but for some reason it won't work for the subfigure enviroment (only working for the figure ...
5
votes
1answer
97 views

Forcing the first choice of an newtcblisting environment

I have created a new environment based on "tcblisting" from package "tcolorbox" is code (MWE) is as follows: \documentclass[10pt]{article} \usepackage{tcolorbox} ...
5
votes
1answer
101 views

How do I use the etoolbox package to check if an argument to a macro was defined?

I saw this answer, which uses the etoolbox package to create a macro with an optional argument. Unfortunately, I can't get it to work. Here is a minimal working example: \documentclass[12pt]{article} ...
5
votes
2answers
54 views

How to combine \ifdefstring (etoolbox) with \multicolumn

I need to make tabulars with either norwegian or english column heading above the numbers. I have defined a command, \ReportLanguage, that can be set to either of two values, "no" for norwegian, and ...
5
votes
1answer
58 views

Error output using \ifdefempty

I'm using TeX 3.1415926 (TeX Live 2013) and when I execute \documentclass{article} \usepackage{etoolbox} % contents \newcommand{\contentdesc}[2]{\item \ifdefempty{#2}{\textbf{#1}}{\textbf{#1}: ...
27
votes
2answers
294 views

What's the difference between the various methods for producing for loops?

I've been wondering about the various methods available for looping over a comma separated list and the like. In particular, I was wondering about their various strengths and weaknesses. In other ...
4
votes
1answer
67 views

Loop Multi-Contingency using etoolbox

I want to use the etoolbox package to manage some loop contingencies over a counting index. In particular, I'd like to do something different on the first and last times through the loop. Now I can ...
7
votes
1answer
119 views

I'm confused about how expansion is happening here

I was really pleased that I could come up with a means of building the contents of a tabular environment using \foreach \x in {...} {...} structure. But I was curious about what exactly it would take ...
11
votes
2answers
157 views

How to create a macro “environmentally-dependent”

Yesterday I was reading the etoolbox documentation where there are defined some new document commands such as: \Before<Begin/End>Environment{<envir>}{<code>} % ...
19
votes
2answers
217 views

Is there an easy way to patch commands containing ^^J?

I'm currently looking at various questions related to multicol and try giving answers to some of them. Often enough the answer would involve patching \balance@columns or similar macros and in that ...
4
votes
1answer
98 views

e-Tex and TexWriter

I'm using TexWriter as a LaTeX editor on my iPad. When I try to compile a document I get the following error:"!package etoolbox Error: Not running under e-TeX." I'm also using enumitem package. Is ...
7
votes
2answers
129 views

Incompatibility between etoolbox and hyperref

I tried to compile Werner's second answer from Automatically number inequalities with the hyperref package. However, the first run will give me the error below: Runaway argument? {\@firstoffive }\fi ...
5
votes
1answer
108 views

Package etoolbox Warning: Patching '\begin' failed!

After updating my MiKTeX 2.9 package, .tex files which compiled perfectly with 0 error 0 warning now gives 0 error 1 warning: Package etoolbox Warning: Patching '\begin' failed! (pdflatex) ...
6
votes
2answers
88 views

etoolbox ifblank error with xkeyval

I am trying to create my first class, which is basically just my ordinary preamble with a set of options. These options are handled by xkeyval using the following syntax: \NeedsTeXFormat{LaTeX2e} ...
5
votes
1answer
102 views

How to implement the macros style with mixed chars and floats in a csv file?

I would like to implement macros to generate multiple tables in a document. Some inspiration comes from here: usage-of-longtable-or-equivalent-and-pgfplotstabletypeset The input csv file and ...
11
votes
2answers
166 views

How to process a list and ignore spaces?

This question is part of a new package: metrix. Typeset metric/prosodic symbols standalone and above syllables. I’m wrinting a new package and I need to process a list (using etoolbox at the ...
5
votes
2answers
154 views

Transforming string into tabular row

Trying to have a command converting a string into a (tabular) row, where each cell of the row is (a function of) each character of the string. (\tilerow is my attempt, \tiletext is just for ...
1
vote
1answer
122 views

threeparttable - appending commands to \TPTnoteSettings does not work if package called with flushleft option

In the tablenotes environment defined by the threeparttable package, I wanted to resize my notes globally throughout my document. I have found this answer to a question somebody posted in regards to ...
10
votes
1answer
160 views

Is \AfterEndPreamble really executing code after any \AtBeginDocument code?

The babel package loads the (last) language at begin document, thanks to an \AtBeginDocument command (lines 12.256 and 12.257 of its kernel): \AtBeginDocument{% ...
5
votes
3answers
195 views

Using \ifstrequal in a fontspec macro

Here is my Minimal Failing Example: \documentclass{article} \usepackage{fontspec,etoolbox} \setmainfont{TeX Gyre Schola} \begin{document} \newcommand\Stretch[1]{ \ifstrequal{#1}{narrow}{0.6}{} ...
5
votes
1answer
135 views

Why is \patchcmd not working when also using \@ifclassloaded? [duplicate]

Why do these two MWEs produce different effects? \documentclass{article} \usepackage{etoolbox} \makeatletter \def\aeloaded{Not loaded} \def\aechanged{Not changed} \patchcmd{\l@section} ...
3
votes
0answers
32 views

Integer operations on cross references [duplicate]

I would like to perform integer operations on a cross reference. \documentclass{article} \usepackage{etoolbox} \begin{document} hello \label{here} \ifnumequal{\pageref{here}}{1}{You are on the 1st ...
9
votes
2answers
117 views

Provide boolean from two arguments case insensitives

In most publications scientific names are abbreviated except the first time. Moreover, the names must be in italics and only the first letter of the generic name should be upper-case. The biocon ...
1
vote
1answer
313 views

Solutions in exam class

I'm trying to write up solutions to some exercises, using the exam class. In order to align equations correctly, I'm also using the aligned environment from amsmath. To avoid too much repetitious ...
6
votes
2answers
92 views

Chapter count not increasing

Consider the following MWE: \documentclass[12pt,twoside,letterpaper]{report} \usepackage{etoolbox} \newcounter{totchapters} \providecommand\totchap{} \makeatletter \AtEndDocument{% ...
12
votes
2answers
188 views

Patching arguments inside a macro

Consider the following example of a patch using etoolbox and a dummy macro \abc: \documentclass{article} \usepackage{etoolbox}% http://ctan.org/pkg/etoolbox \newcommand{\abc}[2]{#1\ #2}% Magic ...
2
votes
1answer
97 views

Empty page on the Part page

I'm using this on my document (scrartcl documentclass): \usepackage{etoolbox} \pretocmd{\section}{\cleardoubleevenemptypage}{}{} \pretocmd{\part}{\cleardoubleevenemptypage}{}{} This makes me get ...
11
votes
3answers
264 views

Understanding etoolbox \ifdefempty and \ifdefvoid

I am trying to understand the etoolbox \ifdefempty and \ifdefvoid macros. The documentation says that \ifdefempty Expands to true if the control sequence is defined and is a parameterless macro ...
7
votes
4answers
199 views

Special macro definition (2opt, 1mand)

How can you define a macro \cmd in TeX primitives using two optional arguments (and a mandatory one) that fulfills the property that calling \cmd[opt]{mand} is equivalent to \cmd[][opt]{mand}. Yet, I ...