The following are the (somewhat) detailed instructions to running your local copy of the Stacks project.
plasTeX
First you need to install a modified version of plasTeX. We assume that you are using Python 3 by default, change accordingly if that is not the case. Perform the following in the location where you want to install plasTeX:
git clone https://github.com/gerby-project/plastex.git
cd plastex
git checkout gerby
pip install .
The following is only required if you have a complicated bibliography containing mathematical expressions in the titles, and can be safely skipped. Perform the following steps where you want to install pybtex
.
git clone https://github.com/live-clones/pybtex.git
wget https://bitbucket.org/pybtex-devs/pybtex/issues/attachments/110/pybtex-devs/pybtex/1514284299.07/110/no-protected-in-math-mode.patch
cd pybtex
git apply ../no-protected-in-math-mode.patch
pip install .
Now we can run plasTeX on the Stacks project’s LaTeX code. Perform the following steps where you want to place the Stacks project.
git clone https://github.com/stacks/stacks-project.git
mkdir WEB
cd stacks-project
echo yes | python2 scripts/add_tags.py
make web
cd ../WEB
plastex --renderer=Gerby book.tex
If all went well, you now have a directory called WEB/book/
containing several tens of thousands small HTML files, and files named book.paux
and tags
inside WEB/
.
Importing tags
The next step is to install Gerby, and import the result from the previous step into the database.
git clone https://github.com/gerby-project/gerby-website.git
cd gerby-website/gerby/static
git clone https://github.com/aexmachina/jquery-bonsai
cp jquery-bonsai/jquery.bonsai.css css/
cd ../../
pip install .
The following is only necessary if you use xypic
, as is the case for the Stacks project.
cd gerby-website/gerby/static
git clone https://github.com/sonoisa/XyJax.git
sed -i -e 's@\[MathJax\]@/static/XyJax@' XyJax/extensions/TeX/xypic.js
We can now import things into the database. The Python script for this is found in gerby-website/gerby/tools/update.py
, and the configuration in gerby-website/gerby/configuration.py
needs to make the files tags
and book.paux
, and the book/
directory known to this script. With the default configuration, this is done by creating the following softlinks from within gerby-website/gerby/tools
:
ln -s ../../../WEB/book stacks
ln -s ../../../WEB/book.paux stacks.paux
ln -s ../../../WEB/tags stacks.tags
Assuming Gerby is now correctly configured to read the output of plasTeX, it suffices to run the following.
python update.py
Running the website
Having done all this, running the website should be easy. This is assuming you have installed all the dependencies. You might have to install quite a few Python packages, but they can all be easily pip install
‘d. Perform the following steps in gerby-website/gerby
export FLASK_APP=gerby
flask run
Now you have a website which you can access via localhost:5000
.