[Tex/LaTex] How to get mdframed package working correctly

mdframedtexliveUbuntuzref

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 ?

Best Answer

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