Copied the documentation from the pull request into the tex file.

Also added an abstract, convered the syntax to latex and added references.