Questions tagged [etoolbox]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
24 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 "...
  • 1
0 votes
1 answer
37 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 ...
  • 125
0 votes
1 answer
24 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
38 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
38 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 ...
  • 4,522
0 votes
0 answers
15 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
28 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
49 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. ...
  • 2,619
0 votes
0 answers
16 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
59 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
24 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 ...
  • 103
2 votes
1 answer
34 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 ...
  • 125
4 votes
3 answers
123 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,228
1 vote
1 answer
35 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 ...
  • 2,619
0 votes
2 answers
36 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} \...
  • 1
4 votes
2 answers
169 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
35 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
71 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
56 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 ...
  • 3
2 votes
5 answers
211 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} \...
  • 2,619
0 votes
1 answer
30 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
101 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
35 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 ...
  • 2,619
1 vote
1 answer
65 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
69 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
364 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{...
  • 2,619
3 votes
1 answer
99 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} ...
  • 2,619
0 votes
1 answer
27 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 ...
  • 1
2 votes
1 answer
35 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} @...
  • 666
0 votes
1 answer
56 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} \...
  • 2,619
1 vote
1 answer
16 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
61 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 ...
  • 2,619
7 votes
6 answers
991 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 \...
  • 2,619
0 votes
1 answer
73 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,...
  • 251
2 votes
3 answers
144 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} \...
  • 2,619
0 votes
1 answer
64 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, ...
  • 2,619
1 vote
2 answers
55 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 ...
  • 7,957
1 vote
1 answer
20 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
37 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
58 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 ...
  • 5,275
3 votes
3 answers
66 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, ...
  • 131
3 votes
1 answer
107 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 ...
  • 2,579
1 vote
1 answer
47 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 ...
  • 7,957
0 votes
0 answers
59 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
87 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
44 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 ...
  • 113
3 votes
2 answers
132 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
421 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\...
  • 522
0 votes
0 answers
33 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} ...
  • 113

1
2 3 4 5
11