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
1
vote
1answer
39 views

How can I rewrite these conditionals effectively?

I'm working on modernizing and adapting an old LuaLaTeX template made for exams and other university documents. The thing is, the document is full of conditionals like these: \newcommand{\showMarks}{...
4
votes
1answer
39 views

Understanding empty \newcommand's in etoolbox.sty

In etoolbox.sty, three commands \ifdefmacro, \ifdefparam and \ifdefprotected are firstly defined by \newcommand\cmd{}, then by \long\edef\cmd{...}. I don't understand why the empty \newcommands are ...
4
votes
2answers
85 views

\csdef{} that reports error if command is already defined

Is there a version of \csdef{}{} that reports an error if the value is already defined? The MWE below compiles fine since no checking for the macro already being defined is done and yields: I want to ...
0
votes
0answers
24 views

Chemical packages bug fontspec mhchem siunits

Example: \documentclass[10pt]{beamer} \usetheme{Singapore} \setbeamertemplate{navigation symbols}{} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{helvet} \usepackage{natbib} \...
2
votes
1answer
54 views

Patch `pmatrix` with optional arguments

I need to patch the math command pmatrix with optional arguments. For example, I'd like to patch the following code, while treating it as immutable. \[ \begin{pmatrix} & a & b\\ c &...
0
votes
0answers
14 views

Hyperlink to homepage after author in amsart

The amsart class provides the command \urladdr which is intended to place a hyperlink to the homepage of each author at the end of the document. I wonder whether the amsart setauthors command can be ...
1
vote
2answers
39 views

Conflict between french option, babel package, babel tikzlibrary and etoolbox package

I'm sorry for the pretty vague title. I've tried to make it as clear as I could. In my documents, I'm setting up the language option with babel package and to avoid some troubles I had to load babel ...
0
votes
0answers
20 views

bibliography overwrites header

