Questions tagged [etoolbox]
{etoolbox} is a package which provides several macros which take advantage of the {e-tex} extension of (La)TeX.
503
questions
0
votes
1
answer
22
views
Changing the Default Vertical Page Position for a group of New Chapters with Patchcmd Command
I am using the patchcmd command in the preamble to specify a vertical position default for where new (unnumbered) chapters should begin on the page:
\makeatletter
\patchcmd{\@makeschapterhead}{\vspace*...
0
votes
0
answers
28
views
How to save variable values into list
I want to save the content of a token into a list like this.
\documentclass{article}
\usepackage{etoolbox}
\begin{document}
\def\abc{1}
\listgadd{\lista}{\abc}
\def\abc{2}
\listgadd{\...
0
votes
1
answer
41
views
Even and odd headers without fancyhdr
I just started to learn latex and I found these headers (I didn't manage to make them with fancyhdr) but I don't understand how to set even and odd pages here. Please help.
I figured out how to change ...
2
votes
4
answers
151
views
\ifblank doe not work correctly with \pgfkeys
The macro \test below is used to test if its argument is blank, and it gives unexpected result.
What's wrong with my code?
Example:
\documentclass{article}
\usepackage{tikz,etoolbox}
\begin{document}
\...
0
votes
1
answer
21
views
Auto infra\supra with Linguex examples
I'm trying to make this work with Linguex:
https://tex.stackexchange.com/a/360869/262813
But I always get "infra".
\documentclass{report}
\usepackage{linguex}
\usepackage{etoolbox}
% ...
0
votes
1
answer
52
views
How to reduce one counter
In bellow MWE, the excoutP is added to store the value of excout.
How can we only use the counter excout?
Thank you in advance!
\documentclass{article}
\usepackage{etoolbox}
\usepackage{xcolor}
\...
0
votes
1
answer
30
views
How to append something to a page style defined by \fancypagestyle
Some other codes can be appended to a macro by tools from etoolbox, for example, \apptocmd.
I wonder if there are similar ways to append something to a page style defined by \fancypagestyle from the ...
1
vote
1
answer
60
views
How to put some commands into longtable by \AtBeginEnvironment?
In my case, I am 100% sure that the second and other captions like "continuation of table N" is the same for all of the tables. So I have reason to put this in all the longtable's:
\...
2
votes
1
answer
44
views
Unitalicized capital Greek with sansmath
In my PhD thesis, the main text is in Times, and all of my figures (and their captions) are set in Helvetica. I've created the following MWE that shows how I can can toggle between Times and Helvetica ...
0
votes
1
answer
32
views
Why doesn't execute my command in table?
I think the command \apptocmd from "etoolbox" package doesn't work in table. What I should to do?
MWE:
\documentclass{article}
\usepackage{etoolbox}
\newcommand{\mycmd}[1]{%
#1\apptocmd{\...
4
votes
4
answers
328
views
Get value from \foreach
I build a macro named \fromlist to get value from a list. The value can be typeset, but can not be invoked directly, why and how to deal with it?
Code:
\documentclass[a4paper]{article}
\usepackage{...
3
votes
1
answer
71
views
how to get value from a list by the index
I build a list by a macro to store some values. I wonder if there is method to get value by its index number from the list. The following code shows my intention.
Code example:
\documentclass{article}
...
0
votes
1
answer
21
views
Excessive vertical space after quote using report class
I want to get rid of excessive vertical spacing after a block quote using the report class. I am using this suggestion to customize the font size and spacing of the blockquote. It appears as if the ...
2
votes
1
answer
25
views
etoolbox error with make4ht
The following example, despite a the generated HTML seems okay, shows an error message.
Example file:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@...
0
votes
1
answer
41
views
Height of \parbox can not be assigned with condition?
I want to assign the height of my \parbox with condition, as I did below, but fail. Why and how to deal with it?
Code:
\documentclass[a4paper]{article}
\usepackage{etoolbox}
\usepackage{geometry}
\...
1
vote
1
answer
14
views
Repeat argument of macro for cleveref referencing (forcsvlist?)
This is a follow up question on How to customize enumerate list with resuming numbering on second level using customize item command?. Now I am wondering how I can reference to the entries of my ...
0
votes
1
answer
48
views
How to merge cells made by \parbox vertically
\documentclass[a4paper]{article}
\usepackage{xcolor,pgf,etoolbox}
\usepackage{geometry}
\geometry{showframe}
\geometry{left=1cm,right=1cm,top=1cm,bottom=1cm}
\parindent0pt
\begin{document}
\fboxsep0pt
...
7
votes
6
answers
970
views
How to make a loop with two loop variables
\documentclass[a4paper]{article}
\usepackage{tikz,etoolbox}
\usepackage{geometry}
\geometry{showframe}
\geometry{left=1cm,right=1cm,top=1cm,bottom=1cm}
\parindent0pt
\begin{document}
Method 1: %by \...
0
votes
1
answer
63
views
What is a robust user-defined way to define cross-references and adjunct values that work inside and outside environments?
This question is a follow-up on these two
Why does \zifrefundefined fail on tcolorbox reference?
\@nameuse fails on definition within tcolorbox
What I want to achieve:
I want to have an environment,...
2
votes
3
answers
119
views
How to use \appto in nested macro
By the following code, I tried to make the macro myexe store this code: \colorbox{red}{\parbox{1in}{some text}} and failed.
How can I do it?
CODE:
\documentclass{article}
\usepackage{etoolbox,xcolor}
\...
0
votes
1
answer
59
views
How to store/append code for later use
To store some code for later use, I can think of two ways: \appto from etoolbox and \sbox.
They both have some problems in use.
For \appto, later invoke of a macro will cover the value of the former, ...
1
vote
2
answers
48
views
Use of \xappto, \noexpand and (for example) \emph
I'd like to accumulate some text from a macro and place it in a multipart TikZ node. Works as expected until there is a macro in the text being accumulated, at which point TeX fails. It would, as ...
1
vote
1
answer
17
views
How to pass a reference value to \listadd from package etoolbox, so that one can retrieve it with the value it had at the time it was input?
How to pass a reference value, such as \thesection, to \listadd from package etoolbox, so that one can retrieve it with the value it had at the time it was input?
The following MWE illustrates that ...
0
votes
1
answer
28
views
\iftoggledefined: Detect if newtoggle was defined
I am looking for \iftoggledefined{<toggle name>}{<true>}{<false>}. I checked the etoolbox documentation and did not see such a thing.
Based on Difference between \newbool and \...
1
vote
1
answer
40
views
Patch section command fails
I'd like to patch the section command to add at the end a simple \label in a way that is as generic as possible (I don't want to assume the number of arguments of the section command for instance, so ...
3
votes
3
answers
59
views
How to typeset first occurrence of a string differently than the later ones?
My question is similar to this question but I need a solution depending on the input. I'd like to have a command \propername{}, which writes the very first occurrence of the first argument in italic, ...
3
votes
1
answer
80
views
etoolbox and beamer : why do I get an error?
This recent question tickled my curiosity on etoolbox (that looks great but that I have actually never used).
After a quick check, I don't read any notorious incompatibility between etoolbox and ...
1
vote
1
answer
43
views
A problem of counters, timing and etoolbox
I am attempting a format for recipes. For input, each step of the method is accompanied by the ingredients for that step. The output places all of the ingredients together, and all of the steps of the ...
0
votes
0
answers
42
views
Conflict between hyperref and etoolbox packages
I'm trying to compile a file using hyperref to get hyperlinks and etoolbox, for I want a specific setup for theorems that I actually found here (https://tex.stackexchange.com/a/424034/248426). However,...
0
votes
2
answers
84
views
Change maketitle based on string argument
I want to change the command \maketitle as follows:
If no argument is given, maketitle should be defined as
\renewcommand{\maketitle}{%
\vspace*{-70pt}
{\sffamily\slshape\bfseries faculty, }{\...
1
vote
1
answer
40
views
Custom environment that outputs a tabularx generates an error only if the etoolbox package is included
I'm dealing with a really complex table and I want to define an environment with some additional macros in order to make the table creation code more semantic. So far I've defined the environment and ...
3
votes
2
answers
128
views
Are the Packages etoolbox and scrextend Incompatible? (Trying to Increase Horizontal Space Between Bold Footnotemarks and Their Text)
This question is an extension of How to Make Bold the Footnotemarks Appearing After the Footnote Line
Starting with the code from Werner's excellent answer which makes bold the footnotemarks after ...
5
votes
3
answers
391
views
Remove extra space generated by a LaTeX command
My LaTeX document contains the following lines:
\documentclass{article}
\usepackage{etoolbox}
\newcommand{\defineSpecies}[2]{\csdef{spec@#1}{#2}}
\newrobustcmd{\spec}[1]{%
\ifcsname spec@#1\...
0
votes
0
answers
32
views
Error with unicode characters in cseappto
\documentclass[a4paper,10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}
\begin{document}
\cseappto{myList}{entry1}
\cseappto{myList}{entry2}
\cseappto{myList}{{\'e}ntry3}
...
1
vote
2
answers
70
views
Problem with \def
can someone tell me why this works
\documentclass{article}
\usepackage{etoolbox}
\newcounter{mylistcounter}
\newcommand{\getnthelement}[2]{
\setcounter{mylistcounter}{1}
\renewcommand*\do[1]{
\...
2
votes
2
answers
36
views
Why can't I add minted environment to a variable using \gappto?
This is my code:
\documentclass{article}
\usepackage{etoolbox}
\usepackage{minted}
\begin{document}
\newminted[mycode]{text}{}
\newcommand\foo{}
\gappto\foo{
\begin{mycode}
Hello, world!
\end{...
1
vote
1
answer
53
views
How to create a command with a numerical name?
I want to be able to do this:
\make{6}{hello!}
And it should turn into (vi is the roman for six):
\ifcsname foovi\else
\newcommand\foovi{}
\fi
\gappto\foovi{hello!}
I'm doing this:
\documentclass{...
2
votes
1
answer
27
views
Error from fragile beamer-frame within etoolbox's ifbool
Based on etoolbox booleans, I am (un)selecting Beamer slides. When I try to do this with a fragile frame I run into errors. See MWE.
Could you explain why, and would you have a workaround for this? I ...
4
votes
1
answer
158
views
Is the ifthen package not recommended to use?
I've seen several posts and users recommend avoiding the ifthen package, however, I see it was recently updated (2020).
One feature I'm trying to exploit from it is an expanded string comparison. ...
3
votes
2
answers
52
views
etoolbox bool cv and letter expression (earlier ifthen package)
I had a .tex file where I defined an expression earlier with the \usepackage{ifthen}.
Now I want to use \usepackage{etoolbox} for this purpose but don't know how to use it correctly I get an error ...
0
votes
1
answer
46
views
Unable to patch "\caption" if the package caption is loaded
I was inspired by this question to make the chapter names appear in the list of figures.
This solution works very well if the caption package is not loaded. However, if this one (or subcaption) is ...
2
votes
1
answer
62
views
Comparing node coordinates in Tikz
I am trying to generate drawings automatically based on node coordinates. The construction process itself is very easy: draw an arrow from node i to node i+1 (i and i+1 being node names, fixed ...
0
votes
2
answers
68
views
Table Spacing with "setspace" and "etoolbox"
I use the set spacing package, to avoid that tables are condensed I also use the etoolbox package to define the tabular environment. However, in one specific table the 1.5 spacing is too much and I ...
3
votes
1
answer
62
views
Using \noindent in \AfterEndEnvironment from etoolbox creates bigger gaps between two environments
Using \noindent in \AfterEndEnvironment from etoolbox creates bigger gaps between two environments than it should. Here is code, that fully describes the problem.
\documentclass{scrartcl}
\usepackage{...
2
votes
1
answer
33
views
Modifying a list and passing it to another command
I am trying to write some macros to easy my life while writing mathematics in LaTeX. For this, I would like to have some macros to write wedge products in a more concise manner.
I have a command which ...
1
vote
1
answer
54
views
Using csdef in table
I am trying to automatically add a decision summary when writing meeting minutes. For each paragraph of the meeting I use a table to organize the paragraph number, name and content, and I use etoolbox ...
2
votes
1
answer
83
views
How to remove the "Bibliography" title in book class
Here:
How to remove the "References" title
Gonzalo Medina suggests to use:
\usepackage{etoolbox}
\patchcmd{\thebibliography}{\section*{\refname}}{}{}{}
to remove the word "References&...
1
vote
2
answers
77
views
Comma-separated list environment and etoolbox
I want to combine the automatic punctuation in comma separated list from this answer with the list processing from etoolbox.
However, I do not get any output.
What is going wrong here?
\documentclass{...
4
votes
2
answers
156
views
Access argument passed to environment with etoolbox \AtBeginEnvironment
I would like to use etoolbox to run some code at the beginning of the tabular environment. I would like to use the column specification in this code. Can this be done easily?
\documentclass{article}
\...
3
votes
2
answers
149
views
Reference an element of an array created by listadd
Given the mwe:
\documentclass{article}
\usepackage{etoolbox}
\begin{document}
\listadd\terms{First item of the list}
\listadd\terms{Second item which has punctuation such as, commas, potentially a ...