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

learn more… | top users | synonyms

5
votes
3answers
128 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
72 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
109 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
42 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 ...
1
vote
1answer
63 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. ...
5
votes
1answer
102 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} ...
12
votes
1answer
134 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
47 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
40 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
50 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
61 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
199 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
66 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
31 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: ...
1
vote
1answer
26 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
36 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
203 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
295 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
100 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
29 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
41 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
146 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
67 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
80 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
50 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
39 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
97 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: ...
5
votes
1answer
173 views

Scrreprt indent after chapter heading after patchcmd

In the following example, I've added a patch to the \chapter as an attempt to fix hyperref links. (See Hyperref chapter in twocolumn mode (without using multicols).) ...
7
votes
4answers
208 views

How to check if a macro expands to one of several strings?

I have the following problem: I am using the etoolbox package to check if a macro (say, \foo) expands to one of several possible strings (say, bar, baz, abc, or other). I need to execute different ...
16
votes
1answer
252 views

Patching commands in LaTeX3

Is there some facility in the LaTeX3 kernel to modify existing commands like etoolbox's \preto \appto and \patchcmd do?
4
votes
2answers
116 views

“Runaway argument?” just in the \input file

Update: Upon @egreg suggestion, the case shown below is the core of the problem and has nothing to do with include/input statements. I have a verbatim within toggle statements, which fails. A minimal ...
1
vote
0answers
27 views

Inverse Search with etoolbox

I have a collection of documents, all of which contain a common "sub-document" using the subfiles package. These different master documents all define various booleans using the functionality from ...
1
vote
0answers
94 views

sans serif math font selection using unicode-math

I am typesetting a document in XeLaTeX using a serif font for main text, and a sans serif for everything else (section titles, tables etc). For setting of mathematics, I use TeX Gyre Pagella Math. ...
6
votes
1answer
1k 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} ...
20
votes
1answer
5k views

Comparing an argument to a string when argument is a result of a command with etoolbox

I've got an example like that: \documentclass{article} \usepackage{etoolbox} \newcommand{\ab}{a} \newcommand{\aORb}[1]{% \ifstrequal{#1}{a}{"a" was given}{not a}, % ...
3
votes
2answers
49 views

ifthen and etoolbox cause faulty index

I am using the ifthen package to include/exclude passages in my document. However, I have noticed that when I have two formatted index entries for the same term, one inside \ifthenelse and one ...
1
vote
1answer
124 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 ...
1
vote
1answer
50 views

why is adding `breqn` package breaks `etoolbox` command?

I was trying egreg nice answer here in my main document, and I found it does not work there. It turned out it is because I happened to be using another package which is breqn which I really need. I ...
2
votes
2answers
132 views

How to use bashful package from inside etoolbox list processing?

Given list of file names, I wanted to obtain the word count of each file, but by using either \forcsvlist or \docsvlist and pass the file name to bash from Latex without hardcoding the file name in ...
4
votes
3answers
74 views

\forlistloop of etoolbox reference requested

I am having a problem of using the command of \forlistloop of etoolbox unlike the way of typical C program where int a[5] for ( i = 0; i <5; i++) { a[i] } one could access i I am not sure ...
15
votes
6answers
956 views

Loop within another loop in LaTeX

I am trying to create a loop within another loop using some of the constructs in etoolbox but I am not sure how to create that. I want to get the output like in C. pseudo code for (i in the list) { ...
2
votes
1answer
74 views

etoolbox package explanation requested

I am trying to understand the following package etoolbox. I am unsure about the meaning of the following syntax since I am not sure what is the correct question to ask in google or in the book of ...
5
votes
3answers
159 views

Comparing calculated real numbers

"\ifdimless" can compare two real numbers. But, how can we feed the result of a calculation to this function ? \documentclass[]{article} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{etoolbox} ...
4
votes
1answer
81 views

\AtBeginEnvironment not accepting parameters in the code

etoolbox's docs say in the section on environment hooks: Parameter characters in the code argument are permissible and need not be doubled. However, this won't compile: ...
3
votes
1answer
38 views

Using apptocmd inside newenvironment

I try to produce a document containing an exam and the associated correction. I want automatic hyperlinks from the question to the associated answer and vice-versa. Using the solution given by ...
3
votes
1answer
77 views

Conditional section title [ifthenelse] not working

I have the following code: \documentclass{article} \usepackage{ifthen} \usepackage{amsmath,amsfonts,amsthm,amssymb} \newcommand{\probName}{}% \newcounter{probCounter}% \setcounter{probCounter}{1} ...
3
votes
1answer
406 views

Possible LaTeX package to maintain simultaneous text translations

Context: In the text of a document I am planning I will have numerous "strings" that are in a foreign language (foreign to me of course). My current plan is to use the glossaries package because ...