The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [patching]

{patching} is for questions about patching the definition of macros.

Filter by
Sorted by
Tagged with
1
vote
2answers
51 views

Different style for appendix section heading via KOMA-script

I like the use of hanging section numbers in the margin. But when I move to the Appendices, I would like to revert the behavior back to normal. Additionally, I'd like to start the name of the ...
1
vote
1answer
41 views

How to add code at beginning of every chapter?

I would like to add code at the beginning of every chapter. In particular, the \minitoc command. I hoped \appto would do the trick. But no luck. \usepackage{etoolbox} \appto\chapter{Test} Just uses ...
7
votes
3answers
438 views

Why does this regexpatch command only work once, not twice?

Based on an early version of How can I add a single curly brace to a macro?, I have tried the following to add, one by one, inner commands to some outer command. (The reason I am doing this is that I ...
2
votes
1answer
36 views

Turn string into macro (change catcodes)

Is it impossible to covert string back into macro? I know that with lualatex we can do a lot of funny things with macros. I have never seen string converting without it. \documentclass{article} ...
0
votes
2answers
45 views

How to patch \href to look like \url?

There are at least two questions, that ask for this without mentioning it explicitly, so there we go. Neither this nor actually answer the questions, how to make \href style the same way as \url - ...
0
votes
0answers
34 views

Empty the pagestyle for last parts of my report document

I have patched in my preamble the command \chapter with the package etoolbox so as to get a defined style for all my chapters \patchcmd{\chapter}{plain}{mystyle}{}{}. (I am using the fancyhdr package )...
2
votes
2answers
55 views

Patch `\includegraphics` to call `\embedfile`

I want to make a package that automatically attaches all essential*) source files to the ouput PDF. I started with the embedfile, filehook and currfile packages and put \embedfile\currfilename \...
2
votes
1answer
68 views

How to color half page?

I used color to color my page. I want a horizontal (halfway) colored patch which begins from the midpoint and ends at the right end of the page. (Only for the first page and not for the complete ...
2
votes
2answers
131 views

Capitalize first letter of words in chapter mark

I would like to capitalize the first letter of several words in the chapter and the chapter mark. While text in the chapter itself is capitalized, in the chapter mark it is not. Here is a MWE of my ...
1
vote
2answers
83 views

remove “./” of “\currfileabspath” when using lualatex

I have a small problem with the package currfile and the command \currfileabspath. When compiling the file using (pdf|xe)latex I get the expected result, but if I use lualatex it adds ./ to the ...
3
votes
2answers
106 views

Strange result with patch of \overarc

Triying to use a patch for \overarc from this answer https://tex.stackexchange.com/a/409106/54817 I got this result \documentclass{article} %\usepackage{fix-cm} \usepackage{arcs} \usepackage{...
2
votes
2answers
80 views

moderncv package does not recognize \it command

The moderncv package does not recognize \it command. Sure we can use \textit instead. The problem is that BibTeX generated files may contain \it commands ... So, edition of the bbl file is required ...
1
vote
1answer
65 views

Pass option to each occurence of command (especially \printbibliography with biblatex)

In a large book with many sub-bibliographies, I want to ensure that crucial bibchecks are executed at every call to \printbibliography. Normally, one would simply call \printbibliography[check=...] ...
3
votes
0answers
125 views

pdfx and biblatex attempt to patch the same things? [closed]

The below MWE gives errors. Moving the line \usepackage{pdfx} below the biblatex package (right before \begin{document}) will currently not give explicit errors, but “it is best if pdfx is the first ...
0
votes
1answer
53 views

How can I patch the abstract, list of figures, and list of tables macros to be included in the ToC automatically?

We can definitely use \phantomsection \addcontentsline{toc}{chapter}{<name>} right after we begin the environments or type the relevant macro, which would include abstract, list of figures and ...
0
votes
1answer
53 views

Adding transparent characters into class-defined macros

This question is related to a previous question regarding machine readability of a PDF generated using moderncv. I'm trying add some hidden description within the PDF, so the information is not ...
3
votes
0answers
61 views

regexpatch \xpatchcmd fails in patching command begins with space

The \xpatchcmd provided by regexpatch fails in patching command which begins with space. The same \xpatchcmd provided by xpatch works alright. Some version info: XeTeX 3.14159265-2.6-0.99999 ...
7
votes
1answer
363 views

Add command at the beginning of all frames

I need to add a command \setRTL from the bidi package to write right-to-left text, at the beginning of every frame. Another answer does not solve the issue; any suggestions? \documentclass{beamer} ...
1
vote
1answer
119 views

Patching tikzscale

I'm trying to patch the package tikzscale. Specifically, I want to remove the following lines from the package, as it does not constitute a useful error in my usecase[1]. \tikzscale@ifSizeDifference{\...
5
votes
2answers
388 views

Patching an essential LaTeX command, such as \usepackage

This is in the category of "things that work, but make me nervous." I use a very complicated, custom document class with LuaLaTeX. But my question can easily be illustrated with this generic MWE: \...
0
votes
1answer
225 views

LaTeX Beamer Metropolis — Patching Conflict Again

After a recent update to my installation of TeXLive 2016, I get l.275 ...opolis}{Patching section title failed}\@ehc when I try to xelatex or lualatex the file demo.tex in texmf-dist/doc/latex/...
1
vote
1answer
60 views

