Questions tagged [etoolbox]
{etoolbox} is a package which provides several macros which take advantage of the {e-tex} extension of (La)TeX.
588 questions
0
votes
2
answers
77
views
custom halfdynamic list
I have problems creating a list first, but adding entries on the fly later.
I need the List (actualy more a numbered table/matrix/) in the first pages of my rather long document, and want to add the ...
4
votes
3
answers
220
views
Use \csdef on command line to pass in paramaters
Is it possible to use a \csdef{}{} on the command line to pass in parameters to pdflatex?
Background:
If the MWE below is saved as "TeX-SE.tex", I can use the following command line to ...
0
votes
2
answers
91
views
etoolbox conditionals with kvoptions string options
I'm writing my first LaTeX class. After some research I've found that kvoptions seems to be the most recommended for key value class options, and etoolbox is recommended over ifthen for conditionals.
...
0
votes
0
answers
65
views
Boolean Error with etoolbox
I'm having some issues with etoolbox, and the setting up of boolean expressions.
With this code:
\documentclass{exam}
\usepackage{etoolbox}
\newbool{refersheet}\newbool{standard}\newbool{adv}\newbool{...
0
votes
1
answer
99
views
Simpler approach to change 1 line in the internal of aligned environment
I have a macro taken from this answer:
\documentclass{article}
\usepackage{mathtools}
\makeatletter
\def\align@prercellhook{{}}
\renewcommand{\start@aligned}[2]{%
\RIfM@\else
\...
0
votes
3
answers
121
views
How can I convert a macro that contains comma-separated strings into a list?
The package etoolbox provides, given my little experience, resources for processing lists in a relatively easy manner. Using the commands such as listadd and listgadd, I am able to append items to ...
0
votes
0
answers
53
views
Font size changes for different chapter markers
I'm using the following script to create chapter markers. At least once in every chapter, the font size is changing for some reason... I have no idea why. Anyone who can help?
\documentclass[12pt]{...
5
votes
1
answer
119
views
Appending to every \item in an inline itemize
I am trying to implement an inline list with some spacing between the items. I've found the enumerate package with the inline option creates the itemize* environment, which provides an inline list. My ...
1
vote
0
answers
68
views
Exact positioning (placement) of text or boxes
This question is related to one of my previous questions:
Specifying exact placement of answers in exam tests
I would like to make exam tests that can be compiled without and with answers, and the ...
2
votes
2
answers
162
views
Error in xpatch's documentation of patch the optional arguments?
In texdoc xpatch, section 3, it shows:
however, in the following mwe:
\documentclass{article}
\usepackage{etoolbox}
% \usepackage{xpatch}
\newcommand{\xyz}[1][x]{-#1!}
\begin{document}
\xyz
\xyz[ok]...
3
votes
2
answers
116
views
Cannot use a macro that includes \csuse inside \label?
I have the following code:
\documentclass[a4paper]{article}
\usepackage{xparse}
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{hyperref}
% #1: Variable name, #2: Variable value
\...
2
votes
1
answer
77
views
Making All of a Document's Footnotemarks Bold
This post is an extension of How to Make Bold the Footnotemarks Appearing After the Footnote Line
Consider the following code which is derived from @Werner's excellent answer:
\documentclass[12pt]{...
1
vote
1
answer
74
views
Using \expandafter and custom commands with multiple arguments
I'm trying to use a defined list with the \forcsvlist command. From my understanding, I have to expand the defined list before the \forcsvlist command executes. I have tried so many iterations using \...
0
votes
2
answers
62
views
conditional optional argument not working in the amsthm proof environment
I would like to use the optional argument in the proof environment (provided by the amsthm package) only in one version of my paper, when a toggle Details is on. This is my code:
\documentclass{...
1
vote
1
answer
89
views
Trying to add markings based on etoolbox toggle
I'm working on a template, and I'm trying to create a toggle, that adds the CUI marking in header (center) and at the start of every paragraph while the toggle is on. However, when I compile the ...
2
votes
1
answer
111
views
Command '\ifstrequal' not evaluating to TRUE when arguments are indeed equal
I am trying to follow this post in defining a custom citation style where I show a different icon based on the type of the citation; as such, I am using the \ifstrequal command from the etoolbox ...
4
votes
2
answers
209
views
Is there a better way to implement `\ifblank` condtion check when there are multiple option arguments with default values in a command definition
This question arose while responding to another inquiry on SE Tex. Currently, there is no practical application for this, but I want to be prepared in case I encounter a similar situation when ...
1
vote
2
answers
290
views
\ifstrequal argument expansion
when using \ifstrequal in \ifstrequal{\fpeval{2+3}}{5}{True!}{False!} , the result is False! Anyone knows what happened here ?
\documentclass{article}
\usepackage{etoolbox}
\begin{document}
\...
0
votes
1
answer
92
views
patchcmd from `etoolbox` won't adjust `\textheight` and `\oddsidemargin` based on page number
I was working with a document, where I needed to set a certain layout for certain pages. Here I've defined a layout where the top margin is 2in for the first 2 pages and 0.4in for pages > 2 and ...
4
votes
2
answers
169
views
How to produce pgf-pie from an etoolbox dolistloop?
I have a an etoolbox list with some sort of labels, one counter per label. I'd like to produce a pgf-pie chart from these labels and their counter values. But two problems:
PGF Math complains about &...
1
vote
1
answer
57
views
start sections on odd pages and customise blank even pages
I want that new sections in my document start on odd pages only and if it has to skip a page because it is even, then i want to have headers and footers blanked. In my MWE, not sure why these skipped ...
3
votes
2
answers
95
views
Add period/full stop to the end of an expanded macro if it doesn't end with one. Alternative to `xstring` with macro expansion?
This question is similar to multiple other ones (e.g. for captions), however I couldn't manage to use them for the following MWE.
\documentclass[a4paper]{article}
\usepackage{etoolbox} % for \...
0
votes
2
answers
129
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
366
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
32
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
191
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 ...
1
vote
1
answer
110
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
124
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
213
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
107
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
150
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
53
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
138
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
101
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
109
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
79
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
59
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
104
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
142
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
89
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
122
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
152
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
107
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
148
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
123
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
121
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
112
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
146
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
144
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 ...
2
votes
0
answers
55
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 ...