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

learn more… | top users | synonyms

8
votes
1answer
52 views

\xpatchcmd defines macros when applied to undefined commands

I stumbled over this feature (it's part of a bigger question, but I splitted it into two questions): Say, that we want to use \xpatchcmd (from xpatch) or \patchcmd (from etoolbox) and apply those ...
2
votes
1answer
43 views

Why is \glueexpr used in etoolbox's \deflength instead of \dimexpr

Consider the following snippet from etoolbox: \newrobustcmd*{\deflength}[2]{% \ifundef{#1} {\etb@noglobal\etb@err@nolen{#1}}% {#1\glueexpr#2\relax}} Maybe I do not understand the ...
4
votes
2answers
59 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} ...
5
votes
2answers
54 views

How to determine if a macro argument contains the macro itself?

I would like to have a way to detect if a particular macro's argument contains that particular macro itself. Consider the following MNWE: \documentclass{article} \usepackage{etoolbox} ...
0
votes
0answers
34 views

etoolbox conflict with bm package [duplicate]

I found a conflict between bm an etoolbox because later one redefines \@@end. It happens when it patches \enddocument command. Code from etoolbox: \patchcmd\enddocument {\deadcycles} ...
2
votes
3answers
50 views

Multiple \if condition using etoolbox

First: I've found "Checking if two conditionals are met" but I don't know how to change it do suit my needs. Wanted: I have eight different predefined values and I want different definitions of a ...
4
votes
2answers
63 views

N ary switchs (selectors / conditionnals / toggles) to handle mailling list

Suppose I want to address the same letter to 10 persons. The letters should be the same, except of course for the recipient's name and address. Moreover, I want to enclose the name of all the other ...
4
votes
0answers
63 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).) ...
3
votes
1answer
32 views

Customized list of elements using etoolbox

I need to have several lists with access by index (array-like). My minimum non-working example follows: \documentclass{minimal} \usepackage{etoolbox} \newcounter{listAcounter} ...
3
votes
1answer
82 views

Color of enumerate/itemize items in alertblocks and exampleblocks (beamer theme Torino)

I'm working with the Beamer theme Torino (see http://blog.barisione.org/2007-09/torino-a-pretty-theme-for-latex-beamer/), I' doing presentations using it, but changing the colors defined by default. ...
6
votes
1answer
52 views

Headline adjustment doesn't work after new installation

