[Tex/LaTex] How to install the xpatch package in MiKTeX

installingmiktexupdatingxpatch

This is a follow up question to \nameref only shows reference as a red rectangle, no name in it.

In the answers to the question cited @Werner suggested to have the package xpatch installed so that revtex4 can properly do cross-referencing. Thus, after a number of attempts (because instead of a file to save I was getting a listing of code) I was able to download xpatch.ins and xpatch.dtx, placed them in the working folder and ran pdflatex xpatch.ins from within WinEdt. Then I tried to compile the TeX document (F9) and got the error message

! LaTeX Error: Two \documentclass or \documentstyle command.

Notice, I'm trying to compile @Werner's minimal working example given in the original question cited above.

Now that I was unsuccessful in this compilation, I reverted to MiKTeX, trying to install xpatch from there. I started the MiKTeX package manager and it was soon populated with a list of packages. The package xpatch was in the list but was uninstallable. So, I tried to get it from the list of repositories which show up when going to Repository->Change Package Repository. None of these repositories, however, seems to contain xpatch. Also, none of these repositories is the one @Werner pointed to in the original question; namely, http://ctan.org/pkg/xpatch and I couldn't find a way to get to it through MiKTeX. So, the problem still stands — how can I install xpatch so that revtex4's cross-referencing starts working?

EDIT: I'd like to add that before pressing Ctrl+Z in WinEdt after the unsuccessful compilation, the error seen is

1.55 \documentclass[full]{
                          13doc}
?
! Emergency stop.

Best Answer

You can install xpatch via the MiKTeX Package Manager. In your windows program folder are the folders Maintenance and Maintenance (Admin). For package installation you should start the Package Manager as admin. In the menu Repository just Synchronize yours with the source repository first. After that look for the xpatch package, mark it and click Install in the Task menu. Thats all. If there are other packages which are needed by xpatch and they aren't installed just repeat the procedure with the Manager. To install all non installed packages in one run, go to Edit --> Select Installable Packages and than Task --> Install. So you have all available packages on your computer.

If you have other problems with the package (or with others), start the Update(Admin) in the Maintenance (Admin) folder and refresh the complete MiKTeX first. enter image description here