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

learn more… | top users | synonyms

8
votes
2answers
107 views

Getting \let definitions from inside a group, inside a loop

I have the following nested loop situation: \begingroup \def\do##1{% \begingroup \def\do####1{% \csletcs{somemacro@##1@####1}{someothermacro@##1@####1}}% ...
1
vote
0answers
42 views

Creating a csname from a macro [duplicate]

Say I have a macro \bob and that macro is passed to another macro as an argument: \makemacro{\bob} I want \makemacro to create another macro, based on the name of the passed macro, say \bob@two. ...
6
votes
1answer
95 views

set pdfauthor using complex list-processing macro

I have created a macro, \joinlist, that adds commas or other delimiters between the elements of an etoolbox internal list. It has special handling for lists of just two elements ("a and b"). It also ...
6
votes
1answer
116 views

Why doesn't font family change take effect when using AtBeginEnvironment{figure} together with memoir?

I'm trying to use \AtBeginEnvironment{figure} to customize the font family and font size used in figures. However, it doesn't seem to have any effect. Here is a minimal example: ...
4
votes
2answers
628 views

Upright bold greek with condition in math mode

Good day! I googled the whole stackechange, but was not able to find the answer. I'm quite new to Latex, so my approach is not proper. I try to define a macro, that should format greek letter as ...
6
votes
2answers
148 views

Delaying command expansion that appears in \begin handler until \end handler executes

