Questions tagged [patching]

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

Filter by
Sorted by
Tagged with
1
vote
3answers
101 views

How does one keep a constant indentation for multiline items in tablenotes of a threeparttable?

Here an illustrative MWE: \documentclass[fontsize=11pt]{article} \usepackage{blindtext} \usepackage[flushleft]{threeparttable} \usepackage{booktabs} \begin{document} \blindtext \begin{table} \...
3
votes
2answers
81 views

Patching \usepackage / \RequirePackage

I want to implement automatic benchmarking for the packages I load (some of which are my own). Right now my preamble takes 15 seconds to load, much longer than the rest of my document seems to take to ...
1
vote
1answer
31 views

After \patchcmd \thispagestyle{empty} sets the word “plain” in upper left corner on parts page in scrbook

I'd like to have a background image on every parts page in scrbook. Found this solution: How can I give each chapter page its own background image in scrbook? by @crf The linked solution would set ...
3
votes
3answers
159 views

Keeping default optional argument when adding to command

TeX FAQ's "Patching existing commands" gives a method to add to existing commands that have an optional argument: \documentclass{article} \usepackage{letltxmacro} \newcommand{\rough}[2][\...
7
votes
0answers
181 views

Redefining Commands: Safety and Best Practices

There's plenty of questions on this site about redefining specific commands, but I couldn't find a more general, comprehensive question about the safety and best practices of redefining commands in ...
0
votes
0answers
36 views

patchcmd with if condtion

I've had the problem, that I needed a prefix in my list of figures/tables, but fortunately I found this solution. I work with the fancyhdr package, so I need the tocloft package with the title option....
0
votes
0answers
44 views

Is there a convenient hook to patch all of the AMS display math environments?

If I want to patch all of the amsmath display math environments to be wrapped in another environment (like for equation in this answer to adjust the line width), is there a convenient way to patch all ...
0
votes
1answer
101 views

How to use a different fontfamily for italic text

I want my document to change from CMR to Garamond when using italic typeface, and automatically go back when not using italic. Preferably would this happen when I just issue the \textit{} command. Is ...
2
votes
1answer
99 views

Exercise package : use a non-indented list environment for

I use the exercise package for typesetting exercises and questions. I would like to avoid the classical indentation of the questions (due to the using of a list environment, but I'm not able to set ...
5
votes
2answers
861 views

Problem with patching babel package

I am trying to use babel and biblatex package together but I am getting following error: ! Package biblatex Error: Patching 'babel' package failed. This is my code example: \documentclass[12pt,...
3
votes
1answer
168 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 ...
0
votes
0answers
52 views

diagbox with babel RTL tabular issue

I have issue with \diagbox in RTL tabular (babel with bidi=basic, lualatex engine), with xelatex bidi package provide patch of diagbox commands for right to left tabular, but for lualatex there isn't. ...
3
votes
1answer
73 views

Editing a word in a sty file

I want to edit a word in a .sty file. I'm learning Latex and I don't know if it can be edited by using \makeatletter and \makeatother commands in the preamble. The .sty file (novel-PostLayout, from ...
13
votes
2answers
329 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} \...
1
vote
2answers
306 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 ...
2
votes
1answer
128 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 ...
8
votes
3answers
478 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
47 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
172 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
76 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
103 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
612 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 ...
3
votes
2answers
363 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
138 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 ...
4
votes
2answers
484 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
133 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
108 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
150 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
75 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
85 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
1answer
135 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
670 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
137 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
514 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
359 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/...
2
votes
1answer
74 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
326 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
530 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
294 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
95 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
92 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
50 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
180 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
2k 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
324 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 ...
3
votes
1answer
281 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 ...
10
votes
2answers
1k 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
47 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
263 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
197 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 ...