# How to get mdframed package working correctly?

On a fresh Ubuntu 12.04 64 bits system, I wanted to add the mdframed package to my texlive distribution.

After searching in Ubuntu standard repositories without success, I went to the CTAN website to download and manually compile and install the package. I did it and put this in the texmf directory tree in my home and after running texhash on this directory I got a new error when compiling about missing xparse package.

I repeated the same, and found this package in the texlive-latex3 standard Ubuntu package. So I installed it through apt-get and now I am getting the following other error that I can't solve:

/usr/share/texmf-texlive/tex/latex/oberdiek/zref-abspage.sty:94: Missing \begin{document}.


How can I solve it ?

-
I guess that is a problem with the too old TeX Live packages in Ubuntu 12.04. There are ppa for TeX Live 2012 packages, where mdframed is also included. Using this is probably the best option. Or you get TeX Live upstream from tug.org/texlive –  norbert Sep 13 '12 at 9:28
Thanks for the comment. ubuntu 12.04 provides texlive TeX 3.1415926 (TeX Live 2009/Debian) that seems to be quite old. Unfortunately changing this seems to appear a big change to my eyes. Isn't it ? –  Manuel Selva Sep 13 '12 at 9:41
The alternative is maintaining a separate texmf tree (home or local) with manually updated packages. –  Heiko Oberdiek Sep 13 '12 at 10:31
@HeikoOberdiek As I see your name in the package hierarchy I guess you are the author of the package ;-) Do you confirm that this is an issue with Ubuntu too old texlive version ? I didn't get the point of your alternative solution (I am really new to latex), can you explain a little bit more ? Many thanks –  Manuel Selva Sep 13 '12 at 10:40
After TL 2009, the LaTeX3 packages changed dramatically: from expl3 (I think) to l3*. A base install of Debian's version of TL (i.e., 2009), will have the wrong version of xparse, etc. You need to purge the expl3 stuff and install the .tds.zip versions of l3experimental, l3kernel, and l3packages (the last has the current version of xparse). I said 'purge' because if you merely install the l3* stuff, most packages will continue to try to use the expl3 ones, which won't work. –  jon Sep 13 '12 at 17:04

The number of lines in zref-abspage.sty is 66 in recent versions. In the history I could not find a hint that could explain more than 28 additional lines. What contains line 94 with two lines before and after?

You can recreate the file, if the sources are installed. Make a scratch directory, copy the file zref.dtx there and unpack it, e.g.:

mkdir /tmp/zref-scratch
cd /tmp/zref-scratch
cp /usr/share/texmf-texlive/source/latex/oberdiek/zref.dtx .
tex zref.dtx


This should generate lots of style files with zref-abspage.sty among them. Note that you need plain TeX, not LaTeX. Otherwise the documentation would be generated. The two files can be compared:

diff -u /usr/share/texmf-texlive/tex/latex/oberdiek/zref-abspage.sty zref-abspage.sty


Are there differences?

• If yes, what are the differences? The wrong file can then be renamed (for safety and further analysis) and replaced:

sudo mv -i /usr/share/texmf-texlive/tex/latex/oberdiek/zref-abspage.sty /usr/share/texmf-texlive/tex/latex/oberdiek/zref-abspage-saved.sty
sudo cp /tmp/zref-scratch/zref-abspage.sty /usr/share/texmf-texlive/tex/latex/oberdiek/zref-abspage.sty

• If no, Which version you are using? Look into the file zref-abspage.sty.

My recommendation would be to install the original TeX Live, "howto"s can be found in the net, e.g.:

The alternative is installing manually updated packages in a local TDS tree (for all users) or in the home texmf tree (~/texmf) for the current user only. The Ubuntu documentation contains a section about LaTeX.

To identify the local tree you can try:

kpsewhich --expand-var '\$TEXMFLOCAL'


The home tree usually is ~/texmf.

If the package provides a .tds.zip file, then the installation is easy. As example I am using my bundle to install in the home texmf tree:

wget http://mirror.ctan.org/install/macros/latex/oberdiek.tds.zip
unzip oberdiek.tds.zip -d ~/texmf


In case of the local texmf tree, texhash needs to be called:

sudo texhash

-
Thanks for the complete answer I didn't read yet ;-) To answer to your first question: wc -l /usr/share/texmf-texlive/tex/latex/oberdiek/zref-abspage.sty returns 53. It's really strange !!! ??? –  Manuel Selva Sep 13 '12 at 12:06
To answer to the second question, I don't have the sources :-( –  Manuel Selva Sep 13 '12 at 12:08
53 lines for the old version look more reasonable, therefore I think, zref is correctly installed and assume that the message is wrong. Check the .log file directly. And if you need expl3 and xparse the Ubuntu version is way too old. –  Heiko Oberdiek Sep 13 '12 at 12:12
the log file contains a lot of thing. Difficult to get into it. Anyway I think I need to update to Tex Live 2010 or even more recent. Thanks for your help again. –  Manuel Selva Sep 13 '12 at 12:19
The first error message would be interesting. Current is TeX Live 2012. –  Heiko Oberdiek Sep 13 '12 at 12:29