I am writing a journal-type document, in which the bibliography for an article should be printed at the end of the article. I am using the book class for it. For the references, I want to use \begin{...
2
votes
1answer
57 views

Cleveref's namecref usage in etoolbox' tests

I am currently trying to create new commands to add the correct French article in front of the cross-references when required (for example "la figure XX" or "le chapitre XX"). My initial idea was to ...
1
vote
1answer
56 views

How to fix etoolboox error? BibLaTex using bibstyle=uni-wtal-ger

I'm trying to use BibLaTeX with citestyle=authoryear-ibid and bibstyle=uni-wtal-ger My main.tex looks like this: \documentclass[paper=a4,pagesize=auto,oneside,fontsize=12pt,toc=bib]{scrreprt} \...
0
votes
0answers
42 views

Hook for outer par mode

Is it possible to execute macros after the correct mode is 'reached?' \documentclass{article} \usepackage{etoolbox} \usepackage{marginfix} \newcommand{\mymarginpar}[1]{\AfterEndEnvironment{figure}{\...
7
votes
1answer
82 views

Automate equation variable description with glossaries-symbols

I'm trying to automate the description tables of equations with the help of the glossaries-package. I already found this question, but on the one hand it didn't work for me, and on the other it seems ...
3
votes
1answer
107 views

Definitive way to pre- and append code, or patch commands?

Consider the following example: we have a command \mycmd, defined in some pacakge as: \DeclareRobustCommand{\mycmd}{% <original source code> } we want to patch this command, in the sense ...
2
votes
2answers
73 views

Safe way of redefining \- only for math mode

I know that \- is already used for hyphenation and inside tabbing. How can I patch this command such that it does something else, but only inside math environments? I tried the following: \...
2
votes
1answer
28 views

String comparison between AlphAlph and clist_item fails

I am trying to compare the results of AlphAlph and the indexing of a comma-delimited list. Why does this not work? MWE %! TEX PROGRAM = pdflatex \documentclass[a4paper]{article} \usepackage[utf8]{...
6
votes
1answer
300 views

LaTeX, etoolbox and counters

I'm having a new issue with the etoolbox package. In fact, I would like in a LaTeX document to numberize my figures, tables, etc... But, when I add the value of the counter to the list, it doesn't ...
3
votes
1answer
47 views

LaTeX etoolbox list not working in environment

I'm working on LaTeX and I want to add an element to a list each time I call an environment (here the environment environment). When I run the document the result is ['command'] instead of ['...
1
vote
1answer
50 views

Expandable Substring inside an ifboolexpr

Seeking understanding of how to expand a substring so the value can be evaluated within ifboolexpr from etoolbox package - As a relative newbie to latex (only using it for the past 18 months), I'm ...
2
votes
1answer
26 views

Failure to patch pict2e to have a fillable oval

I am trying to patch "on the fly" pict2e.sty so that I can have filled ovals (this comes from here: https://github.com/Rmano/circledsteps/issues/5). I tried this: \documentclass{article} \usepackage[...
5
votes
1answer
59 views

How to work with members of sequence during iteration with expl3?

I have several environments before and after which I want to insert identical code. I want to do this using expl3 because in my opinion it is the best solution. But my solution does not work because ##...
2
votes
3answers
71 views

Toggle optionally red color to multiple lines in align environment

I am writing a document that contains some mathematical proofs. I would like to define a command in LaTeX that enables me to write some additional passages to my proofs which are shown only when a ...
3
votes
2answers
269 views

what does csnumgdef do?

What does \csnumgdef do? From code examples, it appears to take two arguments, and one is led to believe that it defines a number var and assigns to it the value val, as in \csnumgdef{var}{val}. If ...
0
votes
1answer
46 views

\xpatch fails if \PassOptionsToPackage{french}{babel} is used

Everything works fine if I do not use \PassOptionsToPackage{french}{babel}. My document class abntex2 already loads babel, then, to load the french language I need to use \PassOptionsToPackage{french}...
0
votes
1answer
58 views

How to replace a command argument as #2 with something else?

I am trying to patch this macro: \xshowcmd\addcontentsline > \addcontentsline=macro: #1#2#3->\begingroup \let \label \@gobble \ifx \@currentHref \@empty \Hy@Warning {No destination for ...
12
votes
2answers
250 views

How do I limit the scope of etoolbox environment patching?

I want to use the etoolbox package to patch a certain environment; but - I only want to do it for a certain stretch of my document. Enclosing in curly brances doesn't work: \documentclass{article} \...
3
votes
2answers
46 views

Compilation error is removed by compiling again

Following up this answer, the first run of compilation results in the following error: Undefined control sequence. This exam contains \textbf{\NAMEquestions} which has to be eliminated by running ...
5
votes
2answers
104 views

Incompatibility between noindentafter and etoolbox (> v2.5f)?

After compilation of some legacy code including the noindentafter package, I just noticed that they produce a warning which never came up before: Package noindentafter Warning: Patching `\end' failed!...
3
votes
2answers
232 views

Output to multiple .pdf documents using LuaLaTeX and Toggles

I have a document that I sometimes want to print as one single document, and other times I want to print it as smaller groups of pages. I would like to automate the process. I'm using TeXmaker with ...
3
votes
1answer
156 views

How to generate summary table automatically?

I have to generate a summary of impacts and actions in many enviromental reports. Sometimes there are two or more impacts in the analyses, so I have to create the lines manually in the table. Is there ...
0
votes
1answer
60 views

etoolbox not breaking page when needed

I have the following piece of code in the preamble, that should prevent chapter from beginning on different pages, but, by the same time, when I get to chapter 3 it has enough text to break a page and ...
0
votes
0answers
19 views

tabularx too wide (after using etoolbox's appto?) [duplicate]

After using the solution of another problem (see here), my tabularx table is too wide now. Please see the MWE and its output below. Adding \noindent before the first table doesn't help (as suggested ...
1
vote
2answers
55 views

Table of contents: section titles ragged right - 2

The problem of having ragged right toc is described in Table of contents: section titles ragged right for articles. The etoolbox-option seem not to work with the book class, and I am not too ...
1
vote
1answer
117 views

etoolbox and tabularx — problem with `appto`

I'm trying to print worksheets. I have already implemented an automatic numbering for subtasks. I use tabularx for my subtasks (see the MWE below). Yesterday, I tried to define a new macro called \...
3
votes
2answers
60 views

etoolbox: ifdefvoid check for empty lines

I designed a system that reads a number of variables and, depending on the definition creates a text (either text "a" and the text contained in the variable (macro), or an alternate text "b" when the ...
1
vote
0answers
33 views

Run command before end of each frame [duplicate]

I've modified \item to insert a \vfill after each occurrence to space out bulleted lists on slides so they do not cluster in the center following this answer. However, to balance out my vertical ...
0
votes
0answers
26 views

etoolbox error in running template for ScienceAsia

Currently I am using pctexv6, and I tried to typeset this following simple template for a specific journal. However the output didn't come out and I got error message saying ! Package etoolbox Error: ...
1
vote
2answers
67 views

\raggedleft the content of all frames in Beamer

I want to \raggedleft only the content of each frame in Beamer. I tried this \documentclass{beamer} \usepackage{etoolbox} \AtBeginEnvironment{frame}{\raggedleft} \begin{document} \begin{frame} ...
0
votes
1answer
37 views

patching thenomenclature does not work

cant really understand why, but this code does not work \immediate\write18{makeindex \jobname.nlo -s nomencl.ist -o \jobname.nls} \documentclass[english]{article} \usepackage[T1]{fontenc} \usepackage[...
0
votes
1answer
37 views

How to format text based on a logical statement that reads in a value from a csv?

Background Hello, and thanks in advance for any insights you all can offer! Sorry for the very long post, but I noticed most new users are chastised for not sharing enough context. The TLDR version ...
2
votes
1answer
68 views

Labeled input parameters

I am creating a frontpage for various exams and I am looking to automate it a bit further. At the moment I write in (or rather copy paste), a ton of commands in the preabmle as follows: \newcommand{\...
0
votes
2answers
79 views

Toggletrue with a command line

How to set the value of a toggle (from etoolbox package) with command line ? I would like to create cmd file to compile latex file with different toggle value (i.e. one cmd fiel will compile wiht the ...
1
vote
0answers
106 views

Use \apptocmd to redefine \chapter

I am trying to write the style name into the marginal part, e.g., CN&CT to come at marginal note for \chapter tag, for this, I tried with the code, which are follows as: \documentclass{book} \...
2
votes
3answers
78 views

How to make chapter first page use mystyle?

It seems chapter first page use plain style. I created mystyle. How to make chapter first page to use mystyle? \documentclass[twoside]{report} \usepackage{lipsum} \usepackage{fancyhdr} \pagestyle{...
3
votes
1answer
134 views

Does `\AfterBeginEnvironment` command already exist?

Do you know the commands \AtBeginEnvironment and \AtEndEnvironment? I need a command like \AfterBeginEnvironment in order to put some text right aftert my all environments. Is there a way? That ...
0
votes
0answers
115 views

How to set fancyhdr on chapter initial page of two side report?

\documentclass[twoside]{report} \usepackage{lipsum} \usepackage{fancyhdr} \pagestyle{fancy} \begin{document} \chapter{First} \lipsum[1-9] \end{document} Given the obove as a start. I see one ...
1
vote
1answer
83 views

Toggle row numbers & dotfills in table

I'm trying to add automatic row numbers and dotfills to a table, with a toggle that disables them for certain rows, however it doesn't work as expected. In the MWE below, the toggle is working for row ...
7
votes
2answers
834 views

etoolbox: AtBeginEnvironment is not At Begin Environment

I tried the following MWE: \documentclass{article} \usepackage{etoolbox} \AtBeginEnvironment{table}{AtBeginEnvironment\par} \AtEndEnvironment{table}{AtEndEnvironment\par} \BeforeBeginEnvironment{...
5
votes
1answer
121 views

Obeylines and \gappto from etoolbox

In order to simplify data entry with as little markup of the data as possible, I am attempting the following: \documentclass{article} \usepackage{etoolbox} \begingroup \obeylines \gdef\ing#...
13
votes
2answers
3k views

“Patch failed” in EMNLP Style Template

I was trying to use the LaTeX files for the EMNLP 2019 conference (download link can be found here), but when I try to compile the provided example .tex file, it doesn't work and I get the following ...
1
vote
1answer
52 views

etoolbox + koma-script: Warning 'seems someone has broken package auxhook'

I use etoolbox's \AtEndPreamble to load the package hyperref at the end of the preamble. Doing so in a koma-script document results in the warning Class scrartcl Warning: seems someone has broken ...

1
2 3 4 5
9