Skip to content
In which a PDF is a Git Repository Containing its own LaTeX Source and a Copy of Itself
TeX Python Shell Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
git @ a7d3b6b Removed a bunch of code that is now OBE Apr 28, 2017
.DEFLATEDummyHeader Trying the \immediate\pdfobj stream trick, but it doesn't seem to go … Apr 14, 2017
.gitignore Better filename for the polyglot PDF Jun 5, 2017
.gitmodules Initial commit with patched git submodule Apr 11, 2017
Makefile Don't take verify_xrefs too seriously Jun 6, 2017
README.md Added a dependency Jun 6, 2017
RazvodityeKrolikov.jpg Started wiriting the background on Git Apr 29, 2017
article.tex Better filename for the polyglot PDF Jun 5, 2017
fix_oversize_pdf.py Fixed off-by-one error when there is no newline after `obj` Jun 6, 2017
kolskaya.tex
make_polyglot.sh Forgot to pass `-e` to `echo` Jun 6, 2017
update_deflate_headers.py First cut at fixing the xrefs May 9, 2017
verify_xrefs.py Ignore junk after %%EOF May 10, 2017

README.md

This Git Repository is a PDF

This repository contains the LATEX source of the PDF, as well as all of the scripts necessary to rebuild the polyglot.

Building the Polyglot

If you cloned this repository directly from the PDF,

$ git clone PDFGitPolyglot.pdf PDFGitPolyglot
Cloning into 'PDFGitPolyglot'...
Receiving objects: 100% (174/174), 103.48 KiB | 0 bytes/s, done.
Resolving deltas: 100% (100/100), done.

then you will need to do some cleanup before running make:

git checkout master && git branch -d PolyglotBranch

After that, or if you cloned the repo from elsewhere (e.g., GitHub), then you will be able to run make, which will automatically build PDFGitPolyglot.pdf from the document contained in article.tex.

The first time you run make, the sources to a patched version of Git will be downloaded and compiled. This can be time consuming, so I suggest you use make -j8, or whatever is appropriate for your system.

Dependencies

  • a relatively full install of a TEX distro, such as TeX Live
  • autoconf and a C99 compiler for compiling git; I've found that git likes clang more than gcc
  • all of git's sourcecode dependencies (openssl, curl, gettext, &c.)
  • Python 2.7
  • bash
  • ImageMagick
  • qpdf, used by the verify_xrefs.py script for sanity checking; this dependency can be removed by commenting out the call to verify_xrefs.py in the Makefile

Caveats

The polyglot will fail to build if your document has any PDF objects (e.g., images) that are larger than 0xFFFF bytes. Read the article for more details.

License

Copyright © 2017 Evan A. Sultanik

Permission is hereby granted, free of charge, to any person obtaining a copy of this document and associated source files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice, this permission notice, and the entire contents and history of its associated git repository shall be included in all copies or substantial portions of the Software.

The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the software.

You can’t perform that action at this time.