Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [patching]

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

1
vote
2answers
35 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
47 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
42 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 to ...
1
vote
1answer
53 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
115 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
45 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
45 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 ...
1
vote
0answers
35 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 ...
6
votes
1answer
258 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
86 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
314 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
0answers
92 views

Beamer theme metropolis issue on MacOSX High Sierra [duplicate]

I'm trying to use the metropolis theme (v1.2) with beamer (v3.45) on my MacBook, having MacTex 2017 installed. I keep the packages up-to-date with Tex Live 2017. It doesn't matter whether I choose ...
0
votes
1answer
156 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
51 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
268 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
168 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
120 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
76 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 ...
4
votes
1answer
49 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
26 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
88 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 ...
4
votes
1answer
985 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 ...
4
votes
1answer
186 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
145 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
682 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
40 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
189 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
144 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
165 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
235 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
453 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
440 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
697 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
147 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
361 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
110 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
55 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 ...
3
votes
1answer
284 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
483 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
254 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
204 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
504 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 \...
3
votes
1answer
162 views

Patching a command with an optional argument or declared with \DeclareRobustCommand

To re-define a command to contain itself (patching in TeX parlance) you usually use \let. This answer by @egreg says: Never use \let on commands defined with \DeclareRobustCommand or commands ...
18
votes
1answer
332 views

Patching commands in LaTeX3

Is there some facility in the LaTeX3 kernel to modify existing commands like etoolbox's \preto \appto and \patchcmd do?
3
votes
2answers
872 views

Chapter number in left right margin

I would like to move the chapter number in the right margin (a bit like in the classicthesistheme) but all I tried just results in errors, it would be nice if some could have a look. My MWE is using ...
1
vote
0answers
38 views

Why is patchcmd not working with moderncv 2.0, but renewcommand is? [duplicate]

I am writing a CV with cover letter using moderncv 2.0 and I would like the line with the recipient to be longer. This question is technically a duplicate of this one, but the given solution does not ...
1
vote
1answer
105 views

Patch the standalone redefinition of document environment in order to automatically add some extra code?

Edit. I rewrite my question as I simplified too much my real problem and the example didn't reflect it. In the following MWE, a custom class myclass.cls: defines a custom \maketitle macro (\...
6
votes
1answer
239 views

How to patch a command from leipzig.sty

As shown in Issues with leipzig and glossaries used together, there is a problem when using the package leipzig with the glossaries package since the leipzig package relies on deprecated commands from ...
6
votes
1answer
176 views

Does LaTeX3 have something for patching (or appending code to) commands?

Item #12 of https://tex.stackexchange.com/a/148734/18401 suggests that LaTeX3 maybe has something for patching (or appending code to) commands, à la etoolbox or xpatch. Is it the case?
3
votes
1answer
851 views

Patch \insertshorttitle in beamer

In this answer @cfr showed me how to preserve short title color in beamer while allowing hyperlinks to work. His solution was to modify the \insertshorttitle command (defined in beamerbasetitle.sty) ...