{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
2answers
29 views

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

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
121 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
32 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} ...
6
votes
2answers
88 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
67 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
20 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} ...
3
votes
2answers
67 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 ...
1
vote
2answers
45 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
39 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 ...
3
votes
3answers
66 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 ...
6
votes
3answers
89 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 ...
5
votes
3answers
215 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
121 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
62 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
153 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
54 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
53 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
69 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
65 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 ...
4
votes
3answers
80 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 ...
2
votes
1answer
38 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 ...
3
votes
2answers
116 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 ...
1
vote
2answers
35 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
44 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
75 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
122 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
78 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
44 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 ...
1
vote
1answer
77 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. ...
2
votes
1answer
111 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: ...
7
votes
4answers
214 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 ...
17
votes
1answer
259 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
142 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 ...
4
votes
1answer
193 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 ...
1
vote
0answers
32 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
130 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. ...
3
votes
2answers
54 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 ...
5
votes
3answers
214 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 ...
1
vote
1answer
58 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
160 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
92 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
1k 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) { ...