Half a year ago, the following code \documentclass[ fontsize=12pt, % monochrome, a4paper, parskip=half, ngerman, headinclude=true, footinclude=false, ...
4
votes
1answer
36 views

List Parsing the ascii space character

I have been using the list parsing functionality from etoolbox and I have a weird use case in which I want a space separated list. \usepackage{etoolbox} ...
4
votes
2answers
81 views

Use toggles in biblatex `printbibliography`

Consider the following: \documentclass{article} \usepackage[backend=bibtex8]{biblatex} \begin{filecontents*}{bib.bib} @mastersthesis{toto, author={Toto}, title={My thesis}, year={2009}, school={Paris ...
0
votes
1answer
44 views

Short caption in margin

Is it possible to insert the short caption of a figure in the margin next to it? I tried to get it working with etoolbox but without success. Additionally it has to work with the package subcaption ...
11
votes
3answers
153 views

Use a macro to define a \NewDocumentCommand macro without backslash

Or as, Werner simplified it: "How to define a command without backslash in xparse". Background: I am trying to set up a macro to define a macro for me (which will also do some other things which ...
5
votes
3answers
42 views

Retrieve link caption of hidden label

What I wish to do is create a (hidden) label in which some text is stored, and retrieve the text by referencing to it, without getting an actual link. For example: \customlabel{refname}{some text} ...
6
votes
2answers
114 views

Run a command at end of each Frame

I want to run a command (writing page ranges to a file) at the end of each frame. I can capture the page the frame started with at the beginning with ...
4
votes
2answers
45 views

Redefining a Command in a Loop Over a Comma Separated List

I want to redefine the glossaries package’s \gls commands to include an index entry and an optional argument for formatting the index entry. However, there are so many variants of this command (\gls, ...
0
votes
2answers
110 views

How to create labels and references automatically in LaTeX?

I have defined two custom macros: \translation{ORIGINAL}{TRANSLATION} \printtranslations The first macro prints out the translation and puts the original and the translation into a list. The list ...
4
votes
1answer
48 views

whileboolexpr with arrayjobx arrays generates unwanted whitespaces in output

While improving on a class file of mine, I found that I used the multido package in just a single line of code and naturally I set out to remove that dependency. My class uses several counters and ...
7
votes
1answer
106 views

Does LaTeX3 have something for patching (or appending code to) commands?

Item #12 of http://tex.stackexchange.com/a/148734/18401 suggests that LaTeX3 maybe has something for patching (or appending code to) commands, à la etoolbox or xpatch. Is it the case?
3
votes
1answer
85 views

How to append colored text to a macro in a loop?

I'm trying to append a couple of colored numbers to a macro in a loop. That is, I'm hoping to achieve the following but with a loop: \documentclass{article} \usepackage{tikz} \colorlet{color1}{red} ...
2
votes
1answer
31 views

\csuse inside a \NewEnviron using the environment parameter

I am trying define a environment that displays a text specified by the parameter of the environment. The following example demonstrates it: \documentclass{article} \usepackage{environ} ...
1
vote
0answers
28 views

Why can't I use \ifstrequal to check the \jobname? [duplicate]

I want to use the same source file to compile various target files using the -jobname option. I want to ensure that the option is not forgotten, so my approach was to check whether the \jobname is ...
4
votes
0answers
97 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
1answer
150 views

Patch \insertshorttitle in beamer

In this answer @cfr showed me how to preserve short title color in beamer while allowing hyperlinks to work. His solution was to modify the \insertshorttitle command (defined in beamerbasetitle.sty) ...
4
votes
2answers
76 views

Using forcsvlist with macros that take more than one argument

I'd like to compact this code sample with \forcsvlist (provided by the etoolbox package). \newcommand\mycmd[2]{ \pagestyle{#2} \csname tit#1\endcsname \cleardoublepage } \def\DOtitlepages{ ...
8
votes
1answer
197 views

How to translate \ifthenelse from “ifthen” to “etoolbox”?

Trying to make conditional expressions that inspect the total page count of the document (see this question), I've found this solution using ifthen package: \documentclass{article} ...
0
votes
0answers
43 views

Output two files

I'm tiring of maintaining two different CV and resume .tex files and want to combine them into a single file. I'm considering etoolbox as a way of combining my CV and resume into the same. Then I ...
7
votes
1answer
162 views

biblatex-chicago etoolbox error: Invalid boolean Expression

I am using bibtex as the backend for my biblatex bibliography but there seems to be some clash between it and the etoolbox package that I don't understand. This is on a fresh install of TeXlive 2014. ...
8
votes
5answers
413 views

A command which concatenates a string an arbitrary number of times

I'm trying to define a command \repeatstring{#1}{#2} which repeats the string #2 #1 times. Here is what I tried: (it is based on what I found in How to concatenate strings into a single command?) ...
5
votes
1answer
78 views

White space problem using multiple \ifnumequal

I am trying to produce slightly different documents based on a single numerical input. But when I use multiple \ifnumequal commands to get the correct bit of text it produces really strange white ...
7
votes
1answer
281 views

\AtBeginEnvironment adds spurious spaces to .toc when using \addtocontents

I'm using scrartcl and am trying to move the appendices in the toc one level up so that they are formatted as if they where a subsection instead of a section. I've adapted my solution from this ...
3
votes
1answer
98 views

Auto generate list-items within table from string with delimiter

This is a follow-up on this question: Creating bullet-list from string with delimiters I have a CSV file where I genereate some tables from. Some of those table cells will have items that should be ...
1
vote
1answer
75 views

Extra code for \tableofcontents (renew)

I want my \tableofcontents command to include these two commands at the beginning: \pagestyle{headings} and \pdfbookmark[0]{Table of Contents}{contents} I tried using the etoolbox package, and I came ...
2
votes
1answer
74 views

How to iterate a list of colors with two additional counters more elegantly?

A part of my code (especially iterating a list of colors with 2 additional counters) below does not seem straightforward. \documentclass[pstricks,border=12pt,dvipsnames]{standalone} ...
5
votes
1answer
126 views

How to use \pretocmd with \verb or \lstinline?

I write my document in other language, then I need to switch to English (switch font) when show code: \newcommand\code[1]{\lstinline{#1}} \pretocmd{\code}{\begin{otherlanguage}{english}}{}{} ...
4
votes
2answers
194 views

Greek `\chi`'s subscript expressions: how to make it smaller or offset lower?

I am unsatisfied with the way subscript is rendered for the Greek letter \chi. This particular letter is rendered with a small downward offset. I occasionally have to prefix the subscript with ...
2
votes
2answers
113 views

Placement of showkeys label

Is it possible to place the labels of the showkeys package for bibliographic items on the right side instead of the default left? I tried \patchcmd{\SK@@label}{\llap}{\rlap}{}{} which indeed ...
7
votes
3answers
553 views

Defining 3*(2^4) complex macro at once

An Automata can be 1- or 2- ways, With Several Heads or a Single head Deterministic or Non-deterministic With a stack or not That makes 2^4 = 16 possibilities. However, for each combination, I'd ...
3
votes
1answer
70 views

Divided list of figures

I am using this solution to divide my list of figures and tables into chapters, however, I have a section heading on its own at the bottom of a page and then the table captions are on the next page. ...
4
votes
1answer
93 views

\newrobustcmd not expandable as key-value?

I do some TeX experiments with 'postponed' content, writing it to some file to be included later on (not necessarily at end, but most time it would be appropriate to place it there) I defined some ...
4
votes
2answers
87 views

Print all elements of a working array created with etoolbox package

I am trying to define an array to contain elements and stumbled across the following code and it works. The question is how I can define a command which will print all elements at once without ...
1
vote
1answer
182 views

chapter no newpage and headings

I have a document (scrbook class), in which I want some chapters not to start on a new page. I therefore defined the following: %define a chapter that does not add space at the top of the page ...
8
votes
1answer
77 views

Compress 5-6 to 5f. in a citation's postnote: \rangelen in \ifnumequal

I am trying to automatically convert page ranges in a postnote given as, e.g., \textcite[4-5]{Smi83} to 4f. iff the range is exactly two pages long. It appears that biblatex' \rangelen is made for ...
3
votes
1answer
111 views

Add macro to \chapter command

I am using the report class. And all I want that after the use of \chapter{...} the marco \thispagestyle{onlypagenumber} is added. I fixed this with just defining a new macro \Chapter{...} ...
6
votes
1answer
217 views

Using conditionals in tabular preamble with array

I'm trying to use a conditional in the column setup for my tabular. That is, the definition of one column (actually several columns) is dependent on a boolean value (as set up from the etoolbox ...
0
votes
1answer
73 views

Strange behaviour of ifnumequal?

If I use \cfoot to evaluate and print this section counter, it shows the correct section number in my appendix. However, when I evaluate the section counter using \ifnumequal, it shows that the ...
5
votes
1answer
108 views

csuse with foreach

Am having difficulty determining the correct syntax for using \csuse from the etoolbox package with a \foreach. I have a list, and for each element in this list I need to create a new list. To ...
9
votes
1answer
339 views

Macro to automatically save section name of previous section and next section

EDIT: I've edited the code that reproduces the anomalies, but I'll work on the code to more accurately depict the problem later on the day. Weird spacing in index Index doesn't appear in footlinks / ...