I have a custom environment for handling a code interface declaration that is specified as: \begin{decl}{FOO} \param{in}{bar} the bar input parameter \param{out}{baz} the baz input parameter ...
3
votes
1answer
58 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][]{% ...
3
votes
1answer
131 views

Preprocessing without compiling with etoolbox

I want to know if it is possible to do preprocessing without compiling with the etoolbox package. Basically, I want to do the following. Given a file of the following format: ...
16
votes
2answers
856 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 ...
7
votes
1answer
149 views

Getting a random sublist from a given list

The etoolbox package provides macros to handle list, which can be useful to package/class writers, however it miss macros to get random sublists. So I want to define the following macros: ...
3
votes
1answer
91 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 ...
9
votes
2answers
105 views

Ease the handling of labels

I want to ease the handling of labels in my document, and I want to show the label for a section if define a "variable". Currently I'm doing it like this Setting the up the "variable": ...
1
vote
1answer
201 views

Hyperref link jumps to the first entry of the bibliography entry rather than to its title [duplicate]

This is a follow-up question to Gonzalo Medina's answer of Bibliography in table of contents. One of his solutions for including the bibliography in the ToC is to use the following code: ...
6
votes
1answer
549 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 ...
8
votes
2answers
399 views

Patch tabular environment with colorbox

I'm trying to quickly add a colored background using colorbox to all tables as shown in this answer. While I could just update all the TeX by hand, I am trying to patch the tabular environment to ...
1
vote
1answer
115 views

Problem if csv list is stored in macro for later use with \forcsvlist

I need to store a csv list for later use in the end code part of an environment. Can somebody explain me what's going wrong in the following example? \documentclass{article} \usepackage{etoolbox} ...
1
vote
1answer
138 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 ...
11
votes
1answer
121 views

Save an etoolbox list to a file … and read it after

I have a problem. I would like : to construct an etoolbox list to save this list in a temp file to read this list from this file at the next run to use this file. For any reason, I can't see the ...
5
votes
3answers
254 views

Correct way of test blank element in array

I'm trying to test whether an element in a defined list (array) is "empty." I tried using the \empty macro, or putting white spaces inside the quote, but nothing seems to work. I'm testing the ...
13
votes
1answer
363 views

Help automating calendar creation

I'm doing calendars for all the family, and I have a problem automating the process. I'm using the calendar tikz library. I need to include the moon phase in the calendar. I can do it with this code ...
4
votes
1answer
933 views

Conflict between ntheorem and amsthm

I am using etoolbox and ntheorem packages to have a custom numbering of theorems and equations. Everything works but these side errors occur: \qedhere command is unknown (EDIT: following some ...
7
votes
2answers
384 views

Auto-generating tables using etoolbox

I have a particular problem which I am trying to solve using etoolbox, but I can't figure out how. What I'm trying to do is to auto-generate a table based on information from a previous table. This is ...
9
votes
3answers
268 views

Create macro with several options

I struggle to create a macro that can take several options. What I want to create is for \mycommand[up,middle]{Macro} to output Macro with 'up' and 'middle' specified. Using etoolbox in the MWE below ...
13
votes
3answers
481 views

Get n-th element of a list (with etoolbox, or not)

I'm defining a list and I need to obtain the n-th element of this list. I was surprised that etoolbox doesn't provide a way to obtain it. The way I found to obtain the n-th element is along these ...
2
votes
1answer
94 views

etoolbox patch lstlistings

This is a follow up question to empty page afterpage listings. I'm trying to work around a listings problem with etoolbox: \documentclass{scrartcl} \usepackage{listings} \usepackage{afterpage} ...
4
votes
1answer
307 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 ...
7
votes
2answers
285 views

How to append code to a section?

In my scrartcl document I want to change the spacing between sections and the first paragraph. Since I am using the parskip package, the parskip is set to a non-zero value. The \section command uses ...
6
votes
2answers
177 views

Using etoolbox macros in tikz foreach loops

I am trying to wrap my head around etoolbox for use with TikZ. In this example (I know there are probably simpler ways to do this), I would like to draw a series of rectangles that are next to each ...
3
votes
2answers
272 views

Make a PDF bookmark point towards title

I've been using the bookmark package to add custom PDF bookmarks to my thesis. More specifically, I started using this package because I didn't want the the ToC, LoF and LoT to appear in the ToC, but ...
11
votes
1answer
196 views

Using etoolbox to automatically generate input for \xymatrix

I'd like to make a command \exactseq such that, for example, \exactseq{A,f,B,g,C} corresponds to \xymatrix{A \ar[r]^{f} & B \ar[r]^{g} & C} and such that this works for inputs of ...
6
votes
2answers
265 views

Using \notblank in etoolbox's \ifboolexpr statment

As the title says, I am currently trying to use etoolbox's \ifboolexpr statment on \notblank conditions but I am having issues with it. The code concerned looks like this : \ifboolexpr{% test ...
2
votes
1answer
246 views

Phantom and etoolbox iftoggle

Is there a way to conditionally 'phantom' parts of my document (without typing the same 'phantomed' text twice)? Currently, I am using the etoolbox package, newtoggle/settoggle, and iftoggle to ...
1
vote
1answer
67 views

In output PDF, first letter after \iftoggle condition is removed

When iftoggle condition is used, first letter after the condition is removed in the output. Consider below code \documentclass{article} \usepackage{etoolbox} \begin{document} \newtoggle{test} ...
3
votes
0answers
190 views

Sorting list with etoolbox [closed]

I would like make a listing of shortseries fields in my .bib file. I see etoolbox can help make to made a list of themes and to loop on them. My idea is : for each entry, add the shortseries and ...
5
votes
1answer
931 views

Command \AtBeginEnvironment already defined

I am pretty new to LaTeX. With windows, Miktex/Texmaker pretty-much takes care of package installation whenever needed, but on Ubuntu I have been downloading needed packages from CTAN and installing ...
11
votes
1answer
187 views

Problems with mathtools package

The following code produces an error. If the mathtools package is removed, it works. Why? \documentclass{report} \usepackage{mathtools} \usepackage{etoolbox} \newbool{shorttoc} \makeatletter ...
8
votes
2answers
342 views

Trouble changing font size in figure legends

I'm trying to set the font size smaller in the legends for all of my figures and tables. The way I was trying to do this was using \AtBeginEnvironment but that doesn't seem to do anything at all. This ...
3
votes
1answer
125 views

Append the contents of an environment to a hook using \gappto

I have a global hook (=macro) that should be appended to whenever an environment is executed. (Here, defined by the \bhook-\ehook pair.) However, I was unable to derive a working solution. ...
8
votes
1answer
147 views

On pitfalls of robust commands

These days, I’m more and more defining robust commands, e.g., using \newrobustcmd (etoolbox package) or \NewDocumentCommand (xparse package). Robust commands seem advantageous to me in many respects ...
3
votes
1answer
146 views

multiple lists in etoolbox

I'm trying to have a number of lists using etoolbox that I process near the end of a document. There may be a large number of these lists, and I do not know how many I will have beforehand, so I have ...
4
votes
2answers
230 views

l3prop property stores and etoolbox loops: weird results

I'm writing a class for handling multi-language jargon formulas. My idea is to use l3prop to store, for each formula, its language variations -- i.e., a sort of hash table. Building on one of the ...
8
votes
1answer
250 views

Is there a workaround for this limitation of \patchcmd?

The \patchcmd command of the well-known etoolbox package has a minor limitation: Patching seems to fail whenever \patchcmd is used in the argument of another command and the search/replacement texts ...
6
votes
4answers
469 views

Illegal parameter number with \docsvlist

I'm trying to define a macro that take as an input a CSV list and create an item list. etoolbox comes just handy for this and the macro I'm using is \begin{itemize} \renewcommand*{\do}[1]{\item[] ...
8
votes
2answers
444 views

Why using a backslash in command definitions?

I want to know the reasoning behind the (La)TeX inferface for defining commands with leading backslashes. I see why a backslash has to be used to call (expand) a command (macro), but I do not ...
4
votes
1answer
381 views

etoolbox: trouble with boolean expressions

I'm new at making macros and am in the process of building a package to produce course outlines. I want the user to input room/day/time information as below (where everything has been simplified to ...
1
vote
1answer
132 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
888 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 ...
8
votes
3answers
317 views

error when patching with etoolbox \apptocmd: “the patching command seems to be nested in the argument to some other command”

The \apptocmd command from etoolbox is giving me an error I don't understand. I know how to work around the error in this particular case, but I'd like to understand what it's complaining about so ...
3
votes
1answer
388 views

Create a macro that appends some code an existing command, with arguments

As I am working on improving my answer to Different approach to literate programming for LaTeX, I have created a macro that automatically processes two arguments and formats indexes accordingly. The ...
7
votes
2answers
229 views

Incompatibility between etextools and etoolbox command \dolistloop (\forlistloop)?

The following code uses the etoolbox package to convert a list a,b,c into an internal list (called \mylist) and then typesets that with colons: a:b:c:. However, when I load the etextools package (by ...