Questions tagged [etoolbox]

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

From the official description on CTAN:

The etoolbox package is a toolbox of programming facilities geared primarily towards LaTeX class and package authors. It provides LaTeX frontends to some of the new primitives provided by e-TeX as well as some generic tools which are not strictly related to e-TeX but match the profile of this package. Note that the initial versions of this package were released under the name elatex.

The package provides functions that seem to offer alternative ways of implementing some LaTeX kernel commands; nevertheless, the package will not modify any part of the LaTeX kernel.

559 questions
16
votes
2 answers

etoolbox: AtBeginEnvironment is not At Begin Environment

I tried the following…
ScumCoder
  • 1,639
16
votes
6 answers

How can I undo an etoolbox patch?

Suppose I patch an environment using an etoolbox command such as \AtBeginEnvironment or \AfterEndEnvironment, etc. How can I undo these changes at a later stage? \documentclass{article} \usepackage{etoolbox} \let\olditemize\itemize…
Ian Thompson
  • 43,767
10
votes
1 answer

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) (etoolbox) 'AtBeginenvironment' will not work A minimum…
c05772
  • 864
  • 6
  • 15
8
votes
2 answers

etoolbox do with macro as parameter

I'm trying to make an automatized meeting log generator using pdflatex. I want to create a table with the n rows, and fill them up with comma separated typein inputs. I've got the myTable macro from this answer, and it works fine, if I directly…
Fauszt
  • 81
6
votes
2 answers

How to clear an etoolbox list created using listadd?

This must be trivial, but after 30 minutes reading the manual I can't figure it out (I am a newbie in Latex programming). I see no API for it. I simply want to clear a list created using etoolbox so I can reuse it again. Now when reusing it, it…
Nasser
  • 20,220
6
votes
1 answer

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

Why do these two MWEs produce different effects? \documentclass{article} \usepackage{etoolbox} \makeatletter \def\aeloaded{Not loaded} \def\aechanged{Not changed} \patchcmd{\l@section} {#1\nobreak\hfil} {#1\nobreak …
A.Ellett
  • 50,533
5
votes
1 answer

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 just using the…
Scott H.
  • 11,047
5
votes
1 answer

Obeylines and \gappto from etoolbox

In order to simplify data entry with as little markup of the data as possible, I am attempting the following: \documentclass{article} \usepackage{etoolbox} \begingroup \obeylines \gdef\ing#1 #2 #3{\gappto{\tabbody}{% Collect rows of…
sgmoye
  • 8,586
5
votes
2 answers

Why won't my boolean work correctly?

Sorry for the very open question title, but I can't really figure out what is wrong exactly. I wanted to save a little time when writing semantic types, which are usually subscript but are often recursive, leading to types within types, like…
sgf
  • 561
4
votes
1 answer

Understanding empty \newcommand's in etoolbox.sty

In etoolbox.sty, three commands \ifdefmacro, \ifdefparam and \ifdefprotected are firstly defined by \newcommand\cmd{}, then by \long\edef\cmd{...}. I don't understand why the empty \newcommands are there. One reason I can think of is that…
muzimuzhi Z
  • 26,474
4
votes
1 answer

Strange \patchcmd behavior

I have a question about a strange behavior of the etoolbox package. Roughly speaking, I want to define a command for defining macros so that the user says \mynewcommand\acommand{some code} and it will define \acommand to do some setup stuff, run…
Hood Chatham
  • 5,467
4
votes
1 answer

Is it possible to add a command at the beginning of a chapter?

I found the etoolbox package that allows me to add commands at the beginning of another command. I tried the following but this does not work: \apptocmd{\chapter}{ \exewidth{(34)} } I want to reset a certain value at the beginning of every…
Stefan Müller
  • 6,901
  • 3
  • 29
  • 61
3
votes
3 answers

How to typeset first occurrence of a string differently than the later ones?

My question is similar to this question but I need a solution depending on the input. I'd like to have a command \propername{}, which writes the very first occurrence of the first argument in italic, otherwise normal. I tried to solve it with the…
phip1611
  • 131
  • 4
3
votes
1 answer

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 been trying to use a number in the list name to…
3
votes
2 answers

Reference an element of an array created by listadd

Given the mwe: \documentclass{article} \usepackage{etoolbox} \begin{document} \listadd\terms{First item of the list} \listadd\terms{Second item which has punctuation such as, commas, potentially a period and maybe even other…
1
2 3