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

learn more… | top users | synonyms

0
votes
1answer
20 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 ...
1
vote
1answer
78 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. ...
3
votes
2answers
32 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
26 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: ...
6
votes
1answer
123 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} ...
14
votes
1answer
137 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
418 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
37 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
123 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
34 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
39 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
69 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
91 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 ...
4
votes
1answer
71 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
68 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
22 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
23 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} ...
1
vote
2answers
46 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} ...
4
votes
1answer
103 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
41 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
93 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
70 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
226 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
122 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 ...
3
votes
1answer
66 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
154 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
56 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
62 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
75 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
67 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
248 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
85 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
36 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
53 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: ...
2
votes
1answer
41 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}{ ...
3
votes
1answer
41 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
218 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
362 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
121 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
38 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} ...
0
votes
0answers
24 views

Problem with \iftoggle and \notblank [duplicate]

I'm having a problem passing parameters through \iftoggle to a \newcommand using \notblank inside; it's much easier to explain by showing a small example: \documentclass{article} ...
1
vote
1answer
46 views

Detect first visibility in a Beamer frame

I'm manipulating a global macro, say \mytext, that I print on every slide. I would like to incrementally add data to that macro in a natural way: \frame{ MyText: \mytext ...
4
votes
1answer
202 views

MakeUppercase and chapter font

I'm using the \MakeUppercase command (from \textcase) (but also tried \MakeTextUppercase cos I thought the problem might be caused by the math-environment of the chapter number) and the ...
4
votes
1answer
80 views

Problem changing spacing for equation environment

My document needs a line spacing of 1.5, if I set this line spacing using the setspace's \onehalfspacing command, or using \linespread{1.5}, the equation environment is also affected. The effect of ...
2
votes
2answers
139 views

Set comment toggle to false, error: Undefined control sequence

I want to toggle comments of and on. Off works, but when I set toggle to true, then I get an error: ./main.tex:36: Undefined control sequence. \endtcolorbox ->\unskip \tcb@after@box ...
3
votes
1answer
88 views

Expanding code in etoolbox's \ifblank

I am trying to use the etoolbox \ifblank (and its cousin \notblank), but I want to expand any macros in its test statement. For example: \documentclass{article} \usepackage{etoolbox} ...
1
vote
0answers
46 views

Set comment toggle to false, error: There's no line here to end [closed]

I want to show/hide comments when toggeling the code below: \newtoggle{comments} %\toggletrue{comments} \settoggle{comments}{true} %set true to show all comments, set false to hide all comments ...
2
votes
1answer
113 views

Is “group=false” option from “standalone” package incompatible with “\addbibresource” from “biblatex”?

Edit. I edit my question in order to make it clearer. Preamble. Thanks to filecontents environment, the compilation of the following with pdflatex generates two subfiles: a bibliographic file: ...