Questions tagged [etoolbox]
{etoolbox} is a package which provides several macros which take advantage of the {e-tex} extension of (La)TeX.
540
questions
4
votes
1
answer
85
views
System to avoid doubling up of spacing after a custom environment
Below is a very simplified example to illustrate a problem with spacing before and after environments:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{amsmath}
\...
1
vote
1
answer
16
views
Removing spacing between adjacent sections and subsections (titlesec)
I am building out sections and subsections. The beforesep on subsections is desirable generally, but not if a subsection is invoked directly following a section. Is there any way to take care of this?
...
2
votes
1
answer
22
views
Using \def to output boolean true/false values - Usage in Tasks Package "Resume" Function
I am attempting to use a \def (or any equivalent) to give a boolean output, but unable to do so. Compilation of below results in the following error:
\documentclass{amsart}
\usepackage{tasks}
\begin{...
0
votes
1
answer
27
views
Using foreach to add variable number of rows to a bytefield inside a TikZ node?
I'd like to loop over a list of fields to be added to a bytefield, to be shown inside a TikZ node. MWE:
\documentclass[tikz]{standalone}
\usepackage{bytefield}
\usepackage{etoolbox}
\begin{document}
...
0
votes
0
answers
26
views
Cannot use \aa in \eappto with pdfLaTeX [duplicate]
I'm working on a Swedish language file to fmtcount. There I have to concatenate strings to form numerals. As the Swedish words for two and eight ("två" and "åtta") contain the ...
2
votes
2
answers
125
views
\eappto and \aa doesn't work with pdflatex without fontenc
I'm trying to use \aa in an \eappto command. The minimal code below works just fine in XeLaTeX and LuaLaTeX but fails with pdfLaTeX unless I include the fontenc package. This confuses me as \aa works ...
3
votes
1
answer
42
views
Use `\ifblank` as a test for `\ifstrequal`
To carry out checks on some parameters passed to an environment, I would need to:
check if the parameter is blank or not;
pass a default value or the one supplied;
compare the final value with a ...
4
votes
2
answers
112
views
Wacky Behaviour for \csdef
I am using \csdef{} to define a meaning to a given open/close bracket:
\csdef{Bracket Meaning \CsToStr{\lvert}}{Left |}
\csdef{Bracket Meaning \CsToStr{\rvert}}{Right |}
\csdef{Bracket Meaning \...
0
votes
0
answers
25
views
Conditionnal CSV prompting
I'm asking for your help for a specific problem I have no clue about.
My goal is to have conditionnal CSV printed in a table (did not include that print part) :
\usepackage{csvsimple}
\usepackage{...
0
votes
1
answer
27
views
Interaction of „Showonlyref“ and „Subequations“ Workaround?
A workaround suggested by Daleif (see below) solves the problem of incorrect numbering when e.g. one set of subequations is not referenced. However, if none of the equations of a specific set of ...
1
vote
2
answers
46
views
List numbering issue in latex
Suppose that I have this simple code
\begin{theorem}
\begin{enumerate}[nolistsep]
\item[(1)] This is the first item
\item[(2)] This is the second item
\end{enumerate}
\end{theorem}
My question is:...
6
votes
2
answers
132
views
Why does an empty command not return an empty string?
I want to check if a command returns something or not. I tried the following but it is not working. Why is the output of the following code false?
\documentclass{article}
\usepackage{etoolbox}
\...
4
votes
1
answer
48
views
How to use the \appto across the environments?
In the following code:
\newtheorem{myans}{Answer}
\def\myword{Word: }
\newcommand{\addword}{first, }
\begin{myans}
... \appto{\myword}{\addword} ...
\end{myans}
\renewcommand{\addword}{second, }
\...
1
vote
0
answers
22
views
Solution for using latexdiff on files with toggles
I have different versions of a latex file that use toggles (from etoolbox). When I use latexdiff to compare the different versions, I can see that latexdiff is (practically) oblivious to changes in ...
0
votes
1
answer
56
views
How make, that every page with section start have an empty style
There is some problem, that I can't understand.
I want, that each page with start section has empty style
\appto\section{\thispagestyle{empty}}
I get an error
! Argument of \thispagestyle has an ...
2
votes
3
answers
66
views
Creating a list that can hold multiple values per entry
I wand to create a list which can hold different values per entry.
As an example I want to list users and every user has a Username, Age and Country.
Now I want to be able to iterate through the list ...
0
votes
0
answers
42
views
ifstrempty Renders always False
The following minimal example makes problems:
\usepackage{etoolbox}
\newcommand{\foo}{}
\begin{document}
\ifstrempty{\foo}{True}{False} % This is always False
\end{document}
Why is ifstrempty ...
1
vote
1
answer
34
views
How to replace the second match of a string of token using \patchcmd?
I will first raise a general question and then try to describe what I actually want to achieve.
General question: How to patch the match other than the first one using \patchcmd
The logic of the ...
0
votes
0
answers
18
views
Footnotes outside tcolorbox environment and sync with general footnotes
My problem is very simple. This is what I have:
where "Definición" means "Definition". The answer to this question would be a way to sync the footnotes inside the definition ...
0
votes
1
answer
43
views
Patch no longer finding search pattern for hyperref command despite previously working, unsure how to update it
Some time ago I used user Werner's solution provided here:
https://tex.stackexchange.com/a/582389
in one of my own documents. Specifically, the goal was to make the part number and the part title in ...
0
votes
1
answer
46
views
How to store Boolean values for later use
I want to define a new command for a package using xparse. My command looks like this:
\NewDocumentCommand{\fancyCommand}{s o m}{
\def\@optional{#2}
\def\@mandatory{#3}
}
This is, because I ...
0
votes
0
answers
51
views
How do I check if a list item is blank when it is passed as a parameter in LaTex?
I'm trying to create a command that accepts two lists using the \listofitems package where the first list is optional.
In the command I want to check if the first entry in the optional list is "...
0
votes
1
answer
52
views
Changing a etoolbox toggle for the span of an environment
I use the toggles of the etoolbox package in my document. However, the document is long and gets modified a lot so sometimes the current state of the toggle is not clear when editing somewhere in the ...
0
votes
1
answer
51
views
Can you make boolean expressions in xparse?
I have a preamble I use on my assignments containing the following command using xparse:
\ProvideDocumentCommand{\integral}{s m m e{_^}}{%
\int%
\IfValueT{#4}{_{#4}}%
\IfValueT{#5}{^{#5}}%
...
1
vote
1
answer
53
views
Calc \widthof error
I'm trying to use the \widthof command (calc package) inside the \ifdimcomp command (etoolbox package), but I keep getting an error "Missing number, treated as zero" which confuses me. I'm ...
0
votes
1
answer
45
views
Titlesec undoes an etoolbox patch. How to make them compatible?
This answer says how to avoid indenting long section titles and obtaining something like in the picture (not me who introduced this format, it's just the format I have to deal with now, and titles ...
0
votes
0
answers
20
views
Adding Appendix entry conditionally
I would like to get a line in my table of contents, list of figures, list of tables, and list of algorithms depending on whether there are elements in the appendix/appendices. I have tried to do it in ...
1
vote
2
answers
48
views
RequirePackage and usepretex from latexmk change output file to texput.tex
I want to compile a larger file completly based on a toggle (my@final) from the commandline using a makefile.
My .tex-file looks like:
\documentclass{scrbook}
\begin{filecontents}[overwrite]{01.tex}
...
0
votes
1
answer
59
views
\docsvlist not work with list in form of macro
In the following codes, I tries three methods to build a csv list(a sequence of natural numbers from 1 to 5).
Then I use \docsvlist(from etoolbox) to wrap each element of the list with parentheses.
...
0
votes
0
answers
20
views
Error messages when compiling PDFLaTeX on Heroku server
I run this process to generate my pdf file on my local machine and it works fine.
However when I host it on Heroku with a Django app I will get some error messages.
process = subprocess.Popen(
...
2
votes
2
answers
95
views
How to generate a table from a list
I am attempting to build up a list of rows for a table, then render that list into a table. I'm using etoolbox to manage the list and loop over it. I'm close but I can't get more than one column of ...
0
votes
1
answer
67
views
Add further grouping to nomenclature using {nomencl} + {etoolbox}
To add a nomenclature to my master thesis I follow overleaf's recommendation and use below code.
Grouping is quite important for me. Unfortunately, I cannot figure out how to create subgroups by using ...
2
votes
1
answer
43
views
latex macro fails to parse expression although bracket groups match
The tensor package allows the typesetting of tensors using commands like,
\[
\tensor{X}{^b^o_a_t}
\]
to produce the following expression:
Together with the physics package it is possible to ...
4
votes
3
answers
132
views
Why my patch to addcontentsline is broken in \AtEndPreamble and \bool_if:NT?
I want to patch the \thepage in the \addcontentsline to 2*\c@page + 1 if some bool in preamble is true. I simplify my code to this:
\documentclass{article}
\usepackage{etoolbox}
\makeatletter
\...
1
vote
1
answer
40
views
Problem about wrapping lstlisting environment into another environment with etoolbox
In the following MWE, I tried to wrap an lstlisting environment(testlst) into another environment(test) by the pairs of macros \BeforeBeginEnvironment and \AfterEndEnvironment that come from the ...
0
votes
2
answers
65
views
Remove white space above chapter number
I'd like to remove the white space above all chapter numbers. I've tried both titlesec and etoolbox, neither of which worked. Here's my code:
documentclass[12]{report}
\usepackage[utf8]{inputenc}
\...
4
votes
2
answers
174
views
Is there a (better) way to repeatedly toggle between two font colors within a paracol environment, and compiling with XeTeX?
\documentclass{article}
\usepackage{xeCJK}
\usepackage{xcolor}
\colorlet{color1}{blue!50!black}
\colorlet{color2}{green!50!black}
\usepackage{etoolbox}
\newtoggle{col}
\providecommand{\tog}%
{%...
0
votes
1
answer
36
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
2
answers
105
views
How to save variable values into list [closed]
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
66
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
5
answers
239
views
\ifblank does 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
62
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
164
views
How to reduce one counter
In the MWE below, the excoutP is added to store the value of excout.
How can we only use the counter excout?
\documentclass{article}
\usepackage{etoolbox}
\usepackage{xcolor}
\...
0
votes
1
answer
38
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
72
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
100
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
35
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
406
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
181
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
31
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 ...