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

learn more… | top users | synonyms

1
vote
1answer
83 views

REVTex-like affiliation& author command

I am trying to implement my own version of \affiliation and \author to use in my posters. I would like to have options to show indices of affiliations in the form of \arabic, \alph and \fnsymbol. ...
7
votes
1answer
134 views

Section Title in thmtools List of Theorems

The thmtools package provides a \listoftheorems command that generates a list of theorems/definitions/etc. Here's a MWE: \documentclass[12pt]{article} \usepackage{amsthm,thmtools} \newtheorem{thm}...
2
votes
2answers
46 views

how to use verbatim or verb after checking for flag using \ifbool{}{}?

I had no idea that verb or verbatim are not allowed inside \ifbool check. This makes it very limited. I needed to generate code based on a flag. The code to generate happened to have small part of it ...
5
votes
2answers
310 views

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 ...
10
votes
1answer
144 views

Declare option other than documentclass

I I have a usrdefn.tex file in which I defined some commends/environments used a lot, also there are two version of theorem environments based on the language (english/chinese). Then I want to pass an ...
3
votes
2answers
38 views

How to change the color of the foot page using fancyhdr package?

I'm using "facyhdr" to add a footer on all my pages, and I also use the extension "etoolbox" to color it, but the problem is that it also color the page number, do you know how to color only the ...
0
votes
1answer
22 views

Color only \nameref

I am using hyperref in conjunction with nameref and cleveref, and the objective is for \nameref{label} to be type-set in the link color (which it seems by default is red), but for \cref{label} to be ...
6
votes
1answer
31 views

Interaction of \BeforeBeginEnvironment and \NewEnviron

