*Typeset scattered graph data rewriter based on LaTeX nodes*

For now, this project is a prototype concept for maintaining a body of research and citations via a computational graph database.
The `VerTeX`

typeset scattered graph data rewriter is based on a new graph data format called VerTeX, which parses and generates LaTeX documents from nodes.
Current specifications are concerned with how to construct new documents from theorems and definitions using graph data.
This enables research collaborators to maintain databases of LaTeX nodes. The `VerTeX`

julia package automatically parses this database of LaTeX nodes to extract citations and references.
This system can also generate graph diagrams depicting the inter-relationships and dependencies of definitions, theorems, calculations, references, and results.

For convenience, the `vtx>`

REPL can be used by pressing the `,`

key with commands such as `help,vim,pdf,status,dictionary,ranger,preview,search,cd,cdpkg`

.
The REPL code was adapted and modifed from the REPL code of Pkg.jl using their MIT Julia license.

The general API is functional out of the box. To use some of the additional terminal user interface features from the REPL, the following unix-like programs are required:

- vim for editing nodes as LaTeX documents
- vimtex plugin for
`vim`

for compiling and preview - latexmk for compiling LaTeX to PDF formats
- zathura for viewing PDF output
- ranger for browsing directories

See some of chakravala's dot files for examples of `startup.jl`

, `.vimrc`

, `.latexmkrc`

, `zathurarc`

.

The format is not specific to any kind of file extension or way of saving, as the format is defined only by what data is saved.
Therefore, `VerTeX`

data can be saved in any type of serializtion format the database maintainer wants to choose.

To start with, the TOML format has been implemented.

An example `TOML`

file generated by `VerTeX`

is

```
author = "example"
pre = "%vtx:~/.julia/v0.7/JuliaTeX/vtx/default.tex"
revised = "2018-03-06T20:00:25.559"
uuid = "e87e02c0-2178-11e8-1787-d7c816143f3c"
created = "2018-03-06T19:59:41.514"
title = "testing"
editor = "Person Nameson"
date = "2018"
version = ["VerTeX", "v\"0.1.0\""]
tex = "hello world"
```

These are the main fields for any VerTeX data file:

**pre**is the LaTeX document preamble data (what packages to load, etc)**title**is the title of the VerTeX file and also the`\title{}`

field from latex doc**author**is the creator of the content (simultaneously it is`\author{}`

field of latex doc)**date**is the latex doc`\date{}`

field**tex**is the main body of the LaTeX content for the VerTeX file**uuid**is a unique identifier (not necessarily cryptographically secure, but it can be)**created**is the date of creation of the uuid**revised**is the last editing date and time UTC**editor**is the person who was editing the VerTeX file**version**is the VerTeX version data**depot**is the repository name

There are more data fields envisioned which are not implemented in the protype yet.

The data from this example TOML file results in the following LaTeX document when combined:

```
\documentclass[]{article}
\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{7.77pt}
\usepackage{varwidth}
\AtBeginDocument{\begin{preview}\begin{varwidth}{\linewidth}}
\AtEndDocument{\end{varwidth}\end{preview}}
%vtx:~/.julia/v0.7/JuliaTeX/vtx/default.tex
\title{testing}
\author{example}
\date{2018}
\begin{document}
hello world
\end{document}
```

The program automatically handles the conversion from TOML to LaTeX and vice versa.

Suppose you have some mathematical data (e.g. a theorem, an example, or a proof) and you wish to categorize it in a database. Then the LaTeX form of the data can be converted and stored away in the TOML data format. Thus it becomes possible to retrieve the database file; automatically convert it into a LaTeX document with all the headers; then edit it as a LaTeX document in an editor; and finally store the update in the TOML data format automatically when the editor is closed. Hence, edits are automatically made available for search and other features.

There is more relational meta-data that can be extracted, which will be investigated.
Specifically, it is possible to automatically extract relational edge data (as well as automatically erase it properly if necessary).
It works as follows:
In a local directory somewhere, suppose I have a `vtx`

file stored that holds some `key => value`

data, which can be loaded using the VerTeX program.

```
julia> using VerTeX
julia> f = VerTeX.load("testdir/pnt.vtx")
Dict{String,Any} with 14 entries:
"label" => ["PNT"]
"pre" => "%vtx:~/.julia/v0.7/VerTeX/vtx/default.tex"
"depot" => "julia"
"author" => "Gauss"
"created" => "2018-03-08T20:04:13.151"
"editor" => "Person Nameson"
"version" => ["VerTeX", "v\"0.1.0\""]
"tex" => "\$\$ \\lim_{x\\rightarrow +\\infty} \\frac{\\pi(x)}{\\int_2^x\\frac{du}{\\log(…
"ids" => Dict{String,Any}()
"date" => "unknown"
"revised" => "2018-03-09T15:12:09.635"
"uuid" => "df3c6ade-230b-11e8-09d3-1b9aec48cc35"
"title" => "Prime Number Theorem"
"dir" => "test/pnt.vtx"
```

In this case, it is a statement of the Prime Number Theorem by Gauss (simple example).

The vertex data was generated after editing the information with `vtx> vim test/pnt.vtx`

as a regular LaTeX document:

```
\documentclass[]{article}
% hidden preamble stuff not worth showing
\newcommand{\deps}[1]{} % VerTeX dependencies
%vtx:~/.julia/v0.7/VerTeX/vtx/default.tex
\author{Gauss}
\title{Prime Number Theorem}
\begin{document}
$$ \lim_{x\rightarrow +\infty} \frac{\pi(x)}{\int_2^x\frac{du}{\log(u)}} = 1 $$
This is the PNT\label{PNT}.
\end{document}
```

This `.tex`

file is converted by VerTeX into the above `key => value`

format, and vice versa, so making changes to the graph database is done by simply editing the `.tex`

files as if it were a regular LaTeX document (with background scripts).

Now if you save another VerTeX which references the prime number theorem using `\ref{PNT}`

then the VerTeX system will automatically update both the new VerTeX and also the other VerTeX file containing the referred to prime number theorem with a UUID to mark the reference.

```
julia> VerTeX.save(ans)
┌ Info: saving VerTeX: Prime Number Theorem
└ testdir/pnt.vtx saved in julia
┌ Info: saving VerTeX: a note on pnt
│ updated \ref{PNT}
│ at testdir/pnt.vtx in julia
└ testdir/note.vtx saved in julia
```

Note that an additional VerTeX at `testdir/note.vtx`

is updated to track the reference.

This means that theorems and definitions can be tagged with `\label{}`

and `\ref{}`

to maintain the connections between the VerTeX files automatically.
All one has to do is edit the LaTeX files, save them as VerTeX, and once all is saved all of the VerTeX data already contains all of the graph edges, ready to be used for analysis.
This is going to make mapping out mathematical theories into graphs superbly easy and useful!
In order to extend it to a conversation / email system, all one needs to do is add a list of receivers / recipients to a VerTeX, and it is now a letter between authors.