Questions tagged [patching]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
28 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
33 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
31 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
46 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
300 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
110 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
36 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
54 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 ...
12
votes
2answers
252 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
121 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
69 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
460 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
44 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
107 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
44 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
78 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
252 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
221 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
106 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
231 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
98 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
86 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
132 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
62 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
66 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
102 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
506 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
132 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
441 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
275 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
71 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
310 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
340 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
206 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
89 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
74 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
46 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
157 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
278 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
239 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
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
46 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
244 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
181 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
238 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
327 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
827 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
699 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 ...