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

learn more… | top users | synonyms

3
votes
1answer
53 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
40 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
56 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
59 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
82 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
1answer
31 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
520 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
40 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
44 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
49 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
73 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 ...
7
votes
0answers
52 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 ...
2
votes
1answer
46 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
82 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
45 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
47 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
313 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 / ...
1
vote
0answers
49 views

When do variables in classes get evaluated? [closed]

I am developing a non-trivial class that is fairly large and complex. So far, everything has worked the way I designed it to be. I apologize ahead of time as I cannot provide a MWE as my question is ...
3
votes
1answer
69 views

\BeforeBeginEnvironment not doing anything?

I'm attempting to do something similar to Two column glossary, making an extant glossary style wrap into multiple columns. I've followed the suggestion in the comment to the first answer, i.e. use ...
5
votes
1answer
35 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: ...
6
votes
1answer
93 views

Splitting a CSV list from a xkeyval key argument into parts

Is it possible to store the key value argument (a cvs list) to a macro (via \def) and split/further process the content of that macro with \forcsvlist command from etoolbox package? I want to ...
1
vote
2answers
56 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 ...
3
votes
3answers
193 views

Separation space between tableofcontents items in beamer

In beamer, I guess, the separation space between the items from tableofcontents is stretchable: Can you set it to a fixed value? e.g. to equal the value used in the itemize environment. Partial ...
16
votes
2answers
143 views

Does etoolbox's \ifboolexpr use lazy evaluation?

In other words, is bool{testB} evaluated at all in this example code? \newbool{testA} \newbool{testB} \booltrue{testA} \booltrue{testB} \ifboolexpr{ bool{testA} or bool{testB} }{OK}{Something's ...
5
votes
1answer
45 views

How to use \patchcmd to change section size in an AMS Article?

I am trying to change the size of the section title in the AMS Article document class from \normalsize to \large. Here is what I tried: \documentclass[]{amsart} \usepackage{etoolbox} ...
3
votes
1answer
51 views

Wrong placement for \preto using etoolbox

I'm observing that the adding a text to a list of tables (or figures) through \preto from etoolbox does not work properly when the table is placed on the next page if it does not fit the page where it ...
7
votes
1answer
75 views

\apptocmd into a conditional—why it does not work?

Why the following MWE does not work while if I comment the conditional it works? \documentclass{beamer} \makeatletter \@ifclassloaded{beamer}{ \usepackage{bookmark} \usepackage{etoolbox} ...
4
votes
1answer
77 views

Navigation circles shown for title page with patch for no-subsections

I'm trying to create a custom theme for beamer. However, when I tried to patch the navigation circles to be automatically included without subsections (using the solution of Beamer navigation circles ...
1
vote
1answer
113 views

Newcommand returning a boolean value

I'm using etoolbox. How can I create a new command that returns a boolean value? For example if I create the following command: \newcommand\ifkeyempty[1]{ \def\novalue{\pgfkeysnovalue}% ...
1
vote
1answer
51 views

Remove empty row inserted by etoolbox

I generate table with some conditional expression using toolbox package. \documentclass{article} \usepackage{etoolbox} \begin{document} \providetoggle{ch} \begin{tabular}{ |l|c|} \hline ...
7
votes
1answer
113 views

Hide an environment and show it later in the document

I am trying to set up an environment for making exercises with corresponding answers for students. Idea I would like to be able to write the text for an exercise in an environment, and directly ...
5
votes
0answers
27 views

Comparing last character(s) of the output of \ref to manipulate output [duplicate]

I am trying to write a command that will replace \ref in a special way. It will add some text next to the number based on the last character(s) of the number \ref outputs. I will try to explain this ...
1
vote
0answers
45 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 ...
4
votes
1answer
83 views

change background if frame has no title

I would like to change my background canvas according to whether my frame has a title. This is the form I'm using (etoolbox): \setbeamertemplate{background canvas}{ ...
1
vote
1answer
68 views

Can a latex IF loop take a perl variable?

I have a script written in perl which harvest data from an sql database, then produces a printed report in latex. I was looking to put an IF loop in the latex part of the script to print one set of ...
6
votes
3answers
81 views

Tabular alignment issue in a loop

I'm getting some odd table alignment issues with a table that I'm constructing inside of a \whileboolexpr. The .tex file is the following: \documentclass{article} \usepackage{etoolbox} ...
4
votes
2answers
185 views

Concatenate macro with string

I try to expand a macro containing a string with another string. It is in the document and thus I want to avoid using @. I tried the following using etoolbox ...
4
votes
1answer
50 views

Strange behaviour of \iftoggle inside tikzpicture

I want to set flag from inside of decoration which I want to check outside of the decoration. I set the flag (call \toggletrue{} or \togglefalse{}) but when I check this flag it always false. For MWE ...
2
votes
1answer
104 views

Adding tables to list of tables with custom chapter breakdown

Running the code below is supposed to modify my list of tables to show the Chapter number above each set of tables related to that chapter. \usepackage{etoolbox} \preto\table{% ...
4
votes
1answer
128 views

\ifnumcomp + \ref

I have a definition with 20 cases or so, and a proof about that definition has one case for each case of the definition. I'd like the proof cases to reorder themselves automatically when I reorder ...
5
votes
2answers
111 views

Boolean key value in xkeyval fails

It is possible to hand over a boolean key value stored in a macro to a command such as \edef\SomeKeyValue{true}% \DummyCommand[DummyBooleanKey=\SomeKeyValue]%%% where DummyBooleanKey is a boolean ...
11
votes
2answers
102 views

how to disable/enable etoolbox global command effect at different locations in a document?

I am not able to figure how to do this, and I did look at the etoolbox documentation The problem is simple to explain: I use etoolbox to append a \clearpage before any \section in a large document ...
10
votes
1answer
94 views

Extra space due to \patchcmd

It seems that \patchcmd from etoolbox adds three unwanted spaces, as shown below: \documentclass{minimal} \usepackage{etoolbox} \begin{document} \tracingall% 3 spaces in ...
8
votes
2answers
167 views

Append \centering to \begin{subfigure} (from subcaption package)

How can I append \centering to \begin{subfigure} (from subcaption package)? I tried using the etoolbox , but for some reason it won't work for the subfigure enviroment (only working for the figure ...
5
votes
1answer
133 views

Forcing the first choice of an newtcblisting environment

I have created a new environment based on "tcblisting" from package "tcolorbox" is code (MWE) is as follows: \documentclass[10pt]{article} \usepackage{tcolorbox} ...
5
votes
1answer
163 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} ...
5
votes
2answers
64 views

How to combine \ifdefstring (etoolbox) with \multicolumn

I need to make tabulars with either norwegian or english column heading above the numbers. I have defined a command, \ReportLanguage, that can be set to either of two values, "no" for norwegian, and ...
5
votes
1answer
67 views

Error output using \ifdefempty

I'm using TeX 3.1415926 (TeX Live 2013) and when I execute \documentclass{article} \usepackage{etoolbox} % contents \newcommand{\contentdesc}[2]{\item \ifdefempty{#2}{\textbf{#1}}{\textbf{#1}: ...
27
votes
2answers
332 views

What's the difference between the various methods for producing for loops?

I've been wondering about the various methods available for looping over a comma separated list and the like. In particular, I was wondering about their various strengths and weaknesses. In other ...
4
votes
1answer
91 views

Loop Multi-Contingency using etoolbox

I want to use the etoolbox package to manage some loop contingencies over a counting index. In particular, I'd like to do something different on the first and last times through the loop. Now I can ...