Consider the following MWE. \documentclass{article} \usepackage{etoolbox} \usepackage{environ} \usepackage{tcolorbox} \usepackage{amsthm} \BeforeBeginEnvironment{proof}{\tcblower} \NewEnviron{...
1
vote
1answer
67 views

Using counter in csdef

I'm trying to implement a map: counter => string + another_counter: 1 => eq1 2 => eq2 3 => ineq1 ... I use \csdef like this: \csdef{probName\thecntProblem}{\csuse{filePrefix}\arabic{...
1
vote
2answers
49 views

Environment behaves different inside \cslet{}

Please scroll down for the EDIT and most recent version This is not a good title, but I didn't come up with a better one. I've got an environment which should be used like this (The way this looks ...
0
votes
1answer
30 views

Raising the hypertarget of chapter labels

When using twocolumn mode, it is a known issue that references to chapter headings point to the baseline rather than the chapter heading. In a previous question, I asked how to fix this for the ...
5
votes
2answers
45 views

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 ...
3
votes
1answer
47 views

help with using etoolbox with docsvlist and listadd

I am looking at etoolbox and not able to find why it gives this error. I am going over an example in the manual, which works. But when I made small change, I am getting an error. This works: \...
15
votes
1answer
152 views

What is exactly a hook in etoolbox

I understand well the \apptocmd and related tools of etoolbox package. However, I still not understand what \appto<hook>{<code>} and related do, even reading three time the handbook ? ...
1
vote
2answers
437 views

Remove indentation from abstract environment with etoolbox

I have the abstract for my paper on a separate page, hence there is no need to have the extra indentation on either side of the abstract environment to indicate that it is an abstract. There is an ...
5
votes
2answers
39 views

How can I use \apptocmd within a macro, passing the appended's macro's parameter back to itself?

Let's say I have the following \newcommand\app[1]{\textbf{#1}} % <- #1 is appended's macro's parameter \apptocmd{\app}{#1}{}{} % <- passing appended macro's parameter to appended macro again \...
3
votes
2answers
126 views

Check if two labels are undefined

I'm struggling to test if there are two labels undefined, in order to include some specific files only in that case. Until now, I only needed one condition: workshop, so I was checking like: \...
4
votes
2answers
40 views

ifboolexpr with a list of toggles - true if any toggle is true

I'd like to write a single file with a collection of e.g. questions, but I want to produce various outputs with a different subsets of all questions each. So at the beginning of my file I want to ...
2
votes
1answer
55 views

Loading BibLaTeX from within the AtEndPreamble hook

The following MWE compiles: \documentclass{article} \usepackage{biblatex} \begin{document} \end{document} whereas the following does not: \documentclass{article} \usepackage{etoolbox} \...
3
votes
2answers
73 views

How to implement a verbatim or null environment using a boolean within \newcommand

I am trying to use a boolean environment within a \newcommand statement to selectively implement a verbatim environment. When I set the boolean to true it should put the "Answer" within the verbatim ...
6
votes
2answers
94 views

Trouble with patchcmd and double #

I need to patch the following macro from gloss-greek.ldf (polyglossia): \def\greek@numbers{% \let\latin@alph\@alph% \let\latin@Alph\@Alph% \if@greek@numerals \def\greek@alph##1{\...
4
votes
1answer
81 views

Pathching \raggedright to solution environment does not work in exam class

Consider the MWE given below. I am trying to patch the solution environment with \raggedright. But it does not seem to work. However, when an explicit \raggedright is issued at the start of the same ...
1
vote
1answer
71 views

.aux round-trip changing encoding?

I have a situation where I write a simple string out to the aux: \ifinlist{#1}\list {} {\listgadd\list{#1}% write to aux "\macro{#1}"} \def\macro#1{\listgadd\list{#1}} When the \ifinlist ...
1
vote
1answer
26 views

csvloop, spreadsheet difference in \expandafter\newcommand\csname and \csxdef

I don't know why but when I test a simple .tex file my csvloop works fine, but when I test in my case, that is much more complex, it doesn't compiles and I don't have any error message, so it becomes ...
3
votes
1answer
24 views

how to \emph a \csname?

How to \emph a \csname\command\endcsname?? I tried to use \csgdef and it works but not for \csname and I need to use \csxdef. \documentclass[a4paper,12pt,hidelinks]{article} \usepackage[utf8]{...
1
vote
2answers
48 views

\IfStrEqCase issue using \csname

I want to use \csname inside \IfStrEqCase but I have an error. Here is my code: \documentclass[a4paper,12pt,hidelinks]{article} \usepackage[utf8]{inputenc} \usepackage[brazil]{babel} \usepackage[T1]{...
4
votes
1answer
111 views

If.. then else and flipping a variable

I am trying to write a template to automatically load files inside directories formatted in a certain way, and I want to print something every time a new file is found in a directory previously empty. ...
4
votes
1answer
47 views

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 ...
6
votes
3answers
95 views

How to apply a do function to two lists?

Suppose that two lists of identical length have been defined with e.g., etoolbox. Is it possible to have a function \do taking two parameters that will process both lists simultaneously, taking one ...
3
votes
3answers
82 views

AtBeginEnvironment does not work with natbib

How can I force bibliography items not to be split across pages? describes how to set the penalties for bibliographies. I tired this but it does not work with natbib. It works if I write the penalties ...
5
votes
3answers
255 views

How to use patchcmd to insert \clearpage before \chapter to avoid breaking page

I want my document to not start new pages when there is a new chapter. My code is the following: \documentclass{scrbook} \usepackage{etoolbox} \patchcmd{\chapter}{\clearpage}{}{} \begin{document} \...
9
votes
1answer
81 views

Using expanded macro as search pattern for \patchcmd

Is there any way to use the value of an expanded macro as the search pattern for etoolbox's \patchcmd (or xpatch's \xpatchcmd, etc), so that one can have some sort of a "dynamic" patch, by way of ...
6
votes
1answer
125 views

Modifying an existing environment, but keeping the name

In my document, I want to follow the advice that says that quotes should be indented and set in a smaller font. Obviously, this is easily done with: \begin{quote}\small ... \end{quote} But that'...
3
votes
1answer
74 views

row color and a toggle

I'd like to create a new command that I would repeat in front of each row, and which would colorize the row if a toggle is true, and would leave it uncolored if the toggle is false. I would change the ...
12
votes
1answer
165 views

Understanding etoolbox macro \deflength

The etoolbox package documentation says about \deflength: This command may be used as a drop-in replacement for \setlength. I am having trouble getting it to work with the \minof macro from the ...
3
votes
2answers
59 views

overloading functions of the fp package

I have a document with several commands that store numeric variables inside an extra macro. This extra macro will highlight that text so I can track them in the printed document. Like so: \...
2
votes
1answer
77 views

Reordering KOMA-Script title (not titlepage) in custom class

I'm trying to define custom styles for the KOMA-Script title which is later inserted using the \maketitle command currently using a mix of the KOMA-Script \setkomafont command and the \patchcmd ...
4
votes
1answer
89 views

Loading packages in custom class based on option

I'd like to define a custom documentclass for assignments which can be optionally passed the minionpro argument to use the Adobe Minion Pro font; if it's not set, the Adobe Utopia font (fourier) shall ...
6
votes
1answer
69 views

Set page counter to account for implicit omitted pages

I recently added an etoolbox toggle to let me choose between the paper or electronic versions of my document. \newtoggle{papier} Primarily, this disables coloured hyperlinks and coloured code using ...
6
votes
1answer
269 views

Errors when loading a package with AtEndPreamble hook

Consider the following (not so) MWE: \documentclass{article} \usepackage[style=authoryear-comp,backend=biber]{biblatex} \addbibresource{biblatex-examples.bib} \makeatletter % Load xpatch and ...
4
votes
3answers
92 views

Etoolbox: how to compare two lists?

My wish is to have two different lists: \listone{a,b,c} \listtwo{a,c,d,e} and to have two macros: \iflistincludedAND{lista}{listb}{<true>}{<false>} which returns true if every item ...
2
votes
1answer
37 views

Problems to properly append chapter without numering to the table of contents

In my document I have a number of chapters, that have their numbering suppressed. I know that to append them to the table of contents one should use the \usepackage{etoolbox} and subsequently define ...
5
votes
1answer
54 views

Reducing space before chapter works with english but not with hungarian babel package

I write my thesis recently and I want to reduce the spaces before chapters. I find the solution, but it isn't working for me with \usepackage[magyar]{babel} I use the following codes: \documentclass[...
2
votes
1answer
42 views

lstlisting breaks ifbool block

I have the following piece of code: \documentclass{article} \usepackage{etoolbox} \usepackage{listings} \newbool{xyz} %\booltrue{xyz} \boolfalse{xyz} \begin{document} \ifbool{xyz}{ \section{...
3
votes
1answer
47 views

How can I prepend code to the \tableofcontents command using etoolbox?

This started by the need to have a table of contents entry in my PDF bookmarks. After accomplishing that, I decided that I wanted to have it always appear bold (supported as of PDF 1.4). I would like ...
5
votes
3answers
240 views

Generate multiple PDFs for different document versions in a single build

I am writing a document for a software which has two versions. Most of the content in the document is the same except few specific details. Right now, I am using the conditionals to build the document ...
11
votes
1answer
388 views

what is the equivalent of \reserveinserts in latex 2015

The release 2015 of LaTeX has included features of the etex.sty package. However, it does not have included the \reserveinserts command. My questions is very simple: what is the mechanism to use to ...
3
votes
2answers
133 views

How to patch with \xpretocmd and \xapptocmd a command by applying to it a macro with argument?

Suppose I'd like to patch a very complicated macro, say \autocite. For this, xpatch package is my friend. If the patch consists in applying a modal command which doesn't take arguments, such as \...
17
votes
4answers
3k 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 (\...
1
vote
2answers
44 views

How to reduce the spacing for empty dates in title (when using the titling package)

I am looking for a marco which changes the behaviour of date (while using the titling package) in the case the date is empty. This MWE A should give a document as normal: \documentclass{article} \...