How to comment a package line before loading the package?

I can solve the issue bigfoot.sty:61: Package hyperref Warning: Option `hyperfootnotes' has already been used by commenting out the line 61: File: D:/User/Documents/latex/texmfs/install/tex/latex/...
5
votes
1answer
299 views

Why a patch that works for align environment doesn't work for flalign environment?

I'm trying to Add a marginal note when a page break occurs in the middle of a multi-line equation, using the nice method provided by egreg in its answer to my question: Disable fleqn option for ...
0
votes
2answers
246 views

How to get \include to clear a double page

I write a scrbook (twoside) in which I \include files for every section. As I normally only want to print the pages for a single included file, I need to \cleardoublepage before (and potentially after)...
1
vote
1answer
148 views

Patching commands does not work for /RenewDocumentCommands

I am using the moderncv class provided by TeXLive 2016 and in it the \section command is redefined as follows: \RenewDocumentCommand{\section}{sm}{% \par\addvspace{2.5ex}% \phantomsection{}% ...
0
votes
2answers
81 views

How do I patch \begin{enumerate}?

I find myself using \begin{enumerate}[label=\alph*), topsep=-3ex] \item ... \end{enumerate} ~\newline very often. Since I am using a negative value for topsep to reduce the white space above the ...
3
votes
1answer
58 views

Patch starred environment and use it as nested environment in a new environment

For every (most?) environment \begin{X}...\end{X} there exists the macros \X and \endX that can be used inside the \newenvironment command. I.e, one can write something like this \newenvironment{Y}{\...
1
vote
0answers
41 views

patchcmd, #1 as hook, and AtEndPreamble [duplicate]

I'm trying to patch some bidi footnote commands (\@footnotetext, \@LTRfootnotetext, and \@RTLfootnotetext) in biblatex. The footnote patching commands in biblatex occur in an AtEndPreamble macro in ...
0
votes
0answers
116 views

How to compile .ins to .sty [duplicate]

Is there any way I can add metropolis package into MikTeX? I got this error: ! Package beamerfontthememetropolis Error: Patching section title failed. See the beamerfontthememetropolis package ...
3
votes
1answer
1k views

Metropolis is not working

I tried to use the metropolis beamer theme, but I got the following error ! Package beamerfontthememetropolis Error: Patching section title failed. See the beamerfontthememetropolis package ...
3
votes
1answer
247 views

Including section in an environment

I am trying to adapt touhami's solution to How to print out only statements (theorems, lemmata, etc) from a tex file? so that I can also print the section titles. My first guess would have been to ...
2
votes
1answer
178 views

How to patch result of \DeclareTemplateCode (for custom acro list style)

In trying to create a custom acro list style with a longtable and repeating heading, I started working my way through some LaTeX3 code more than I have in the past. I am used to patching with ...
9
votes
2answers
900 views

Using conditionals to ignore command does not work

I am trying to pdflatex a file but I get the following error: ! Incomplete \iffalse; all text was ignored after line [...]. The source of the error is a patch I used from here: Allowframebreaks ...
1
vote
1answer
44 views

Obtain snapshot of .idx file before end of document

For some trickery concerning cross-references between index and glossary, I would like to obtain a snapshot of the .idx file at a certain point of large document (book) - after the main body, but ...
4
votes
2answers
229 views

Error using `\verb` as the replace string on `\xpatchcmd`

On this code: \documentclass{article} \usepackage{catchfilebetweentags,regexpatch,verbatim} \tracingpatches \tracingxpatches \newcommand{\test}{testone (testtwo)} \begin{document} \xpatchcmd*{\test}{(...
3
votes
4answers
166 views

(x)patch a command the name of which is in another macro

I want to patch some command in a numbered list based on the current level (enumi, enumii, ...). Basically, I want to replace, in a command the name of which is stored in a macro, a macro the name of ...
2
votes
3answers
212 views

How can I loop through macros with \foreach and pass them to \xapptocmd?

Can I use pgffor to loop through macros (control sequences)? e.g. \foreach \macro in {\lions,\tigers,\bears} In case you haven't figured it out, I love modularization! Let's say I have three ...
4
votes
3answers
277 views

How can I write <section counter value>:<section title>:<page>:<file>:<line> to the log whenever (and whereever) a macro is called?

I am working on context-based log entries. Each time a selected (patched) macro is called, it should provide its contents along with a meaningful log entry. "Meaningful" log entry defined: The ...
3
votes
1answer
636 views

file ended while scanning use of \path

MWE: \documentclass{article} \usepackage[obeyspaces]{url} \usepackage{xcolor,letltxmacro,booktabs,longtable,tabu} \LetLtxMacro{\oldpath}{\path} \renewcommand{\path}[1]{\color{gray}{\oldpath{#1}}} \...
4
votes
1answer
572 views

How to “shallow” \renewenvironment of \itemize?

I want to patch exactly the outer level of \itemize, whereas the following MWE (expectedly) patches all of them: \documentclass{article} \begin{document} \setlength{\fboxsep}{0pt} \let\saveditemize=...
4
votes
1answer
1k views

How can I redefine verbatim to wrap lines (add break before or after spaces)?

Before continuing, I would like to inform readers that I know it is generally discouraged to reimplement functionality that packages already support. Automatically wrap the text in verbatim has an ...
7
votes
2answers
176 views

Trouble with patchcmd and double #

I need to patch the following macro from gloss-greek.ldf (polyglossia): \def\greek@numbers{% \let\latin@alph\@alph% \let\latin@Alph\@Alph% \if@greek@numerals \def\greek@alph##1{\...
1
vote
2answers
419 views

Todonotes, inline with no decorations

I would like to use the todonotes package, but when I do inline todos, I don't want them to look any different. At the end of the document, I will list all the todos with \listoftodos and there they ...
10
votes
1answer
123 views

Using expanded macro as search pattern for \patchcmd

Is there any way to use the value of an expanded macro as the search pattern for etoolbox's \patchcmd (or xpatch's \xpatchcmd, etc), so that one can have some sort of a "dynamic" patch, by way of ...
1
vote
0answers
63 views

Append code to the \directlua primitive

LuaTeX provides the primitive \directlua, which is described in detail in section 1.6.1 of the LuaTeX reference manual. Basically, this primitive runs Lua code. Its syntax is: \directlua ⟨general ...
4
votes
1answer
366 views

How to patch a starred environment

I would like to translate my approach to center all figure environments to figure* environments. How? \documentclass[peerreview]{ieeetran} \usepackage{xpatch} % \def\figure{\def\@floatboxreset{\reset@...
2
votes
2answers
594 views

Equip a theorem with margin bar

Using PDFLaTeX, I am trying to equip theorem-like environments with a colored bar in the outer margin of the document. These theorems are already using the (nice) thmbox formatting. After trying the ...
4
votes
1answer
288 views

xpatchcmd with placeholders

Is there an alternative to \xpatchcmd from the xpatch package which supports placeholders as in this virtual example: \newcommand{\mycommand}{this is important \foo this is not \bar but this is} \...
2
votes
1answer
242 views

How to patch AMCOpen from AMC package

I'm trying to patch an AMC's macro, named \AMCopenShow using etoolbox. However, I got an error that gives many options but that I don't know how to solve, or even if it is possible to do it. [debug] ...
3
votes
2answers
642 views

How to patch with \xpretocmd and \xapptocmd a command by applying to it a macro with argument?

Suppose I'd like to patch a very complicated macro, say \autocite. For this, xpatch package is my friend. If the patch consists in applying a modal command which doesn't take arguments, such as \...