Questions tagged [patching]
{patching} is for questions about patching the definition of macros.
143 questions
3
votes
2
answers
174
views
How to modify the command \@maketitle defined using '\def' in 'book.cls' in 'main.tex'?
I hope to modify the definition of an internal command in the "Standard Document Class book.cls".
This "internal command" is a command named \@maketitle defined by \def.
I hope ...
6
votes
3
answers
272
views
How to change `minimize` to British English Spelling in optidef package
Using optidef package, one can write
\documentclass{article}
\usepackage{optidef}
\begin{document}
\begin{mini} {w}{f(w)+ R(w+6x)} {}{}
\addConstraint{g(w)}{=0} \addConstraint{n(w)}{= 6}
\...
0
votes
1
answer
53
views
Defining a version of \intertext without page breaks
I’m trying to define a version of amsmath’s/mathtools’ \intertext that prevents page breaks. My approach is to patch a copy of \intertext to remove the \penaltys:
\tracingpatches
{\makeatletter
\...
4
votes
1
answer
115
views
Line spacing of a multi-line title in amsart
So, as I (edit: incorrectly) understand it, changes to line spacing are best effected by redefining \baselinestretch. However, in amsart, this cannot change the line spacing within a multi-line title, ...
2
votes
2
answers
164
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]...
2
votes
1
answer
79
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]{...
5
votes
3
answers
205
views
How to patch (redefine) the standalone's \subpreamble command?
I'd like to patch (redefine) the standalone's \subpreamble command but my attempts seem to fail. Here's an MCE that I expect to fail to compile because of the \aaa command, but it doesn't:
\begin{...
5
votes
3
answers
429
views
Applying a Little Artificial Intelligence to a Patched Titlecaps Algorithm
This question is based on @StevenB.Segletes' patch for titlecaps found here: Reformatting a Paragraph Consisting Entirely of Capital Letters
Consider the code:
\documentclass[12pt]{article}
\...
4
votes
2
answers
141
views
How to patch command to work differently in math mode?
I am using starfont to get astronomical symbols in my document. Unfortunately, the package defines the symbols for text mode only. From this answer, I was able to declare math versions of the symbols ...
2
votes
1
answer
144
views
Frankenstein’s Conscience conflicting with tabular environment? How to patch?
I'm using compsci and friends for a LaTeX course. But the following MWE
\documentclass{article}
\usepackage{compsci}
\begin{document}
Well, the following works: ``\cs\_''
% but there's an extra ...
0
votes
0
answers
115
views
Patching \cref and \Cref to write additional information to the .aux file
I need to patch the macros \cref and \Cref so that when used like this:
\cref{label1,label2,label3}
besides generating the normal layout in the document, they write something like this to the .aux (...
6
votes
2
answers
247
views
Command to renew other commands
Is it possible to create a command which takes the name of a command c as an argument and redefines c (e.g. via renewcommand) in terms of itself but adds some new functionality?
In short, can we ...
0
votes
1
answer
80
views
How to patch the \totalpoints command correctly without error on first compilation
My goal is to have half points that are printed with a comma as a decimal symbol (e.g. 2,5 points). Thus, I use a workaround and multiply all points with 10 and use the patchmd command from etoolbox ...
4
votes
2
answers
253
views
How to use `patchcmd` with a code containing `{`?
I have a macro with a long hbox, and I'd like to integrate a simple tikz box by adding a line of code in front of its {. However, I'm facing challenges due to the inclusion of curly braces in that ...
0
votes
1
answer
68
views
Adjust font size with \patchcmd{\normalsize} not working with TL 2022
I used to slightly adjust my font size with \patchcmd{\normalsize}. Consider this code:
\documentclass[11pt]{memoir}
\usepackage{etoolbox,lipsum}
\makeatletter
\patchcmd{\normalsize}{\@xipt}{{30pt}}{}...