[XeTeX] subfig and beamer: the Patch

Peter Dyballa Peter_Dyballa at Web.DE
Thu Jul 23 00:58:19 CEST 2009


Am 22.07.2009 um 16:28 schrieb brindle at stud.ntnu.no:

> People (I included) had problems with beamer and subfig. My beamer  
> and subfig work well independently in xelatex. A patch was written  
> (see below). I have no idea where to put the patch. Can someone  
> help me?


Patching is very simple.

First check whether you have admin rights on your Mac. If not we'll  
have to copy the file to patch into your private tree.

Then you could save the patch in a file. This file can be everywhere  
on your computer, but best when you can see it in Finder.

Now locate the place of the file to patch! It's /usr/local/texlive/ 
2008/texmf-dist/tex/latex/beamer/beamerbasecompatibility.sty. (In  
case you don't have admin rights invoke in Terminal 'mkdir -p ~/ 
Library/texmf/tex/latex/beamer' to create the empty directory for the  
STY file to patch later and then 'cp /usr/local/texlive/2008/texmf- 
dist/tex/latex/beamer/beamerbasecompatibility.sty ~/Library/texmf/tex/ 
latex/beamer' to copy the original version into its new place.)

When you don't use TLU (TeX Live Update application) or tlmgr and  
have admin rights, you can patch the original version in place. (It's  
also possible to put the patched file into an area outside the yearly  
distributions. Then the patched version will be preferred before  
those versions from each year's distributions. This isn't such a bad  
idea, because it would work the same way as having the patched  
version among your private parts, and it's not bad because the TeX  
Live 2009 pre-test distribution comes *without* the patched version.)

The act of patching a file is to change directory (cd, pushd) to the  
directory which holds the file(s) to be patched, for example:

	cd /usr/local/texlive/2008/texmf-dist/tex/latex/beamer

Now take the last step:

	sudo patch -p2 <<EOF

Press RETURN. You'll see an empty new line. Now copy from the eMail  
(or where-ever) the actual patch (it starts with "--" and ends in the  
last "{}"), press RETURN again, write the three letters "EOF" (it has  
to be same string as that you gave on the line starting with "sudo  
patch" that come right of the "<<" and which does not start a new  
line of contents in the patch itself) and press one more RETURN. Now  
the system asks you for a "Password:" which is that of root which  
gives you the privileged admin rights. Press a final RETURN. The  
system should answer with "patching file  
beamerbasecompatibility.sty." Finished.

=================
Some explanations
=================

The number after "-p" is that of the forward slashes contained in the  
path names of the files to be patched (these lines start with "+++").  
The convention "<<EOF" redirects standard input of the patch  
programme to a so-called in-line script which ends the string given  
after the redirect operator "<<." The "sudo" which introduces the  
patch command is necessary to give you the right to change a file  
that you don't own. The sudo is not necessary when you patch the copy  
in your private area.

When you've saved the patch in a file the command to patch the file  
is a bit different:

	sudo patch -p2 <

and before you press RETURN you drag this patch file from Finder onto  
Terminal (could be it's not allowed to have a SPACE character between  
the "<" and the patch file's path name, but you'll see this, the  
system will tell you; in that case press the Page-Up key to make the  
previous command reappear, move with the cursor to the SPACE(s),  
remove them, and finally press RETURN.)

=================

Another way is to edit the file manually. The patch tells you that "  
\providecommand\l at part{}" is on line #146. So go downwards in the  
file by two lines and then add the lines that start with a "+" but  
*don't* insert these + signs. Now save the changed file. (BTW,  
leading "-" tell to remove these lines.)

Similarly to the way you augmented your private area you could as an  
alternative augment the distribution independent /usr/local/texlive/ 
texmf-local tree – but introduced with a "sudo." When you're fast you  
won't need to give again root's password when you "sudo cp ..." the  
original file into its independent place. Then cd, again fast, to the  
directory with the copy and apply the patch. Again, the password you  
gave half or one minute ago will grant you the elevated privileges,  
you won't need to give the password. Final step here is:

	sudo texhash /usr/local/texlive/texmf-local

or the patched file won't be found. (In your private tree this last  
step is not necessary.)


A final word: the day might come that your default TeX distribution  
will contain the patch. Then you'd need to remove your private copy  
or that in the distribution independent tree, whichever the patched  
version is. And in the latter tree you would need to use the sudo  
command and you would need to add the "sudo texhash /usr/local/ 
texlive/texmf-local" command.


Where comes this patch from? Who is the author? Will it be integrated  
into TeX Live 20xy or is it something "private?"

--
Greetings

   Pete

The most exciting phrase to hear in science, the one that heralds new  
discoveries, is not "Eureka!" (I found it!) but "That's funny..."
				– Isaac Asimov





More information about the XeTeX mailing list