Questions tagged [etoolbox]
{etoolbox} is a package which provides several macros which take advantage of the {e-tex} extension of (La)TeX.
567
questions
0
votes
2
answers
69
views
Comparing a string generated by a latex macro
Trying to compare the results of a macro to some fixed string, but not getting anywhere. I tried using the \detokenize\expandafter, but that just shows the contents of the macro (as in showing the ...
4
votes
6
answers
307
views
Cannot conditionally split a formula into two lines
I am having a problem splitting a formula into two lines in one of two versions of a paper. The first version (WIDE) uses wide paper while the second uses regular paper. The WIDE version compiles ...
0
votes
0
answers
11
views
list of labels in a separate file out of input files included in a main file
I was trying this amazing solution displayed for the question
Can I get a list of labels written to a separate file, or at least in one place in the document?
in a project file (main with several ...
0
votes
1
answer
61
views
Script for resolving \ifbool statements
In my tex documents, I am frequently using the etoolbox package, and in particular the command \ifbool{<bool>}{<true>}{<false>}.
I'd like to have an automated way of replacing these ...
0
votes
0
answers
12
views
tcblistof issue with macro inside tcolorbox title
I write a lot of reports (minutes). Each report can contains a lot of subjects.
For a better tracking, each subjet is attached with a unique persisent number.
I managed to do so thanks to this subject ...
1
vote
1
answer
68
views
How does one fully expand a macro between \csname and \encsname?
The best way to ask this question is to present two MWEs, one of which works and one of which does not. Naturally, I would like to get this into the second form, but I am at a loss as to what is ...
1
vote
1
answer
60
views
How to redefine the align environment in terms of itself?
I'm trying to redefine the amsmath equation environments to do some regex parsing of their contents. Something is going wrong with the environments that allow alignment tabs. Here's a MWE of the ...
4
votes
2
answers
73
views
Using listadd from etoolbox to build a list of names
I would like to create a list of people's names. However my attempt is not working
\documentclass{article}
\usepackage{etoolbox}
\newcounter{person}
\setcounter{person}{0}
\newcommand{\people}{}
\...
0
votes
2
answers
40
views
Compile two times with boolean set to true first and then false
I just received some tex files where there is a boolean defined at the beginning of the document with the etoolbox package. Changing the boolean produces a slightly different pdf. To produce the other ...
2
votes
3
answers
92
views
How to detect pgfkeysnovalue with csname?
To simplify the programming of a package, I want to generate multiple similar commands (\test, \testb, ...) with a single command \NEWCOMMAND. Each key needs to be linked with an unique command name. ...
1
vote
1
answer
32
views
How to create a list with descriptions in pdftooltip
What I wish is simply to create a list in latex which contains variable names and a description and use it for pdftoolTip. This should be seen in the context of \begin{equation} enviroment.
So the ...
2
votes
1
answer
87
views
Using etoolbox package to resize box automatically
I have hundreds of latex tables I generated using Stargazer. Almost all of these tables can be rectified by wrapping tabular as such \resizebox{\textwidth}{!}{ \begin{tabular} ... \end{tabular}}. I ...
0
votes
1
answer
50
views
titlesec interferes with addcontentsline/addtocontents (adding Parts and Chapters to lot and lof)
For my lot and lof i am using something i found here, so that the parts and chapters show in them (lot and lof). And for my Titles (Part, Chapter, Section ...) i am using titlesec, so they look (imo) ...
2
votes
0
answers
49
views
Unable to patch `\hyper@normalise` command with `\patchcmd`
Is it possible to add a hook to \hyper@normalise command without overwriting all the macro. I wish to add a hook at the end of macro just before \hyper@n@rmalise that I could add custom definitions ...
0
votes
1
answer
57
views
Using defined macro inside csdef
I have defined new font size switches using the following code.
\makeatletter
\newcommand{\vi@mult}{2.986}
\newcommand{\HUGE}{\normalsize%
\@setfontsize\HUGE{\vi@mult\dimexpr\f@size pt\relax}{\vi@...
1
vote
1
answer
33
views
Skipped line in `\iftoggle` gives error: paragraph ended and too many }'s
I'm trying to make a new command that outputs the first or the second argument depending on a toggle (with a specific counter -- it's basically to output question and answer for an exam).
However, if ...
0
votes
1
answer
85
views
Unwanted offset when using biblatex's printbibliography and author bolding via xstring+etoolbox
I'm trying to bold my name in a publication list. After an embarrassing amount of time/experimentation I have something I'm happy with via etoolbox and xstring:
\renewcommand{\mkbibnamegiven}[1]{\...
2
votes
1
answer
67
views
\AtBeginEnvironment does not work for the questions environment in the exam class
Please see the following MWE.
\documentclass{exam}
\usepackage{etoolbox}
% The following does not have any effect on the output
\AtBeginEnvironment{questions}{\setcounter{question}{4}}
\begin{...
0
votes
0
answers
47
views
iftoggle or ifthenelse within a bibtex file, author field not expanded
I am trying to put a conditional statement within a bib file, namely in the author field. I tried with both the ifthenelse and the iftoggle commands, but to no avail. The condition is respected, but ...
1
vote
1
answer
69
views
How to patch `\LoadClass` in a LaTeX class to change the parent class without modifying the .cls file?
I am currently experimenting with .dtx files to develop a little style for my university documents. Doing so, I use l3doc class as a document class in the documentation counterpart of my dtx file.
...
2
votes
1
answer
115
views
Check if the text of a label is empty
I'm trying to check if a text label is empty. For this purpose, I tried to use the \ifblank command from the etoolbox package.
On the following MWE, I would expect that \refdescx{\nameref{lab2}} would ...
0
votes
2
answers
72
views
Which way to alter commands is more robust/sustainable
I have a general question. If I'm writing a .cls file (or a package file, as well), what's the best way to edit standard commands like \section which are defined by the used standard class or latex....
4
votes
2
answers
109
views
conflict between scrbook and dynkin-diagrams
I find a strange conflict between scrbook and dynkin-diagrams, here is the code
\documentclass{scrbook}
\usepackage{dynkin-diagrams}
\begin{document}
\chapter{One}
Here is one \dynkin A2
\end{...
2
votes
1
answer
72
views
Missing endcsname when passing command to hypersetup
I'm trying to manually process a list of authors.
The logic works in the document, but not it does not seem to work when I pass it to hypersetup.
\documentclass{article}
\usepackage{authblk}
\...
1
vote
1
answer
58
views
Comparing pgfkey variable against a string
I want to check a mutable variable against many possible values, so that a macro will behave differently based on that value.
Since there are many variables, they are stored using pgfkeys. Testing ...
4
votes
2
answers
66
views
Problem with macro expansion when making a custom queue container
I'm trying to make a simple queue using the etoolbox package by making my own custom macros \listfront and \listfrontpop. This is my very first time using TeX code to this level, so my understanding ...
4
votes
2
answers
128
views
Unexpected behavior with etoolbox
I would like to separate blocks of text (stories) via a horizontal line inserted automatically between the blocks, but not before the first or after the last. I tried to achieve this by creating a ...
1
vote
3
answers
95
views
Using Macro Inside Description List Label
I made a macro using xparse for formatting the month with optional day and year. Except the appended optional argument doesn't work inside a description label for the description list---unless I ...
1
vote
0
answers
33
views
memoir: Add "part space" before backmatter chapters
I would like the vertical space before the backmatter chapters in the table of contents to be the same as before a part. I would have thought that the code below would have resulted in this, but the ...
4
votes
1
answer
246
views
Using \ifblank to check more than one parameter
I have been reading through mathtools' docs, and they provide an example that declared a paired delimiter that has a default behaviour if blank, using etoolbox:
\DeclarePairedDelimiterX\norm[1]\lVert\...
4
votes
1
answer
101
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
50
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
83
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
49
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
141
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
107
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 ...
5
votes
2
answers
150
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
32
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
49
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 ...
2
votes
2
answers
71
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
249
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
149
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
57
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
89
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
93
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
190
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
64
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
1
answer
62
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
76
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 ...