diff --git a/README.md b/README.md
index 9e2752426c0b50099caed0974f0ae3934d49c7d5..e8e0a4517cfc19a424d5da403b61270105551069 100644
--- a/README.md
+++ b/README.md
@@ -94,7 +94,65 @@ Hello World"
 ```
 All these files can be directly imported into `LaTeX` using e.g. `minted`: You never need to mix `LaTeX` code and python again!
 
+
+## References: 
+Bibliography references can be loaded from `references.bib`-files and in-document references from the `.aux` file. 
+For this example, we will insert references shown in the `examples/latex/index.tex`-document. To do so, we can use these tags:
+```python
+def myfun(): #!s
+    """
+    To solve this exercise, look at \ref{eq1} in \ref{sec1}.
+    You can also look at \cite{bertsekasII} and \cite{herlau}
+    More specifically, look at \cite[Equation 117]{bertsekasII} and \cite[\ref{fig1}]{herlau}
+
+    We can also write a special tag to reduce repetition: \nref{fig1} and \nref{sec1}.
+    """
+    return 42 #!s
+
+```
+We can manually compile this example by first loading the aux-files and the bibliographies as follows:
+```python 
+# load_references.py
+    from snipper.citations import get_bibtex, get_aux 
+    bibfile = "latex/library.bib"
+    auxfile = 'latex/index.aux'
+    bibtex = get_bibtex(bibfile)
+    aux = get_aux(auxfile) 
+```
+Next, we load the python file containing the reference code and fix all references based on the aux and bibliography data. 
+```python 
+# load_references.py
+    file = "citations.py" 
+    with open(file, 'r') as f:
+        lines = f.read().splitlines()
+    lines = fix_aux(lines, aux=aux)
+    lines = fix_aux_special(lines, aux=aux, command='\\nref', bibref='herlau')
+    lines = fix_bibtex(lines, bibtex=bibtex)
+    with open('output/citations.py', 'w') as f:
+        f.write("\n".join(lines)) 
+```
+The middle command is a convenience feature: It allows us to specify a special citation command `\nref{..}` which always compiles to `\cite[\ref{...}]{herlau}`. This is useful if e.g. `herlau` is the bibtex key for your lecture notes. The result is as follows:
+```python 
+"""
+{{copyright}}
+
+References:
+  [Ber07] Dimitri P. Bertsekas. Dynamic Programming and Optimal Control, Vol. II. Athena Scientific, 3rd edition, 2007. ISBN 1886529302.
+
+  [Her21] Tue Herlau. Sequential decision making. (See 02465_Notes.pdf), 2021.
+
+"""
+def myfun(): #!s
+    """
+    To solve this exercise, look at eq. (1) in Section 1.
+    You can also look at (Ber07) and (Her21)
+    More specifically, look at (Ber07, Equation 117) and (Her21, Figure 1)
+
+    We can also write a special tag to reduce repetition: (Her21, Figure 1) and (Her21, Section 1).
+    """
+    return 42 #!s
+```
+Note this example uses the low-level api. Normally you would just pass the bibtex and aux-file to the main censor-file command.
+
 ## Additional features:
-- Include references using `\cite` and `\ref`: This works by parsing your `LaTeX` `.aux` files and automatically keep your 
-references in code synchronized with your written material. See the 02465 students repository for examples: None of the references to the exercise material or lecture notes are hard-coded!
--  You can name tags using `#!s=bar` to get a `foo_bar.py` snippet. This is useful when you need to cut multiple sessions. This also works for the other tags. 
+-  You can name tags using `#!s=bar` to get a `foo_bar.py` snippet. This is useful when you need to cut multiple sessions. This also works for the other tags. 
\ No newline at end of file
diff --git a/docs/README.jinja.md b/docs/README.jinja.md
new file mode 100644
index 0000000000000000000000000000000000000000..add4775f6a54e5c05c09e6fa5b63c3b9a956a627
--- /dev/null
+++ b/docs/README.jinja.md
@@ -0,0 +1,119 @@
+# Snipper
+A lightweight framework for removing code from student solutions.
+## Installation
+```console
+pip install codesnipper
+```
+## What it does
+This project address the following three challenges for administering a python-based course
+
+ - You need to maintain a (working) version for debugging as well as a version handed out to students (with code missing)
+ - You ideally want to make references in source code to course material *"(see equation 2.1 in exercise 5)"* but these tend to go out of date
+ - You want to include code snippets and code output in lectures notes/exercises/beamer slides
+ - You want to automatically create student solutions
+
+This framework address these problems and allow you to maintain a **single**, working project repository. 
+
+The project is currently used in **02465** at DTU. An example of student code can be found at:
+ - https://gitlab.gbar.dtu.dk/02465material/02465students/blob/master/irlc/ex02/dp.py
+
+A set of lectures notes where all code examples/output are automatically generated from the working repository can be found a
+- https://lab.compute.dtu.dk/tuhe/books (see **Sequential decision making**)
+ 
+## How it works
+The basic functionality is quite simple. You start with your working script in your private repository and add special tags to the script. 
+In this case I have added the tags `#!b` (cut a block) and `#!f` (cut function scope). 
+```python
+def myfun(): #!f The error I am going to raise
+    """ The function docstring will not be removed"""
+    print("This is a function")
+    return 42
+    
+def a_long_function():
+    a = 234
+    print("a line")
+    print("a line") #!b
+    print("a line")
+    print("a line") #!b Insert three missing print statements. 
+    print("a line")
+    return a
+    
+if __name__ == "__main__":
+    myfun()
+```
+This will produce the following file:
+```python
+def myfun():
+    """ The function docstring will not be removed"""
+    # TODO: 2 lines missing.
+    raise NotImplementedError("The error I am going to raise")
+    
+def a_long_function():
+    a = 234
+    print("a line")
+    # TODO: 3 lines missing.
+    raise NotImplementedError("Insert three missing print statements.")
+    print("a line")
+    return a
+    
+if __name__ == "__main__":
+    myfun()
+```
+You can also use the framework to capture code snippets, outputs and interactive python output. 
+To do this, save the following in `foo.py`
+```python
+def myfun(): #!s This snippet will be saved to foo.py in the output directory. 
+    print("Hello") #!s 
+
+print("Do not capture me") 
+for i in range(4): #!o
+    print("Output", i)
+print("Goodbuy world") #!o
+print("don't capture me")
+
+# Interactive pythong example
+print("Hello World") #!i #!i # this is a single-line cutout.
+````
+These block-tags will create a file `foo.py` (in the output directory) containing
+```python
+def myfun():
+    print("Hello") 
+```
+A file `foo.txt` containing the captured output
+```txt
+Output 0
+Output 1
+Output 2
+Output 3
+Goodbuy world
+```
+and a typeset version of an interactive python session in `foo.pyi` (use `pycon` in minted; this gitlab server appears not to support `pycon`)
+```pycon
+>>> print("hello world")
+Hello World"
+```
+All these files can be directly imported into `LaTeX` using e.g. `minted`: You never need to mix `LaTeX` code and python again!
+
+
+## References: 
+Bibliography references can be loaded from `references.bib`-files and in-document references from the `.aux` file. 
+For this example, we will insert references shown in the `examples/latex/index.tex`-document. To do so, we can use these tags:
+```python
+{{ citations_orig_py }}
+```
+We can manually compile this example by first loading the aux-files and the bibliographies as follows:
+```python 
+{{ load_references_a_py }}
+```
+Next, we load the python file containing the reference code and fix all references based on the aux and bibliography data. 
+```python 
+{{ load_references_b_py }}
+```
+The middle command is a convenience feature: It allows us to specify a special citation command `\nref{..}` which always compiles to `\cite[\ref{...}]{herlau}`. This is useful if e.g. `herlau` is the bibtex key for your lecture notes. The result is as follows:
+```python 
+{{ citations_py }}
+```
+Note this example uses the low-level api. Normally you would just pass the bibtex and aux-file to the main censor-file command.
+
+## Additional features:
+-  You can name tags using `#!s=bar` to get a `foo_bar.py` snippet. This is useful when you need to cut multiple sessions. This also works for the other tags. 
diff --git a/docs/build_docs.py b/docs/build_docs.py
new file mode 100644
index 0000000000000000000000000000000000000000..02f77913273a5c32c9672b84bfd54b06cdb79912
--- /dev/null
+++ b/docs/build_docs.py
@@ -0,0 +1,67 @@
+import slider.convert
+from slider.beamer_nup import beamer_nup
+import jinja2
+from slider import convert
+import os
+import shutil
+from slider.slider_cli import slider_cli
+# from example.load_references import reference_example
+# reference_example()
+
+def my_nup(path):
+    dir = os.path.dirname(path)
+    base = os.path.basename(dir)
+
+    out = beamer_nup(path, output="./" + base + "_nup.pdf", nup=2)
+    out_png = convert.pdf2png(out, scale_to=600)
+    print(out_png)
+
+if __name__ == "__main__":
+    from snipper.fix_s import save_s
+    from snipper.snipper_main import censor_file
+
+
+    #
+    # EX_BASE = "../examples"
+    # np = EX_BASE + "/new_project"
+
+    # if os.path.isdir(np):
+    #     shutil.rmtree(np)
+    # os.makedirs(np)
+    # slider_cli(latexfile=f"{np}/index.tex", force=True)
+    # np_basic1 = EX_BASE + "/basic1"
+    # if os.path.isdir(np_basic1):
+    #     shutil.rmtree(np_basic1)
+    # shutil.copytree(np, np_basic1)
+    # shutil.copyfile("myoverlay.svg", np_basic1 +"/osvgs/myoverlay.svg")
+    # slider_cli(latexfile=f"{np_basic1}/index.tex")
+    #
+    #
+    # my_nup(np + "/index.pdf")
+    # my_nup(f"{np_basic1}/index.pdf")
+    #
+    # # convert.pdf2png(np + "/index.pdf", "./index0.png")
+    # output = np +"/index_2up.pdf"
+    #
+    # data = {}
+    # data['resources'] = 'https://gitlab.compute.dtu.dk/tuhe/slider/-/raw/main'
+    # with open(np + "/index.tex", 'r') as f:
+    #     data['basic0_tex'] = f.read()
+
+    data = {}
+    # Build the docs.
+    import glob
+    with open("../example/citations.py", 'r') as f:
+        data['citations_orig_py'] = f.read()
+    for file in glob.glob("../example/output/*.*"):
+        with open(file, 'r') as f:
+            data[os.path.basename(file).replace(".", "_")] = f.read()
+
+    with open("README.jinja.md", 'r') as f:
+        s = jinja2.Environment(loader=jinja2.FileSystemLoader([".", "../example"])).from_string(f.read()).render(data)
+    with open("../README.md",'w') as f:
+        f.write(s)
+
+
+
+    pass
\ No newline at end of file
diff --git a/example/__pycache__/load_references.cpython-38.pyc b/example/__pycache__/load_references.cpython-38.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8a3151612384c0983e6ff0b8e92b6f5675e27a62
Binary files /dev/null and b/example/__pycache__/load_references.cpython-38.pyc differ
diff --git a/example/citations.py b/example/citations.py
new file mode 100644
index 0000000000000000000000000000000000000000..1bb8ac232a80fef6b3cd142cab7f6e3a8db731b2
--- /dev/null
+++ b/example/citations.py
@@ -0,0 +1,9 @@
+def myfun(): #!s
+    """
+    To solve this exercise, look at \ref{eq1} in \ref{sec1}.
+    You can also look at \cite{bertsekasII} and \cite{herlau}
+    More specifically, look at \cite[Equation 117]{bertsekasII} and \cite[\ref{fig1}]{herlau}
+
+    We can also write a special tag to reduce repetition: \nref{fig1} and \nref{sec1}.
+    """
+    return 42 #!s
diff --git a/example/exercise1.py b/example/exercise1.py
new file mode 100644
index 0000000000000000000000000000000000000000..e39a5df60fbaf76f7b495a4e13e91ac487a30d22
--- /dev/null
+++ b/example/exercise1.py
@@ -0,0 +1,23 @@
+def mysum(a,b): #!f Implement the sum-function here #!s=b
+    """
+    Return the sum of a and b
+    """
+    return a+b #!s=b
+#!s=a
+def print_information(s):
+    print("s is", s) #!b
+    print("s printed twice", s, s) #!b Print s once and twice.
+    print("s printed three times", s, s, s)
+#!s=a
+# Let's both capture output and also typeset it is an interactive python session.
+print("Hello world") #!i
+for j in range(3): #!o
+    print(f"{j=}")  #!o
+print("Goodbuuy world") #!i
+# Cut a single line and put it in the 'b' snippet.
+3 * 45 #!s=b #!s=b
+
+if __name__ == "__main__":
+    mysum(2,2)
+    print_information("Cat")
+
diff --git a/example/latex/br.pdf b/example/latex/br.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..d512f261a3f5c936a6745207be0b7f6d9b12aba7
Binary files /dev/null and b/example/latex/br.pdf differ
diff --git a/example/latex/index.aux b/example/latex/index.aux
new file mode 100644
index 0000000000000000000000000000000000000000..78d12690201fb79f0237155dd3d43a7daefea8b1
--- /dev/null
+++ b/example/latex/index.aux
@@ -0,0 +1,38 @@
+\relax 
+\providecommand\hyper@newdestlabel[2]{}
+\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
+\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
+\global\let\oldcontentsline\contentsline
+\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
+\global\let\oldnewlabel\newlabel
+\gdef\newlabel#1#2{\newlabelxx{#1}#2}
+\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
+\AtEndDocument{\ifx\hyper@anchor\@undefined
+\let\contentsline\oldcontentsline
+\let\newlabel\oldnewlabel
+\fi}
+\fi}
+\global\let\hyper@last\relax 
+\gdef\HyperFirstAtBeginDocument#1{#1}
+\providecommand\HyField@AuxAddToFields[1]{}
+\providecommand\HyField@AuxAddToCoFields[2]{}
+\providecommand\babel@aux[2]{}
+\@nameuse{bbl@beforestart}
+\citation{bertsekasII}
+\citation{rosolia2018data}
+\citation{herlau}
+\bibstyle{alpha}
+\bibdata{library}
+\bibcite{bertsekasII}{Ber07}
+\bibcite{herlau}{Her21}
+\bibcite{rosolia2018data}{RZB18}
+\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces A figure}}{1}{figure.1}\protected@file@percent }
+\newlabel{fig1}{{1}{1}{A figure}{figure.1}{}}
+\newlabel{fig1@cref}{{[figure][1][]1}{[1][1][]1}}
+\babel@aux{english}{}
+\@writefile{toc}{\contentsline {section}{\numberline {1}First section}{1}{section.1}\protected@file@percent }
+\newlabel{sec1}{{1}{1}{First section}{section.1}{}}
+\newlabel{sec1@cref}{{[section][1][]1}{[1][1][]1}}
+\newlabel{eq1}{{1}{1}{First section}{equation.1.1}{}}
+\newlabel{eq1@cref}{{[equation][1][]1}{[1][1][]1}}
+\gdef \@abspage@last{1}
diff --git a/example/latex/index.bbl b/example/latex/index.bbl
new file mode 100644
index 0000000000000000000000000000000000000000..d70f86dbbaea6007ed435027e0aa0be05c0a19df
--- /dev/null
+++ b/example/latex/index.bbl
@@ -0,0 +1,19 @@
+\begin{thebibliography}{RZB18}
+
+\bibitem[Ber07]{bertsekasII}
+Dimitri~P. Bertsekas.
+\newblock {\em Dynamic Programming and Optimal Control, Vol. II}.
+\newblock Athena Scientific, 3rd edition, 2007.
+
+\bibitem[Her21]{herlau}
+Tue Herlau.
+\newblock Sequential decision making.
+\newblock (See \textbf{02465\_Notes.pdf}), 2021.
+
+\bibitem[RZB18]{rosolia2018data}
+Ugo Rosolia, Xiaojing Zhang, and Francesco Borrelli.
+\newblock Data-driven predictive control for autonomous systems.
+\newblock {\em Annual Review of Control, Robotics, and Autonomous Systems},
+  1:259--286, 2018.
+
+\end{thebibliography}
diff --git a/example/latex/index.blg b/example/latex/index.blg
new file mode 100644
index 0000000000000000000000000000000000000000..21b520160989682e0f90383e9fd3a7a7be289765
--- /dev/null
+++ b/example/latex/index.blg
@@ -0,0 +1,48 @@
+This is BibTeX, Version 0.99d
+Capacity: max_strings=200000, hash_size=200000, hash_prime=170003
+The top-level auxiliary file: index.aux
+Reallocating 'name_of_file' (item size: 1) to 6 items.
+The style file: alpha.bst
+Reallocating 'name_of_file' (item size: 1) to 8 items.
+Database file #1: library.bib
+You've used 3 entries,
+            2543 wiz_defined-function locations,
+            577 strings with 4836 characters,
+and the built_in function-call counts, 984 in all, are:
+= -- 97
+> -- 41
+< -- 2
++ -- 13
+- -- 13
+* -- 64
+:= -- 178
+add.period$ -- 9
+call.type$ -- 3
+change.case$ -- 17
+chr.to.int$ -- 3
+cite$ -- 3
+duplicate$ -- 40
+empty$ -- 69
+format.name$ -- 18
+if$ -- 191
+int.to.chr$ -- 1
+int.to.str$ -- 0
+missing$ -- 3
+newline$ -- 18
+num.names$ -- 9
+pop$ -- 14
+preamble$ -- 1
+purify$ -- 20
+quote$ -- 0
+skip$ -- 32
+stack$ -- 0
+substring$ -- 46
+swap$ -- 2
+text.length$ -- 2
+text.prefix$ -- 2
+top$ -- 0
+type$ -- 20
+warning$ -- 0
+while$ -- 9
+width$ -- 4
+write$ -- 40
diff --git a/example/latex/index.log b/example/latex/index.log
new file mode 100644
index 0000000000000000000000000000000000000000..a35abea4de70233cf55026b89d5e69b26cda2175
--- /dev/null
+++ b/example/latex/index.log
@@ -0,0 +1,1000 @@
+This is pdfTeX, Version 3.141592653-2.6-1.40.23 (MiKTeX 21.8) (preloaded format=pdflatex 2021.9.3)  4 SEP 2021 21:25
+entering extended mode
+**./index.tex
+(index.tex
+LaTeX2e <2021-06-01> patch level 1
+L3 programming layer <2021-08-27>
+(C:\Program Files\MiKTeX\tex/latex/base\article.cls
+Document Class: article 2021/02/12 v1.4n Standard LaTeX document class
+(C:\Program Files\MiKTeX\tex/latex/base\size12.clo
+File: size12.clo 2021/02/12 v1.4n Standard LaTeX file (size option)
+)
+\c@part=\count182
+\c@section=\count183
+\c@subsection=\count184
+\c@subsubsection=\count185
+\c@paragraph=\count186
+\c@subparagraph=\count187
+\c@figure=\count188
+\c@table=\count189
+\abovecaptionskip=\skip47
+\belowcaptionskip=\skip48
+\bibindent=\dimen138
+)
+(C:\Program Files\MiKTeX\tex/latex/xcolor\xcolor.sty
+Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)
+
+(C:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg
+File: color.cfg 2016/01/02 v1.6 sample color configuration
+)
+Package xcolor Info: Driver file: pdftex.def on input line 225.
+
+(C:\Program Files\MiKTeX\tex/latex/graphics-def\pdftex.def
+File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/colortbl\colortbl.sty
+Package: colortbl 2020/01/04 v1.0e Color table columns (DPC)
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/tools\array.sty
+Package: array 2021/04/20 v2.5e Tabular extension package (FMi)
+\col@sep=\dimen139
+\ar@mcellbox=\box50
+\extrarowheight=\dimen140
+\NC@list=\toks16
+\extratabsurround=\skip49
+\backup@length=\skip50
+\ar@cellbox=\box51
+)
+\everycr=\toks17
+\minrowclearance=\skip51
+)
+\rownum=\count190
+Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348.
+Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352.
+Package xcolor Info: Model `RGB' extended on input line 1364.
+Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
+Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
+Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
+Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
+Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
+Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
+)
+(C:\Program Files\MiKTeX\tex/latex/url\url.sty
+\Urlmuskip=\muskip16
+Package: url 2013/09/16  ver 3.4  Verb mode for urls, etc.
+)
+(C:\Program Files\MiKTeX\tex/latex/graphics\graphics.sty
+Package: graphics 2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR)
+
+(C:\Program Files\MiKTeX\tex/latex/graphics\trig.sty
+Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
+)
+(C:\Program Files\MiKTeX\tex/latex/graphics-cfg\graphics.cfg
+File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
+)
+Package graphics Info: Driver file: pdftex.def on input line 107.
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/tools\multicol.sty
+Package: multicol 2019/12/09 v1.8y multicolumn formatting (FMi)
+\c@tracingmulticols=\count191
+\mult@box=\box52
+\multicol@leftmargin=\dimen141
+\c@unbalance=\count192
+\c@collectmore=\count193
+\doublecol@number=\count194
+\multicoltolerance=\count195
+\multicolpretolerance=\count196
+\full@width=\dimen142
+\page@free=\dimen143
+\premulticols=\dimen144
+\postmulticols=\dimen145
+\multicolsep=\skip52
+\multicolbaselineskip=\skip53
+\partial@page=\box53
+\last@line=\box54
+\maxbalancingoverflow=\dimen146
+\mult@rightbox=\box55
+\mult@grightbox=\box56
+\mult@gfirstbox=\box57
+\mult@firstbox=\box58
+\@tempa=\box59
+\@tempa=\box60
+\@tempa=\box61
+\@tempa=\box62
+\@tempa=\box63
+\@tempa=\box64
+\@tempa=\box65
+\@tempa=\box66
+\@tempa=\box67
+\@tempa=\box68
+\@tempa=\box69
+\@tempa=\box70
+\@tempa=\box71
+\@tempa=\box72
+\@tempa=\box73
+\@tempa=\box74
+\@tempa=\box75
+\@tempa=\box76
+\@tempa=\box77
+\@tempa=\box78
+\@tempa=\box79
+\@tempa=\box80
+\@tempa=\box81
+\@tempa=\box82
+\@tempa=\box83
+\@tempa=\box84
+\@tempa=\box85
+\@tempa=\box86
+\@tempa=\box87
+\@tempa=\box88
+\@tempa=\box89
+\@tempa=\box90
+\@tempa=\box91
+\@tempa=\box92
+\@tempa=\box93
+\@tempa=\box94
+\@tempa=\box95
+\c@minrows=\count197
+\c@columnbadness=\count198
+\c@finalcolumnbadness=\count199
+\last@try=\dimen147
+\multicolovershoot=\dimen148
+\multicolundershoot=\dimen149
+\mult@nat@firstbox=\box96
+\colbreak@box=\box97
+\mc@col@check@num=\count266
+)
+(C:\Program Files\MiKTeX\tex/generic/dvips\rotate.sty
+\@rotdimen=\dimen150
+\@rotbox=\box98
+)
+(C:\Program Files\MiKTeX\tex/latex/graphics\rotating.sty
+Package: rotating 2016/08/11 v2.16d rotated objects in LaTeX
+
+(C:\Program Files\MiKTeX\tex/latex/graphics\graphicx.sty
+Package: graphicx 2020/12/05 v1.2c Enhanced LaTeX Graphics (DPC,SPQR)
+
+(C:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty
+Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
+\KV@toks@=\toks18
+)
+\Gin@req@height=\dimen151
+\Gin@req@width=\dimen152
+)
+(C:\Program Files\MiKTeX\tex/latex/base\ifthen.sty
+Package: ifthen 2020/11/24 v1.1c Standard LaTeX ifthen package (DPC)
+)
+\c@r@tfl@t=\count267
+\rotFPtop=\skip54
+\rotFPbot=\skip55
+\rot@float@box=\box99
+\rot@mess@toks=\toks19
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/booktabs\booktabs.sty
+Package: booktabs 2020/01/12 v1.61803398 Publication quality tables
+\heavyrulewidth=\dimen153
+\lightrulewidth=\dimen154
+\cmidrulewidth=\dimen155
+\belowrulesep=\dimen156
+\belowbottomsep=\dimen157
+\aboverulesep=\dimen158
+\abovetopsep=\dimen159
+\cmidrulesep=\dimen160
+\cmidrulekern=\dimen161
+\defaultaddspace=\dimen162
+\@cmidla=\count268
+\@cmidlb=\count269
+\@aboverulesep=\dimen163
+\@belowrulesep=\dimen164
+\@thisruleclass=\count270
+\@lastruleclass=\count271
+\@thisrulewidth=\dimen165
+)
+(C:\Program Files\MiKTeX\tex/latex/hyperref\hyperref.sty
+Package: hyperref 2021-06-07 v7.00m Hypertext links for LaTeX
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/ltxcmds\ltxcmds.sty
+Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
+)
+(C:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty
+Package: iftex 2020/03/06 v1.0d TeX engine tests
+)
+(C:\Program Files\MiKTeX\tex/generic/pdftexcmds\pdftexcmds.sty
+Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
+)
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/infwarerr\infwarerr.sty
+Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
+)
+Package pdftexcmds Info: \pdf@primitive is available.
+Package pdftexcmds Info: \pdf@ifprimitive is available.
+Package pdftexcmds Info: \pdfdraftmode found.
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/kvsetkeys\kvsetkeys.sty
+Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/kvdefinekeys\kvdefinekeys.sty
+Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO)
+) (C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/pdfescape\pdfescape.sty
+Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/hycolor\hycolor.sty
+Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/letltxmacro\letltxmacro.sty
+Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/auxhook\auxhook.sty
+Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/kvoptions\kvoptions.sty
+Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO)
+)
+\@linkdim=\dimen166
+\Hy@linkcounter=\count272
+\Hy@pagecounter=\count273
+
+(C:\Program Files\MiKTeX\tex/latex/hyperref\pd1enc.def
+File: pd1enc.def 2021-06-07 v7.00m Hyperref: PDFDocEncoding definition (HO)
+Now handling font encoding PD1 ...
+... no UTF-8 mapping file for font encoding PD1
+)
+(C:\Program Files\MiKTeX\tex/latex/hyperref\hyperref-langpatches.def
+File: hyperref-langpatches.def 2021-06-07 v7.00m Hyperref: patches for babel la
+nguages
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/intcalc\intcalc.sty
+Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/etexcmds\etexcmds.sty
+Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
+)
+\Hy@SavedSpaceFactor=\count274
+
+(C:\Program Files\MiKTeX\tex/latex/hyperref\puenc.def
+File: puenc.def 2021-06-07 v7.00m Hyperref: PDF Unicode definition (HO)
+Now handling font encoding PU ...
+... no UTF-8 mapping file for font encoding PU
+)
+Package hyperref Info: Hyper figures OFF on input line 4192.
+Package hyperref Info: Link nesting OFF on input line 4197.
+Package hyperref Info: Hyper index ON on input line 4200.
+Package hyperref Info: Plain pages OFF on input line 4207.
+Package hyperref Info: Backreferencing OFF on input line 4212.
+Package hyperref Info: Implicit mode ON; LaTeX internals redefined.
+Package hyperref Info: Bookmarks ON on input line 4445.
+\c@Hy@tempcnt=\count275
+LaTeX Info: Redefining \url on input line 4804.
+\XeTeXLinkMargin=\dimen167
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/bitset\bitset.sty
+Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO)
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/bigintcalc\bigintcalc.sty
+Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO
+)
+))
+\Fld@menulength=\count276
+\Field@Width=\dimen168
+\Fld@charsize=\dimen169
+Package hyperref Info: Hyper figures OFF on input line 6076.
+Package hyperref Info: Link nesting OFF on input line 6081.
+Package hyperref Info: Hyper index ON on input line 6084.
+Package hyperref Info: backreferencing OFF on input line 6091.
+Package hyperref Info: Link coloring OFF on input line 6096.
+Package hyperref Info: Link coloring with OCG OFF on input line 6101.
+Package hyperref Info: PDF/A mode OFF on input line 6106.
+LaTeX Info: Redefining \ref on input line 6146.
+LaTeX Info: Redefining \pageref on input line 6150.
+
+(C:\Program Files\MiKTeX\tex/latex/base\atbegshi-ltx.sty
+Package: atbegshi-ltx 2021/01/10 v1.0c Emulation of the original atbegshi
+package with kernel methods
+)
+\Hy@abspage=\count277
+\c@Item=\count278
+\c@Hfootnote=\count279
+)
+Package hyperref Info: Driver (autodetected): hpdftex.
+
+(C:\Program Files\MiKTeX\tex/latex/hyperref\hpdftex.def
+File: hpdftex.def 2021-06-07 v7.00m Hyperref driver for pdfTeX
+
+(C:\Program Files\MiKTeX\tex/latex/base\atveryend-ltx.sty
+Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atvery packag
+e
+with kernel methods
+)
+\Fld@listcount=\count280
+\c@bookmark@seq@number=\count281
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/rerunfilecheck\rerunfilecheck.s
+ty
+Package: rerunfilecheck 2019/12/05 v1.9 Rerun checks for auxiliary files (HO)
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/uniquecounter\uniquecounter.s
+ty
+Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO)
+)
+Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
+86.
+)
+\Hy@SectionHShift=\skip56
+) (C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/psnfss\pifont.sty
+Package: pifont 2020/03/25 PSNFSS-v9.3 Pi font support (SPQR) 
+LaTeX Font Info:    Trying to load font information for U+pzd on input line 63.
+
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/psnfss\upzd.fd
+File: upzd.fd 2001/06/04 font definitions for U/pzd.
+)
+LaTeX Font Info:    Trying to load font information for U+psy on input line 64.
+
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/psnfss\upsy.fd
+File: upsy.fd 2001/06/04 font definitions for U/psy.
+))
+(C:\Program Files\MiKTeX\tex/latex/base\latexsym.sty
+Package: latexsym 1998/08/17 v2.2e Standard LaTeX package (lasy symbols)
+\symlasy=\mathgroup4
+LaTeX Font Info:    Overwriting symbol font `lasy' in version `bold'
+(Font)                  U/lasy/m/n --> U/lasy/b/n on input line 52.
+)
+(C:\Program Files\MiKTeX\tex/generic/babel\babel.sty
+Package: babel 2021/07/22 3.63 The Babel package
+
+(C:\Program Files\MiKTeX\tex/generic/babel\babel.def
+File: babel.def 2021/07/22 3.63 Babel common definitions
+\babel@savecnt=\count282
+\U@D=\dimen170
+\l@unhyphenated=\language79
+
+(C:\Program Files\MiKTeX\tex/generic/babel\txtbabel.def)
+\bbl@readstream=\read2
+)
+\bbl@dirlevel=\count283
+
+*************************************
+* Local config file bblopts.cfg used
+*
+(C:\Program Files\MiKTeX\tex/latex/arabi\bblopts.cfg
+File: bblopts.cfg 2005/09/08 v0.1 add Arabic and Farsi to "declared" options of
+ babel
+)
+(C:\Program Files\MiKTeX\tex/latex/babel-english\english.ldf
+Language: english 2017/06/06 v3.3r English support from the babel system
+Package babel Info: Hyphen rules for 'canadian' set to \l@english
+(babel)             (\language0). Reported on input line 102.
+Package babel Info: Hyphen rules for 'australian' set to \l@ukenglish
+(babel)             (\language73). Reported on input line 105.
+Package babel Info: Hyphen rules for 'newzealand' set to \l@ukenglish
+(babel)             (\language73). Reported on input line 108.
+))
+(C:\Program Files\MiKTeX\tex/latex/epstopdf-pkg\epstopdf.sty
+Package: epstopdf 2020-01-24 v2.11 Conversion with epstopdf on the fly (HO)
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/grfext\grfext.sty
+Package: grfext 2019/12/03 v1.3 Manage graphics extensions (HO)
+)
+(C:\Program Files\MiKTeX\tex/latex/epstopdf-pkg\epstopdf-base.sty
+Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
+Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
+85.
+Package grfext Info: Graphics extension search list:
+(grfext)             [.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPE
+G,.JBIG2,.JB2,.eps]
+(grfext)             \AppendGraphicsExtensions on input line 504.
+
+(C:\Program Files\MiKTeX\tex/latex/00miktex\epstopdf-sys.cfg
+File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
+)))
+(C:\Program Files\MiKTeX\tex/latex/etoolbox\etoolbox.sty
+Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
+\etb@tempcnta=\count284
+)
+(C:\Program Files\MiKTeX\tex/latex/amsmath\amsmath.sty
+Package: amsmath 2021/04/20 v2.17j AMS math features
+\@mathmargin=\skip57
+
+For additional information on amsmath, use the `?' option.
+(C:\Program Files\MiKTeX\tex/latex/amsmath\amstext.sty
+Package: amstext 2000/06/29 v2.01 AMS text
+
+(C:\Program Files\MiKTeX\tex/latex/amsmath\amsgen.sty
+File: amsgen.sty 1999/11/30 v2.0 generic functions
+\@emptytoks=\toks20
+\ex@=\dimen171
+))
+(C:\Program Files\MiKTeX\tex/latex/amsmath\amsbsy.sty
+Package: amsbsy 1999/11/29 v1.2d Bold Symbols
+\pmbraise@=\dimen172
+)
+(C:\Program Files\MiKTeX\tex/latex/amsmath\amsopn.sty
+Package: amsopn 2016/03/08 v2.02 operator names
+)
+\inf@bad=\count285
+LaTeX Info: Redefining \frac on input line 234.
+\uproot@=\count286
+\leftroot@=\count287
+LaTeX Info: Redefining \overline on input line 399.
+\classnum@=\count288
+\DOTSCASE@=\count289
+LaTeX Info: Redefining \ldots on input line 496.
+LaTeX Info: Redefining \dots on input line 499.
+LaTeX Info: Redefining \cdots on input line 620.
+\Mathstrutbox@=\box100
+\strutbox@=\box101
+\big@size=\dimen173
+LaTeX Font Info:    Redeclaring font encoding OML on input line 743.
+LaTeX Font Info:    Redeclaring font encoding OMS on input line 744.
+\macc@depth=\count290
+\c@MaxMatrixCols=\count291
+\dotsspace@=\muskip17
+\c@parentequation=\count292
+\dspbrk@lvl=\count293
+\tag@help=\toks21
+\row@=\count294
+\column@=\count295
+\maxfields@=\count296
+\andhelp@=\toks22
+\eqnshift@=\dimen174
+\alignsep@=\dimen175
+\tagshift@=\dimen176
+\tagwidth@=\dimen177
+\totwidth@=\dimen178
+\lineht@=\dimen179
+\@envbody=\toks23
+\multlinegap=\skip58
+\multlinetaggap=\skip59
+\mathdisplay@stack=\toks24
+LaTeX Info: Redefining \[ on input line 2923.
+LaTeX Info: Redefining \] on input line 2924.
+)
+(C:\Program Files\MiKTeX\tex/latex/amsfonts\amssymb.sty
+Package: amssymb 2013/01/14 v3.01 AMS font symbols
+
+(C:\Program Files\MiKTeX\tex/latex/amsfonts\amsfonts.sty
+Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
+\symAMSa=\mathgroup5
+\symAMSb=\mathgroup6
+LaTeX Font Info:    Redeclaring math symbol \hbar on input line 98.
+LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
+(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
+))
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/multirow\multirow.sty
+Package: multirow 2021/03/15 v2.8 Span multiple rows of a table
+\multirow@colwidth=\skip60
+\multirow@cntb=\count297
+\multirow@dima=\skip61
+\bigstrutjot=\dimen180
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/fancyhdr\fancyhdr.sty
+Package: fancyhdr 2021/01/28 v4.0.1 Extensive control of page headers and foote
+rs
+\f@nch@headwidth=\skip62
+\f@nch@O@elh=\skip63
+\f@nch@O@erh=\skip64
+\f@nch@O@olh=\skip65
+\f@nch@O@orh=\skip66
+\f@nch@O@elf=\skip67
+\f@nch@O@erf=\skip68
+\f@nch@O@olf=\skip69
+\f@nch@O@orf=\skip70
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/cleveref\cleveref.sty
+Package: cleveref 2018/03/27 v0.21.4 Intelligent cross-referencing
+Package cleveref Info: `hyperref' support loaded on input line 2370.
+LaTeX Info: Redefining \cref on input line 2370.
+LaTeX Info: Redefining \Cref on input line 2370.
+LaTeX Info: Redefining \crefrange on input line 2370.
+LaTeX Info: Redefining \Crefrange on input line 2370.
+LaTeX Info: Redefining \cpageref on input line 2370.
+LaTeX Info: Redefining \Cpageref on input line 2370.
+LaTeX Info: Redefining \cpagerefrange on input line 2370.
+LaTeX Info: Redefining \Cpagerefrange on input line 2370.
+LaTeX Info: Redefining \labelcref on input line 2370.
+LaTeX Info: Redefining \labelcpageref on input line 2370.
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/todonotes\todonotes.sty
+Package: todonotes 2021/06/04 v1.1.5 Todonotes source and documentation.
+Package: todonotes 2021/06/04
+
+(C:\Program Files\MiKTeX\tex/latex/xkeyval\xkeyval.sty
+Package: xkeyval 2020/11/20 v2.8 package option processing (HA)
+
+(C:\Program Files\MiKTeX\tex/generic/xkeyval\xkeyval.tex
+(C:\Program Files\MiKTeX\tex/generic/xkeyval\xkvutils.tex
+\XKV@toks=\toks25
+\XKV@tempa@toks=\toks26
+)
+\XKV@depth=\count298
+File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
+))
+(C:\Program Files\MiKTeX\tex/latex/pgf/frontendlayer\tikz.sty
+(C:\Program Files\MiKTeX\tex/latex/pgf/basiclayer\pgf.sty
+(C:\Program Files\MiKTeX\tex/latex/pgf/utilities\pgfrcs.sty
+(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-common.tex
+\pgfutil@everybye=\toks27
+\pgfutil@tempdima=\dimen181
+\pgfutil@tempdimb=\dimen182
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-common-lists.tex))
+(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-latex.def
+\pgfutil@abb=\box102
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfrcs.code.tex
+(C:\Program Files\MiKTeX\tex/generic/pgf\pgf.revision.tex)
+Package: pgfrcs 2021/05/15 v3.1.9a (3.1.9a)
+))
+Package: pgf 2021/05/15 v3.1.9a (3.1.9a)
+
+(C:\Program Files\MiKTeX\tex/latex/pgf/basiclayer\pgfcore.sty
+(C:\Program Files\MiKTeX\tex/latex/pgf/systemlayer\pgfsys.sty
+(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsys.code.tex
+Package: pgfsys 2021/05/15 v3.1.9a (3.1.9a)
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeys.code.tex
+\pgfkeys@pathtoks=\toks28
+\pgfkeys@temptoks=\toks29
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeysfiltered.code.tex
+\pgfkeys@tmptoks=\toks30
+))
+\pgf@x=\dimen183
+\pgf@y=\dimen184
+\pgf@xa=\dimen185
+\pgf@ya=\dimen186
+\pgf@xb=\dimen187
+\pgf@yb=\dimen188
+\pgf@xc=\dimen189
+\pgf@yc=\dimen190
+\pgf@xd=\dimen191
+\pgf@yd=\dimen192
+\w@pgf@writea=\write3
+\r@pgf@reada=\read3
+\c@pgf@counta=\count299
+\c@pgf@countb=\count300
+\c@pgf@countc=\count301
+\c@pgf@countd=\count302
+\t@pgf@toka=\toks31
+\t@pgf@tokb=\toks32
+\t@pgf@tokc=\toks33
+\pgf@sys@id@count=\count303
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgf.cfg
+File: pgf.cfg 2021/05/15 v3.1.9a (3.1.9a)
+)
+Driver file for pgf: pgfsys-pdftex.def
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsys-pdftex.def
+File: pgfsys-pdftex.def 2021/05/15 v3.1.9a (3.1.9a)
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsys-common-pdf.def
+File: pgfsys-common-pdf.def 2021/05/15 v3.1.9a (3.1.9a)
+)))
+(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsyssoftpath.code.tex
+File: pgfsyssoftpath.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgfsyssoftpath@smallbuffer@items=\count304
+\pgfsyssoftpath@bigbuffer@items=\count305
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsysprotocol.code.tex
+File: pgfsysprotocol.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+))
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcore.code.tex
+Package: pgfcore 2021/05/15 v3.1.9a (3.1.9a)
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathcalc.code.tex
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathutil.code.tex)
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathparser.code.tex
+\pgfmath@dimen=\dimen193
+\pgfmath@count=\count306
+\pgfmath@box=\box103
+\pgfmath@toks=\toks34
+\pgfmath@stack@operand=\toks35
+\pgfmath@stack@operation=\toks36
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.code.tex
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.basic.code.tex)
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.trigonometric.co
+de.tex)
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.random.code.tex)
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.comparison.code.
+tex)
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.base.code.tex)
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.round.code.tex)
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.misc.code.tex)
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.integerarithmeti
+cs.code.tex)))
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfloat.code.tex
+\c@pgfmathroundto@lastzeros=\count307
+))
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfint.code.tex)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepoints.code.tex
+File: pgfcorepoints.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgf@picminx=\dimen194
+\pgf@picmaxx=\dimen195
+\pgf@picminy=\dimen196
+\pgf@picmaxy=\dimen197
+\pgf@pathminx=\dimen198
+\pgf@pathmaxx=\dimen199
+\pgf@pathminy=\dimen256
+\pgf@pathmaxy=\dimen257
+\pgf@xx=\dimen258
+\pgf@xy=\dimen259
+\pgf@yx=\dimen260
+\pgf@yy=\dimen261
+\pgf@zx=\dimen262
+\pgf@zy=\dimen263
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathconstruct.code.t
+ex
+File: pgfcorepathconstruct.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgf@path@lastx=\dimen264
+\pgf@path@lasty=\dimen265
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathusage.code.tex
+File: pgfcorepathusage.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgf@shorten@end@additional=\dimen266
+\pgf@shorten@start@additional=\dimen267
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorescopes.code.tex
+File: pgfcorescopes.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgfpic=\box104
+\pgf@hbox=\box105
+\pgf@layerbox@main=\box106
+\pgf@picture@serial@count=\count308
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoregraphicstate.code.te
+x
+File: pgfcoregraphicstate.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgflinewidth=\dimen268
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoretransformations.code
+.tex
+File: pgfcoretransformations.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgf@pt@x=\dimen269
+\pgf@pt@y=\dimen270
+\pgf@pt@temp=\dimen271
+) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorequick.code.tex
+File: pgfcorequick.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreobjects.code.tex
+File: pgfcoreobjects.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathprocessing.code.
+tex
+File: pgfcorepathprocessing.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorearrows.code.tex
+File: pgfcorearrows.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgfarrowsep=\dimen272
+) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreshade.code.tex
+File: pgfcoreshade.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgf@max=\dimen273
+\pgf@sys@shading@range@num=\count309
+\pgf@shadingcount=\count310
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreimage.code.tex
+File: pgfcoreimage.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreexternal.code.tex
+File: pgfcoreexternal.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgfexternal@startupbox=\box107
+))
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorelayers.code.tex
+File: pgfcorelayers.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoretransparency.code.te
+x
+File: pgfcoretransparency.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepatterns.code.tex
+File: pgfcorepatterns.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorerdf.code.tex
+File: pgfcorerdf.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+)))
+(C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmoduleshapes.code.tex
+File: pgfmoduleshapes.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgfnodeparttextbox=\box108
+)
+(C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmoduleplot.code.tex
+File: pgfmoduleplot.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+)
+(C:\Program Files\MiKTeX\tex/latex/pgf/compatibility\pgfcomp-version-0-65.sty
+Package: pgfcomp-version-0-65 2021/05/15 v3.1.9a (3.1.9a)
+\pgf@nodesepstart=\dimen274
+\pgf@nodesepend=\dimen275
+)
+(C:\Program Files\MiKTeX\tex/latex/pgf/compatibility\pgfcomp-version-1-18.sty
+Package: pgfcomp-version-1-18 2021/05/15 v3.1.9a (3.1.9a)
+)) (C:\Program Files\MiKTeX\tex/latex/pgf/utilities\pgffor.sty
+(C:\Program Files\MiKTeX\tex/latex/pgf/utilities\pgfkeys.sty
+(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeys.code.tex))
+(C:\Program Files\MiKTeX\tex/latex/pgf/math\pgfmath.sty
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex))
+(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgffor.code.tex
+Package: pgffor 2021/05/15 v3.1.9a (3.1.9a)
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex)
+\pgffor@iter=\dimen276
+\pgffor@skip=\dimen277
+\pgffor@stack=\toks37
+\pgffor@toks=\toks38
+))
+(C:\Program Files\MiKTeX\tex/generic/pgf/frontendlayer/tikz\tikz.code.tex
+Package: tikz 2021/05/15 v3.1.9a (3.1.9a)
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/libraries\pgflibraryplothandlers.code.
+tex
+File: pgflibraryplothandlers.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgf@plot@mark@count=\count311
+\pgfplotmarksize=\dimen278
+)
+\tikz@lastx=\dimen279
+\tikz@lasty=\dimen280
+\tikz@lastxsaved=\dimen281
+\tikz@lastysaved=\dimen282
+\tikz@lastmovetox=\dimen283
+\tikz@lastmovetoy=\dimen284
+\tikzleveldistance=\dimen285
+\tikzsiblingdistance=\dimen286
+\tikz@figbox=\box109
+\tikz@figbox@bg=\box110
+\tikz@tempbox=\box111
+\tikz@tempbox@bg=\box112
+\tikztreelevel=\count312
+\tikznumberofchildren=\count313
+\tikznumberofcurrentchild=\count314
+\tikz@fig@count=\count315
+ (C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmodulematrix.code.tex
+File: pgfmodulematrix.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+\pgfmatrixcurrentrow=\count316
+\pgfmatrixcurrentcolumn=\count317
+\pgf@matrix@numberofcolumns=\count318
+)
+\tikz@expandcount=\count319
+
+(C:\Program Files\MiKTeX\tex/generic/pgf/frontendlayer/tikz/libraries\tikzlibra
+rytopaths.code.tex
+File: tikzlibrarytopaths.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+)))
+(C:\Program Files\MiKTeX\tex/generic/pgf/frontendlayer/tikz/libraries\tikzlibra
+rypositioning.code.tex
+File: tikzlibrarypositioning.code.tex 2021/05/15 v3.1.9a (3.1.9a)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/tools\calc.sty
+Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
+\calc@Acount=\count320
+\calc@Bcount=\count321
+\calc@Adimen=\dimen287
+\calc@Bdimen=\dimen288
+\calc@Askip=\skip71
+\calc@Bskip=\skip72
+LaTeX Info: Redefining \setlength on input line 80.
+LaTeX Info: Redefining \addtolength on input line 81.
+\calc@Ccount=\count322
+\calc@Cskip=\skip73
+)
+\c@@todonotes@numberoftodonotes=\count323
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/minted\minted.sty
+Package: minted 2017/07/19 v2.5 Yet another Pygments shim for LaTeX
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/fvextra\fvextra.sty
+Package: fvextra 2019/02/04 v1.4 fvextra - extensions and patches for fancyvrb
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/fancyvrb\fancyvrb.sty
+Package: fancyvrb 2021/08/12 v3.8 verbatim text (tvz,hv)
+\FV@CodeLineNo=\count324
+\FV@InFile=\read4
+\FV@TabBox=\box113
+\c@FancyVerbLine=\count325
+\FV@StepNumber=\count326
+\FV@OutFile=\write4
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/upquote\upquote.sty
+Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba
+tim
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/lineno\lineno.sty
+Package: lineno 2005/11/02 line numbers on paragraphs v4.41
+\linenopenalty=\count327
+\output=\toks39
+\linenoprevgraf=\count328
+\linenumbersep=\dimen289
+\linenumberwidth=\dimen290
+\c@linenumber=\count329
+\c@pagewiselinenumber=\count330
+\c@LN@truepage=\count331
+\c@internallinenumber=\count332
+\c@internallinenumbers=\count333
+\quotelinenumbersep=\dimen291
+\bframerule=\dimen292
+\bframesep=\dimen293
+\bframebox=\box114
+LaTeX Info: Redefining \\ on input line 3056.
+)
+\c@FV@TrueTabGroupLevel=\count334
+\c@FV@TrueTabCounter=\count335
+\FV@TabBox@Group=\box115
+\FV@TmpLength=\skip74
+\c@FV@HighlightLinesStart=\count336
+\c@FV@HighlightLinesStop=\count337
+\FV@LoopCount=\count338
+\FV@NCharsBox=\box116
+\FV@BreakIndent=\dimen294
+\FV@BreakIndentNChars=\count339
+\FV@BreakSymbolSepLeft=\dimen295
+\FV@BreakSymbolSepLeftNChars=\count340
+\FV@BreakSymbolSepRight=\dimen296
+\FV@BreakSymbolSepRightNChars=\count341
+\FV@BreakSymbolIndentLeft=\dimen297
+\FV@BreakSymbolIndentLeftNChars=\count342
+\FV@BreakSymbolIndentRight=\dimen298
+\FV@BreakSymbolIndentRightNChars=\count343
+\c@FancyVerbLineBreakLast=\count344
+\FV@LineBox=\box117
+\FV@LineIndentBox=\box118
+\FV@LineWidth=\dimen299
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/tools\shellesc.sty
+Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX
+Package shellesc Info: Unrestricted shell escape enabled on input line 75.
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/ifplatform\ifplatform.sty
+Package: ifplatform 2017/10/13 v0.4a Testing for the operating system
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/catchfile\catchfile.sty
+Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO)
+)
+(C:\Program Files\MiKTeX\tex/generic/iftex\ifluatex.sty
+Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
+))
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/xstring\xstring.sty
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/xstring\xstring.tex
+\integerpart=\count345
+\decimalpart=\count346
+)
+Package: xstring 2021/07/21 v1.84 String manipulations (CT)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/framed\framed.sty
+Package: framed 2011/10/22 v 0.96: framed or shaded text with page breaks
+\OuterFrameSep=\skip75
+\fb@frw=\dimen300
+\fb@frh=\dimen301
+\FrameRule=\dimen302
+\FrameSep=\dimen303
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/float\float.sty
+Package: float 2001/11/08 v1.3d Float enhancements (AL)
+\c@float@type=\count347
+\float@exts=\toks40
+\float@box=\box119
+\@float@everytoks=\toks41
+\@floatcapt=\box120
+)
+\minted@appexistsfile=\read5
+\minted@bgbox=\box121
+\minted@code=\write5
+\c@minted@FancyVerbLineTemp=\count348
+\c@minted@pygmentizecounter=\count349
+\@float@every@listing=\toks42
+\c@listing=\count350
+)
+runsystem(if not exist _minted-index mkdir _minted-index)...executed.
+
+runsystem(for ^%i in (pygmentize.exe pygmentize.bat pygmentize.cmd) do set > in
+dex.aex <nul: /p x=^%~$PATH:i>> index.aex)...executed.
+
+runsystem(del index.aex)...executed.
+
+
+(C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def
+File: l3backend-pdftex.def 2021-08-04 L3 backend support: PDF output (pdfTeX)
+\l__color_backend_stack_int=\count351
+\l__pdf_internal_box=\box122
+) (index.aux)
+\openout1 = `index.aux'.
+
+LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+LaTeX Font Info:    Checking defaults for PD1/pdf/m/n on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+LaTeX Font Info:    Checking defaults for PU/pdf/m/n on input line 45.
+LaTeX Font Info:    ... okay on input line 45.
+
+(C:\Program Files\MiKTeX\tex/context/base/mkii\supp-pdf.mkii
+[Loading MPS to PDF converter (version 2006.09.02).]
+\scratchcounter=\count352
+\scratchdimen=\dimen304
+\scratchbox=\box123
+\nofMPsegments=\count353
+\nofMParguments=\count354
+\everyMPshowfont=\toks43
+\MPscratchCnt=\count355
+\MPscratchDim=\dimen305
+\MPnumerator=\count356
+\makeMPintoPDFobject=\count357
+\everyMPtoPDFconversion=\toks44
+)
+Package hyperref Info: Link coloring OFF on input line 45.
+ (C:\Program Files\MiKTeX\tex/latex/hyperref\nameref.sty
+Package: nameref 2021-04-02 v2.47 Cross-referencing by name of section
+
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/latex/refcount\refcount.sty
+Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO)
+)
+(C:\Users\tuhe\AppData\Roaming\MiKTeX\tex/generic/gettitlestring\gettitlestring
+.sty
+Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO)
+)
+\c@section@level=\count358
+)
+LaTeX Info: Redefining \ref on input line 45.
+LaTeX Info: Redefining \pageref on input line 45.
+LaTeX Info: Redefining \nameref on input line 45.
+ (index.out) (index.out)
+\@outlinefile=\write6
+\openout6 = `index.out'.
+
+LaTeX Font Info:    Trying to load font information for U+lasy on input line 48
+.
+ (C:\Program Files\MiKTeX\tex/latex/base\ulasy.fd
+File: ulasy.fd 1998/08/17 v2.2e LaTeX symbol font definitions
+)
+LaTeX Font Info:    Trying to load font information for U+msa on input line 48.
+
+ (C:\Program Files\MiKTeX\tex/latex/amsfonts\umsa.fd
+File: umsa.fd 2013/01/14 v3.01 AMS symbols A
+)
+LaTeX Font Info:    Trying to load font information for U+msb on input line 48.
+
+
+(C:\Program Files\MiKTeX\tex/latex/amsfonts\umsb.fd
+File: umsb.fd 2013/01/14 v3.01 AMS symbols B
+)
+<br.pdf, id=15, 279.0425pt x 200.75pt>
+File: br.pdf Graphic file (type pdf)
+<use br.pdf>
+Package pdftex.def Info: br.pdf  used on input line 53.
+(pdftex.def)             Requested size: 312.00119pt x 224.4678pt.
+ (index.bbl) [1{C:/Users/tuhe/AppData/Local/MiKTeX/pdftex/config/pdftex.map}pdf
+TeX warning (ext4): destination with the same identifier (name{figure.1}) has b
+een already used, duplicate ignored
+<argument> ...shipout:D \box_use:N \l_shipout_box 
+                                                  \__shipout_drop_firstpage_...
+l.60 \end{document}
+                   
+
+ <./br.pdf>] (index.aux)
+Package rerunfilecheck Info: File `index.out' has not changed.
+(rerunfilecheck)             Checksum: D96912DD8E67535EC65D76A02327F866;111.
+ ) 
+Here is how much of TeX's memory you used:
+ 26046 strings out of 478927
+ 486761 string characters out of 2862359
+ 824814 words of memory out of 3000000
+ 43413 multiletter control sequences out of 15000+600000
+ 410343 words of font info for 54 fonts, out of 8000000 for 9000
+ 1141 hyphenation exceptions out of 8191
+ 99i,7n,97p,437b,372s stack positions out of 5000i,500n,10000p,200000b,80000s
+<C:/Program Files/MiKTeX/fonts/type1/public/amsfonts/cm/cmbx12.pfb><C:/Progra
+m Files/MiKTeX/fonts/type1/public/amsfonts/cm/cmr12.pfb><C:/Program Files/MiKTe
+X/fonts/type1/public/amsfonts/cm/cmti12.pfb>
+Output written on index.pdf (1 page, 71031 bytes).
+PDF statistics:
+ 86 PDF objects out of 1000 (max. 8388607)
+ 9 named destinations out of 1000 (max. 500000)
+ 26 words of extra memory for PDF output out of 10000 (max. 10000000)
+
diff --git a/example/latex/index.out b/example/latex/index.out
new file mode 100644
index 0000000000000000000000000000000000000000..ce0fc389fc711937b09f1016563b2e8c9e378180
--- /dev/null
+++ b/example/latex/index.out
@@ -0,0 +1 @@
+\BOOKMARK [1][-]{section.1}{\376\377\000F\000i\000r\000s\000t\000\040\000s\000e\000c\000t\000i\000o\000n}{}% 1
diff --git a/example/latex/index.pdf b/example/latex/index.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..00ab4412307a86e459bf1528751a46cda41d313f
Binary files /dev/null and b/example/latex/index.pdf differ
diff --git a/example/latex/index.synctex.gz b/example/latex/index.synctex.gz
new file mode 100644
index 0000000000000000000000000000000000000000..7b8a1d1e7388c8f21f2f042b94ca1b1b5db253f7
Binary files /dev/null and b/example/latex/index.synctex.gz differ
diff --git a/example/latex/index.tex b/example/latex/index.tex
new file mode 100644
index 0000000000000000000000000000000000000000..4a08b20fbaeeb3bce1e1abdae3353d1aa32e7238
--- /dev/null
+++ b/example/latex/index.tex
@@ -0,0 +1,59 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DO NOT EDIT THIS FILE. IT WILL BE AUTOMATICALLY OVERWRITTEN
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+% TeX-command-extra-options: "-shell-escape"
+
+
+\documentclass[12pt,twoside]{article}
+\usepackage[table]{xcolor} % important to avoid options clash.
+%\input{book_preamble}
+%\input{02465shared_preamble}
+%\input{structure.tex}
+\usepackage{url}
+\usepackage{graphics}
+%\usepackage{fancybox}
+\usepackage{multicol}
+\usepackage{rotate}
+%\usepackage{epsf}
+\usepackage{rotating}
+%\usepackage{color}
+\usepackage{booktabs}
+\usepackage{hyperref}
+\usepackage{pifont}
+\usepackage{latexsym}
+\usepackage[english]{babel}
+\usepackage{epstopdf}
+\usepackage{etoolbox}
+%\usepackage{epsfig}
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{multirow,epstopdf}
+%\usepackage{cite}
+\usepackage{fancyhdr}
+\usepackage{booktabs}
+%\usepackage[most]{tcolorbox}
+\definecolor{LightGray}{HTML}{EEEEEE}
+\usepackage{cleveref}
+\usepackage{todonotes}
+%\pagestyle{fancy}
+\usepackage{minted}
+\usepackage{cleveref}
+
+
+\begin{document}
+\section{First section}\label{sec1}. 
+Math is hard \cite{bertsekasII,rosolia2018data,herlau} as can also be seen from \cref{eq1} and from \cref{fig1}.
+\begin{equation}
+2+2 = 4 \label{eq1}
+\end{equation}
+\begin{figure}\centering
+	\includegraphics[width=.8\linewidth]{br}\caption{A figure}\label{fig1}
+\end{figure}
+
+ 
+\bibliographystyle{alpha}
+\bibliography{library}
+						
+\end{document}
\ No newline at end of file
diff --git a/example/latex/library.bib b/example/latex/library.bib
new file mode 100644
index 0000000000000000000000000000000000000000..f7471d2efce4e5e0e95db1189150d91a8b6eee7a
--- /dev/null
+++ b/example/latex/library.bib
@@ -0,0 +1,289 @@
+@unpublished{herlau,
+	author  = {Tue Herlau},
+	title   = {Sequential Decision Making},
+	year    = {2021},
+	note    = {(See \textbf{02465\_Notes.pdf})}
+}
+@misc{brown2020combining,
+	title={Combining Deep Reinforcement Learning and Search for Imperfect-Information Games}, 
+	author={Noam Brown and Anton Bakhtin and Adam Lerer and Qucheng Gong},
+	year={2020},
+	eprint={2007.13544},
+	archivePrefix={arXiv},
+	primaryClass={cs.GT}
+}
+@unpublished{aa203,
+	author  = {James Harrison},
+	title   = {Optimal and Learning-based Control Combined Course Notes},
+	year    = {2020},
+	note    = {(See \textbf{AA203combined.pdf})},	
+	url = {https://github.com/StanfordASL/AA203-Notes/}
+}
+@book{bertsekasII,
+	author = {Bertsekas, Dimitri P.},
+	title = {Dynamic Programming and Optimal Control, Vol. II},
+	year = {2007},
+	isbn = {1886529302},
+	publisher = {Athena Scientific},
+	edition = {3rd},
+	abstract = {A major revision of the second volume of a textbook on the far-ranging algorithmic methododogy of Dynamic Programming, which can be used for optimal control, Markovian decision problems, planning and sequential decision making under uncertainty, and discrete/combinatorial optimization. The second volume is oriented towards mathematical analysis and computation, and treats infinite horizon problems extensively. New features of the 3rd edition are: 1) A major enlargement in size and scope: the length has increased by more than 50%, and most of the old material has been restructured and/or revised. 2) Extensive coverage (more than 100 pages) of recent research on simulation-based approximate dynamic programming (neuro-dynamic programming), which allow the practical application of dynamic programming to large and complex problems. 3) An in-depth development of the average cost problem (more than 100 pages), including a full analysis of multichain problems, and an extensive analysis of infinite-spaces problems. 4) An introduction to infinite state space stochastic shortest path problems. 5) Expansion of the theory and use of contraction mappings in infinite state space problems and in neuro-dynamic programming. 6) A substantive appendix on the mathematical measure-theoretic issues that must be addressed for a rigorous theory of stochastic dynamic programming. Much supplementary material can be found in the book's web page: http://www.athenasc.com/dpbook.html}
+}
+@article{rosolia2018data,
+	title={Data-driven predictive control for autonomous systems},
+	author={Rosolia, Ugo and Zhang, Xiaojing and Borrelli, Francesco},
+	journal={Annual Review of Control, Robotics, and Autonomous Systems},
+	volume={1},
+	pages={259--286},
+	year={2018},
+	publisher={Annual Reviews}
+}
+@article{rosolia2017learning2,
+	title={Learning model predictive control for iterative tasks: A computationally efficient approach for linear system},
+	author={Rosolia, Ugo and Borrelli, Francesco},
+	journal={IFAC-PapersOnLine},
+	volume={50},
+	number={1},
+	pages={3142--3147},
+	year={2017},
+	publisher={Elsevier}
+}
+
+@article{rosolia2017learning,
+	title={Learning model predictive control for iterative tasks. a data-driven control framework},
+	author={Rosolia, Ugo and Borrelli, Francesco},
+	journal={IEEE Transactions on Automatic Control},
+	volume={63},
+	number={7},
+	pages={1883--1896},
+	year={2017},
+	publisher={IEEE}
+}
+
+
+@book{caldentey,
+	author = {René Caldentey},
+	publisher = {Stern School of Business, New York University},
+	title = {Dynamic Programming with Applications},
+	year = {2011},
+	note= {(see \textbf{caldentey.pdf})},	
+	url = {http://people.stern.nyu.edu/rcaldent/courses/DP-ClassNotes-HEC.pdf}
+}  
+
+@book{herlau02450,
+	author = {Herlau, Tue and Mørup, Morten and Schmidt, Mikkel N.},
+	publisher = {02450 Lecture notes},
+	title = {Introduction to Machine Learning and Data Mining},
+	year = {2020},
+	note= {(See \textbf{02450Book.pdf})},	
+}  
+@inproceedings{rosolia,
+	title={Autonomous racing using learning model predictive control},
+	author={Rosolia, Ugo and Carvalho, Ashwin and Borrelli, Francesco},
+	booktitle={2017 American Control Conference (ACC)},
+	pages={5115--5120},
+	year={2017},
+	organization={IEEE},
+	note= {(See \textbf{rosolia2017.pdf})},
+}
+@book{sutton,
+	added-at = {2019-07-13T10:11:53.000+0200},
+	author = {Sutton, Richard S. and Barto, Andrew G.},
+	edition = {Second},
+	keywords = {},
+	publisher = {The MIT Press},
+	timestamp = {2019-07-13T10:11:53.000+0200},
+	title = {Reinforcement Learning: An Introduction},
+	url = {http://incompleteideas.net/book/the-book-2nd.html},
+	year = {2018 },
+	note= {(See \textbf{sutton2018.pdf})},	
+}
+
+@unpublished{cemgil,
+	author  = {Ali Taylan Cemgil},
+	title   = {A Tutorial Introduction to Monte Carlo methods, Markov Chain Monte Carlo and Particle Filtering},
+	year    = {2012},
+	note    = {(See \textbf{cemgil2012.pdf})},	
+	url = {https://www.cmpe.boun.edu.tr/~cemgil/Courses/cmpe548/cmpe58n-lecture-notes.pdf},
+}
+
+@article{kelly,
+	title={An introduction to trajectory optimization: How to do your own direct collocation},
+	author={Kelly, Matthew},
+	journal={SIAM Review},
+	volume={59},
+	number={4},
+	pages={849--904},
+	year={2017},
+	publisher={SIAM},
+	url = {https://epubs.siam.org/doi/pdf/10.1137/16M1062569},
+	note    = {(See \textbf{kelly2017.pdf})},	
+}
+
+
+@article{bertsekas,
+	title={Reinforcement learning and optimal control},
+	author={Bertsekas, Dimitri P},
+	journal={Athena Scientific},
+	year={2019},
+	url={http://web.mit.edu/dimitrib/www/RL_1-SHORT-INTERNET-POSTED.pdf},
+	note= {(See \textbf{bertsekas2019.pdf})},	
+}
+
+@inproceedings{tassa,
+	title={Synthesis and stabilization of complex behaviors through online trajectory optimization},
+	author={Tassa, Yuval and Erez, Tom and Todorov, Emanuel},
+	booktitle={2012 IEEE/RSJ International Conference on Intelligent Robots and Systems},
+	pages={4906--4913},
+	year={2012},
+	organization={IEEE},
+	url={https://ieeexplore.ieee.org/abstract/document/6386025},
+	note= {(See \textbf{tassa2012.pdf})},	
+}
+
+
+@book{betts2010practical,
+	title={Practical methods for optimal control and estimation using nonlinear programming},
+	author={Betts, John T},
+	volume={19},
+	year={2010},
+	publisher={Siam}
+}
+
+@book{bertsekas1995dynamic,
+	title={Dynamic programming and optimal control},
+	author={Bertsekas, Dimitri P and Bertsekas, Dimitri P and Bertsekas, Dimitri P and Bertsekas, Dimitri P},
+	volume={1},
+	number={2},
+	year={1995},
+	publisher={Athena scientific Belmont, MA}
+}
+
+@article{bellman1957markovian,
+	title={A Markovian decision process},
+	author={Bellman, Richard},
+	journal={Journal of mathematics and mechanics},
+	pages={679--684},
+	year={1957},
+	publisher={JSTOR}
+}
+
+@inproceedings{bertsekas2010distributed,
+	title={Distributed asynchronous policy iteration in dynamic programming},
+	author={Bertsekas, Dimitri P and Yu, Huizhen},
+	booktitle={2010 48th Annual Allerton Conference on Communication, Control, and Computing (Allerton)},
+	pages={1368--1375},
+	year={2010},
+	organization={IEEE}
+}
+@inproceedings{Gal2016,
+  title={Improving {PILCO} with {B}ayesian neural network dynamics models},
+  author={Gal, Yarin and McAllister, Rowan and Rasmussen, Carl Edward},
+  booktitle={Data-Efficient Machine Learning workshop, International Conference on Machine Learning},
+  year={2016},
+  note= {(See \textbf{gal2016.pdf})},	
+}
+
+@book{bertsekasvolI,
+	title={Dynamic Programming and Optimal Control},
+	author={Bertsekas, D.P.},
+	number={v. 1},
+	isbn={9781886529267},
+	lccn={lc00091281},
+	series={Athena Scientific optimization and computation series},
+	year={2005},
+	publisher={Athena Scientific}
+}
+
+@book{russell2002artificial,
+	title={Artificial Intelligence: a modern approach},
+	author={Russell, Stuart J. and Norvig, Peter},
+	edition={3},
+	year={2009},
+	publisher={Pearson}
+}
+
+
+
+% Deep learning related
+@inproceedings{hessel2018rainbow,
+	title={Rainbow: Combining improvements in deep reinforcement learning},
+	author={Hessel, Matteo and Modayil, Joseph and Van Hasselt, Hado and Schaul, Tom and Ostrovski, Georg and Dabney, Will and Horgan, Dan and Piot, Bilal and Azar, Mohammad and Silver, David},
+	booktitle={Thirty-Second AAAI Conference on Artificial Intelligence},
+	year={2018}
+}
+@article{wang2015dueling,
+	title={Dueling network architectures for deep reinforcement learning},
+	author={Wang, Ziyu and Schaul, Tom and Hessel, Matteo and Van Hasselt, Hado and Lanctot, Marc and De Freitas, Nando},
+	journal={arXiv preprint arXiv:1511.06581},
+	year={2015}
+}
+
+
+
+% MC intro chapter:
+
+
+@article{metropolisrrtt53,
+	added-at = {2011-05-09T23:10:52.000+0200},
+	author = {Metropolis, A. W. and Rosenbluth, A. W. and Rosenbluth, M. N. and Teller, A. H. and Teller, E.},
+	biburl = {https://www.bibsonomy.org/bibtex/24b3752b2936a9c524e2f0ca70e63d537/josephausterwei},
+	interhash = {09015548d3568943e67d50619297521e},
+	intrahash = {4b3752b2936a9c524e2f0ca70e63d537},
+	journal = {Journal of Chemical Physics},
+	keywords = {imported},
+	pages = {1087-1092},
+	timestamp = {2011-05-10T10:42:42.000+0200},
+	title = {Equations of state calculations by fast computing machines},
+	volume = 21,
+	year = 1953
+}
+@book{brooksmcbook,
+	added-at = {2019-11-27T16:57:20.000+0100},
+	author = {Brooks, Steve and Gelman, Andrew and Jones, Galin L. and Meng, Xiao-Li},
+	biburl = {https://www.bibsonomy.org/bibtex/221d785dfbbec4874e3aa0b1e4df45639/kirk86},
+	description = {Handbook of Markov Chain Monte Carlo},
+	interhash = {0b127e40d41a970274484b65a7e0744f},
+	intrahash = {21d785dfbbec4874e3aa0b1e4df45639},
+	keywords = {book mcmc},
+	timestamp = {2019-11-27T16:59:18.000+0100},
+	title = {Handbook of Markov Chain Monte Carlo
+	},
+	publisher={Chapman \& Hall},
+	url = {http://www.mcmchandbook.net/HandbookTableofContents.html},
+	year = 2011
+}
+
+@book{GVK516124188,
+	added-at = {2009-08-21T12:21:08.000+0200},
+	address = {Singapore [u.a.]},
+	author = {Rosenthal, {Jeffrey S.}},
+	biburl = {https://www.bibsonomy.org/bibtex/21ebbf183aa3295652ca2ac4e29dea8a8/fbw_hannover},
+	edition = {Reprinted},
+	interhash = {6b3625b54aac7aa32af07e7d91994cd3},
+	intrahash = {1ebbf183aa3295652ca2ac4e29dea8a8},
+	isbn = {9810243030},
+	keywords = {Wahrscheinlichkeitsrechnung Wahrscheinlichkeitstheorie},
+	pagetotal = {XIV, 177},
+	ppn_gvk = {516124188},
+	publisher = {World Scientific},
+	timestamp = {2009-08-21T12:21:56.000+0200},
+	title = {A first look at rigorous probability theory},
+	url = {http://gso.gbv.de/DB=2.1/CMD?ACT=SRCHA&SRT=YOP&IKT=1016&TRM=ppn+516124188&sourceid=fbw_bibsonomy},
+	year = 2005
+}
+
+@article{MET49,
+	added-at = {2009-03-03T17:19:04.000+0100},
+	author = {Metropolis, N. and Ulam, S.},
+	biburl = {https://www.bibsonomy.org/bibtex/23a9872b3a3572e446d5cedf42f2dc7d3/bronckobuster},
+	interhash = {f23e8d1798ee5feb71cd41eea30d830d},
+	intrahash = {3a9872b3a3572e446d5cedf42f2dc7d3},
+	journal = {J.~Am.~Stat.~Assoc.},
+	keywords = {imported},
+	nota = {mm:},
+	pages = 335,
+	timestamp = {2009-03-03T17:19:30.000+0100},
+	title = {The Monte Carlo method},
+	volume = 44,
+	year = 1949
+}
diff --git a/example/load_references.py b/example/load_references.py
new file mode 100644
index 0000000000000000000000000000000000000000..9718dde77f21095e8477d4437f3b1765c8f7f911
--- /dev/null
+++ b/example/load_references.py
@@ -0,0 +1,32 @@
+import os
+
+
+def reference_example():
+    # Load references and insert them.
+    from snipper.citations import get_bibtex, get_aux #!s=a
+    bibfile = "latex/library.bib"
+    auxfile = 'latex/index.aux'
+    bibtex = get_bibtex(bibfile)
+    aux = get_aux(auxfile) #!s
+
+    print(list(bibtex.keys())[:5])
+    print(aux)
+
+    from snipper.fix_cite import fix_aux, fix_aux_special, fix_bibtex
+    from snipper.fix_s import save_s
+
+    file = "citations.py" #!s=b
+    with open(file, 'r') as f:
+        lines = f.read().splitlines()
+    lines = fix_aux(lines, aux=aux)
+    lines = fix_aux_special(lines, aux=aux, command='\\nref', bibref='herlau')
+    lines = fix_bibtex(lines, bibtex=bibtex)
+    with open('output/citations.py', 'w') as f:
+        f.write("\n".join(lines)) #!s=b
+    # save_s(lines, output_dir="./output", file_path=file)
+
+    with open(__file__, 'r') as f:
+        save_s(f.read().splitlines(), output_dir="./output", file_path=os.path.basename(__file__) )
+
+if __name__ == "__main__":
+    reference_example()
\ No newline at end of file
diff --git a/example/output/citations.py b/example/output/citations.py
new file mode 100644
index 0000000000000000000000000000000000000000..a081fabe3fd3e651bc09ae49c2a51aefc01a0f1d
--- /dev/null
+++ b/example/output/citations.py
@@ -0,0 +1,18 @@
+"""
+{{copyright}}
+
+References:
+  [Ber07] Dimitri P. Bertsekas. Dynamic Programming and Optimal Control, Vol. II. Athena Scientific, 3rd edition, 2007. ISBN 1886529302.
+
+  [Her21] Tue Herlau. Sequential decision making. (See 02465_Notes.pdf), 2021.
+
+"""
+def myfun(): #!s
+    """
+    To solve this exercise, look at eq. (1) in Section 1.
+    You can also look at (Ber07) and (Her21)
+    More specifically, look at (Ber07, Equation 117) and (Her21, Figure 1)
+
+    We can also write a special tag to reduce repetition: (Her21, Figure 1) and (Her21, Section 1).
+    """
+    return 42 #!s
\ No newline at end of file
diff --git a/example/output/load_references_a.py b/example/output/load_references_a.py
new file mode 100644
index 0000000000000000000000000000000000000000..304c800fad3b5988a1f866385416f228499815f1
--- /dev/null
+++ b/example/output/load_references_a.py
@@ -0,0 +1,6 @@
+# load_references.py
+    from snipper.citations import get_bibtex, get_aux 
+    bibfile = "latex/library.bib"
+    auxfile = 'latex/index.aux'
+    bibtex = get_bibtex(bibfile)
+    aux = get_aux(auxfile) 
\ No newline at end of file
diff --git a/example/output/load_references_b.py b/example/output/load_references_b.py
new file mode 100644
index 0000000000000000000000000000000000000000..97642b50a2c9b2a35db1caef483d1d33e7938e75
--- /dev/null
+++ b/example/output/load_references_b.py
@@ -0,0 +1,9 @@
+# load_references.py
+    file = "citations.py" 
+    with open(file, 'r') as f:
+        lines = f.read().splitlines()
+    lines = fix_aux(lines, aux=aux)
+    lines = fix_aux_special(lines, aux=aux, command='\\nref', bibref='herlau')
+    lines = fix_bibtex(lines, bibtex=bibtex)
+    with open('output/citations.py', 'w') as f:
+        f.write("\n".join(lines)) 
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..40f97070d9cc312ab453f4bae6543c78d67f00fe
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+wexpect
+pexpect
diff --git a/setup.py b/setup.py
index 72a886d131a19dcb74d4e37bd21dc1928e2aeaa2..9dc3229562b243285a10780579f46387cd7ab24c 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,10 @@
 # Use this guide:
+# Use:  pipreqs.exe slider --no-pin --force for requirements.txt
 # https://packaging.python.org/tutorials/packaging-projects/
-# from unitgrade2.version import __version__
+# py -m build && twine upload dist/*
+
 import setuptools
+import pkg_resources
 # with open("src/unitgrade2/version.py", "r", encoding="utf-8") as fh:
 #     __version__ = fh.read().split(" = ")[1].strip()[1:-1]
 # long_description = fh.read()
@@ -30,19 +33,5 @@ setuptools.setup(
     package_dir={"": "src"},
     packages=setuptools.find_packages(where="src"),
     python_requires=">=3.8",
-    install_requires=['jinja2',],
+    install_requires=pkg_resources.parse_requirements('requirements.txt'),
 )
-
-# setup(
-#     name='unitgrade',
-#     version=__version__,
-#     packages=['unitgrade2'],
-#     url=,
-#     license='MIT',
-#     author='Tue Herlau',
-#     author_email='tuhe@dtu.dk',
-#     description="""
-# A student homework/exam evaluation framework build on pythons unittest framework. This package contains all files required to run unitgrade tests as a student. To develop tests, please use unitgrade_private.
-# """,
-#     include_package_data=False,
-# )
diff --git a/src/snipper/__init__.py b/src/snipper/__init__.py
index b4376007ee3f8f65caa49519afc7a4d1c3c6bf88..f102a9cadfa89ce554b3b26d2b90bfba2e05273c 100644
--- a/src/snipper/__init__.py
+++ b/src/snipper/__init__.py
@@ -1 +1 @@
-__version__ == "0.0.1"
+__version__ = "0.0.1"
diff --git a/src/snipper/__pycache__/__init__.cpython-38.pyc b/src/snipper/__pycache__/__init__.cpython-38.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f52a70bcdae56e64584b49d2330bcdd216e21e6d
Binary files /dev/null and b/src/snipper/__pycache__/__init__.cpython-38.pyc differ
diff --git a/src/snipper/__pycache__/citations.cpython-38.pyc b/src/snipper/__pycache__/citations.cpython-38.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9a647f415713b55177e96ceff6c8c791938806ce
Binary files /dev/null and b/src/snipper/__pycache__/citations.cpython-38.pyc differ
diff --git a/src/snipper/__pycache__/fix_cite.cpython-38.pyc b/src/snipper/__pycache__/fix_cite.cpython-38.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..25fca9463f8b858cdaef0c4b55b0579b45ebbe74
Binary files /dev/null and b/src/snipper/__pycache__/fix_cite.cpython-38.pyc differ
diff --git a/src/snipper/__pycache__/fix_s.cpython-38.pyc b/src/snipper/__pycache__/fix_s.cpython-38.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a4e3cf8604fe8f78dcdcc41bf88f448690de8363
Binary files /dev/null and b/src/snipper/__pycache__/fix_s.cpython-38.pyc differ
diff --git a/src/snipper/__pycache__/snipper.cpython-38.pyc b/src/snipper/__pycache__/snipper.cpython-38.pyc
deleted file mode 100644
index 71b07e1eb0fc48f94614ddd3c0c39e38faeb6047..0000000000000000000000000000000000000000
Binary files a/src/snipper/__pycache__/snipper.cpython-38.pyc and /dev/null differ
diff --git a/src/snipper/__pycache__/snipper.cpython-39.pyc b/src/snipper/__pycache__/snipper.cpython-39.pyc
deleted file mode 100644
index 6d64dde9973aef39e4ed1df9bd73fc265199803d..0000000000000000000000000000000000000000
Binary files a/src/snipper/__pycache__/snipper.cpython-39.pyc and /dev/null differ
diff --git a/src/snipper/__pycache__/snipper_main.cpython-38.pyc b/src/snipper/__pycache__/snipper_main.cpython-38.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6a50df2c7fb13fcde076d5ddf2d54c8687e166e5
Binary files /dev/null and b/src/snipper/__pycache__/snipper_main.cpython-38.pyc differ
diff --git a/src/snipper/citations.py b/src/snipper/citations.py
new file mode 100644
index 0000000000000000000000000000000000000000..798900f8eac5eb3f8575a187465e44a762ce5c31
--- /dev/null
+++ b/src/snipper/citations.py
@@ -0,0 +1,242 @@
+import os
+import io
+from coursebox.core.info_paths import get_paths
+from pybtex import plugin
+from pybtex.database.input import bibtex
+
+### Newstyle loading.
+
+def get_aux(auxfile):
+    # paths = get_paths()
+    # auxfile = os.path.join(paths['02450public'], auxfile)
+    if not os.path.exists(auxfile):
+        print(auxfile)
+        from warnings import warn
+        warn("Could not find file")
+        return {}
+
+    with open(auxfile, 'r') as f:
+        items = f.readlines()
+    entries = {}
+    for e in items:
+        e = e.strip()
+        if e.startswith("\\newlabel") and "@cref" in e:
+            # print(e)
+            i0 = e.find("{")
+            i1 = e.find("@cref}")
+            key = e[i0+1:i1]
+
+            j0 = e.find("{{[", i0)+3
+            j1 = e.find("}", j0)
+
+            val = e[j0:j1]
+
+            label = val[:val.find("]")]
+            number = val[val.rfind("]")+1:]
+
+            if label == "equation":
+                nlabel = f"eq. ({number})"
+            else:
+                nlabel = label.capitalize() + " " + number
+
+            # coderef = "\\cite[%s]{%s}"%(nlabel, bibtex) if bibtex is not None else None
+
+            entries[key] = {'nicelabel': nlabel, 'rawlabel': label, 'number': number}
+    return entries
+
+
+def get_bibtex(bibfile):
+    """
+    all references.
+    """
+    if not os.path.exists(bibfile):
+        return None
+
+    pybtex_style = plugin.find_plugin('pybtex.style.formatting', 'alpha')()
+    pybtex_html_backend = plugin.find_plugin('pybtex.backends', 'html')()
+    pybtex_plain_backend = plugin.find_plugin('pybtex.backends', 'plaintext')()
+    pybtex_parser = bibtex.Parser()
+
+    with open(bibfile, 'r', encoding='utf8') as f:
+        data = pybtex_parser.parse_stream(f)
+
+    data_formatted = pybtex_style.format_entries(data.entries.values())
+    refs = {}
+
+    # if 'auxfile' in gi:
+    #     all_references = parse_aux(gi['auxfile'], bibtex=gi['bibtex'])
+    # else:
+    #     all_references = {}
+
+    for entry in data_formatted:
+        output = io.StringIO()
+        output_plain = io.StringIO()
+        pybtex_plain_backend.output = output_plain.write
+        pybtex_html_backend.output = output.write
+        pybtex_html_backend.write_entry(entry.key, entry.label, entry.text.render(pybtex_html_backend))
+
+        pybtex_plain_backend.write_entry(entry.key, entry.label, entry.text.render(pybtex_plain_backend))
+
+        html = output.getvalue()
+        plain = output_plain.getvalue()
+
+        entry.text.parts[-2].__str__()
+        url = ""
+        for i,p in enumerate(entry.text.parts):
+            if "\\url" in p.__str__():
+                url = entry.text.parts[i+1]
+                break
+        url = url.__str__()
+        i1 = html.find("\\textbf")
+        i2 = html.find("</span>", i1)
+        dht = html[i1:i2]
+        dht = dht[dht.find(">")+1:]
+        html = html[:i1] + " <b>"+dht+"</b> " + html[i2+7:]
+
+        plain = plain.replace("\\textbf ", "")
+        iu = plain.find("URL")
+        if iu > 0:
+            plain = plain[:iu]
+
+        refs[entry.key] = {'html': html,
+                           'plain': plain,
+                           'label': entry.label,
+                           'filename': url,
+                           }
+
+    # newref = {}
+    # ls = lambda x: x if isinstance(x, list) else [x]
+    # if 'tex_command' in gi:
+    #     for cmd, aux, display in zip( ls(gi['tex_command']), ls(gi['tex_aux'] ), ls( gi['tex_display'] ) ):
+    #         ax = parse_aux(aux, bibtex=gi['bibtex'])
+    #         for k in ax:
+    #             ax[k]['pyref'] = display%(ax[k]['nicelabel'],)
+    #         newref[cmd] = ax
+
+    return refs#, newref
+
+
+
+def find_tex_cite(s, start=0, key="\\cite"):
+    txt = None
+    i = s.find(key, start)
+    if i < 0:
+        return (i,None), None, None
+    j = s.find("}", i)
+    cite = s[i:j + 1]
+
+    if cite.find("[") > 0:
+        txt = cite[cite.find("[") + 1:cite.find("]")]
+
+    reference = cite[cite.find("{") + 1:cite.find("}")]
+    return (i, j), reference, txt
+
+### Oldstyle loading
+def get_references(bibfile, gi):
+    """
+    all references.
+    """
+    if not os.path.exists(bibfile):
+        return None
+
+    pybtex_style = plugin.find_plugin('pybtex.style.formatting', 'alpha')()
+    pybtex_html_backend = plugin.find_plugin('pybtex.backends', 'html')()
+    pybtex_plain_backend = plugin.find_plugin('pybtex.backends', 'plaintext')()
+    pybtex_parser = bibtex.Parser()
+
+    with open(bibfile, 'r', encoding='utf8') as f:
+        data = pybtex_parser.parse_stream(f)
+
+    data_formatted = pybtex_style.format_entries(data.entries.values())
+    refs = {}
+
+    if 'auxfile' in gi:
+        all_references = parse_aux(gi['auxfile'], bibtex=gi['bibtex'])
+    else:
+        all_references = {}
+
+    for entry in data_formatted:
+        output = io.StringIO()
+        output_plain = io.StringIO()
+        pybtex_plain_backend.output = output_plain.write
+        pybtex_html_backend.output = output.write
+        pybtex_html_backend.write_entry(entry.key, entry.label, entry.text.render(pybtex_html_backend))
+
+        pybtex_plain_backend.write_entry(entry.key, entry.label, entry.text.render(pybtex_plain_backend))
+
+        html = output.getvalue()
+        plain = output_plain.getvalue()
+
+        entry.text.parts[-2].__str__()
+        url = ""
+        for i,p in enumerate(entry.text.parts):
+            if "\\url" in p.__str__():
+                url = entry.text.parts[i+1]
+                break
+        url = url.__str__()
+        i1 = html.find("\\textbf")
+        i2 = html.find("</span>", i1)
+        dht = html[i1:i2]
+        dht = dht[dht.find(">")+1:]
+        html = html[:i1] + " <b>"+dht+"</b> " + html[i2+7:]
+
+        plain = plain.replace("\\textbf ", "")
+        iu = plain.find("URL")
+        if iu > 0:
+            plain = plain[:iu]
+
+        refs[entry.key] = {'html': html,
+                           'plain': plain,
+                           'label': entry.label,
+                           'filename': url,
+                           'references': all_references}
+
+    newref = {}
+    ls = lambda x: x if isinstance(x, list) else [x]
+    if 'tex_command' in gi:
+        for cmd, aux, display in zip( ls(gi['tex_command']), ls(gi['tex_aux'] ), ls( gi['tex_display'] ) ):
+            ax = parse_aux(aux, bibtex=gi['bibtex'])
+            for k in ax:
+                ax[k]['pyref'] = display%(ax[k]['nicelabel'],)
+            newref[cmd] = ax
+
+    return refs, newref
+
+
+def parse_aux(auxfile, bibtex=None):
+    paths = get_paths()
+    auxfile = os.path.join(paths['02450public'], auxfile)
+    if not os.path.exists(auxfile):
+        print(auxfile)
+        from warnings import warn
+        warn("Could not find file")
+        return {}
+
+    with open(auxfile, 'r') as f:
+        items = f.readlines()
+    entries = {}
+    for e in items:
+        e = e.strip()
+        if e.startswith("\\newlabel") and "@cref" in e:
+            # print(e)
+            i0 = e.find("{")
+            i1 = e.find("@cref}")
+            key = e[i0+1:i1]
+
+            j0 = e.find("{{[", i0)+3
+            j1 = e.find("}", j0)
+
+            val = e[j0:j1]
+
+            label = val[:val.find("]")]
+            number = val[val.rfind("]")+1:]
+
+            if label == "equation":
+                nlabel = f"eq. ({number})"
+            else:
+                nlabel = label.capitalize() + " " + number
+
+            coderef = "\\cite[%s]{%s}"%(nlabel, bibtex) if bibtex is not None else None
+            entries[key] = {'pyref': coderef, 'nicelabel': nlabel, 'rawlabel': label, 'number': number}
+    return entries
+
diff --git a/src/snipper/fix_cite.py b/src/snipper/fix_cite.py
new file mode 100644
index 0000000000000000000000000000000000000000..9c6aadce84bb008d1fb2bf9d193336426e0f197d
--- /dev/null
+++ b/src/snipper/fix_cite.py
@@ -0,0 +1,73 @@
+from snipper.citations import find_tex_cite
+from snipper.snipper_main import COMMENT
+
+def fix_references(lines, info, strict=True):
+    for cmd in info['new_references']:
+        lines = fix_single_reference(lines, cmd, info['new_references'][cmd], strict=strict)
+    return lines
+
+def fix_single_reference(lines, cmd, aux, strict=True):
+    references = aux
+    s = "\n".join(lines)
+    i = 0
+    while True:
+        (i, j), reference, txt = find_tex_cite(s, start=i, key=cmd)
+        if i < 0:
+            break
+        if reference not in references:
+            er = "cref label not found for label: " + reference
+            if strict:
+                raise IndexError(er)
+            else:
+                print(er)
+                continue
+        r = references[reference]
+        rtxt = r['nicelabel']
+        s = s[:i] + rtxt + s[j + 1:]
+        i = i + len(rtxt)
+        print(cmd, rtxt)
+
+    lines = s.splitlines(keepends=False)
+    return lines
+
+
+def fix_aux_special(lines, aux, command='\\nref', bibref='herlau'):
+    daux = {name: {'nicelabel': f'\\cite[' + v["nicelabel"] + ']{' + bibref + "}"} for name, v in aux.items()}
+    l2 = fix_single_reference(lines, aux=daux, cmd=command, strict=True)
+    return l2
+
+def fix_aux(lines, aux, strict=True):
+    l2 = fix_single_reference(lines, aux=aux, cmd="\\ref", strict=True)
+    print("\n".join(l2))
+    return l2
+
+def fix_bibtex(lines, bibtex):
+    # lines = fix_references(lines, info, strict=strict)
+    s = "\n".join(lines)
+    i = 0
+    all_refs = []
+    while True:
+        (i, j), reference, txt = find_tex_cite(s, start=i, key="\\cite")
+        if i < 0:
+            break
+        if reference not in bibtex:
+            raise IndexError("no such reference: " + reference)
+        ref = bibtex[reference]
+        label = ref['label']
+        rtxt = f"({label}" + (", "+txt if txt is not None else "") + ")"
+        r = ref['plain']
+        if r not in all_refs:
+            all_refs.append(r)
+        s = s[:i] + rtxt + s[j+1:]
+        i = i + len(rtxt)
+
+    cpr = "{{copyright}}"
+    if not s.startswith(COMMENT):
+        s = f"{COMMENT}\n{cpr}\n{COMMENT}\n" + s
+    if len(all_refs) > 0:
+        i = s.find(COMMENT, s.find(COMMENT)+1)
+        all_refs = ["  " + r for r in all_refs]
+        s = s[:i] + "\nReferences:\n" + "\n".join(all_refs) + "\n" + s[i:]
+
+    # s = s.replace(cpr, info['code_copyright'])
+    return s.splitlines()
\ No newline at end of file
diff --git a/src/snipper/fix_s.py b/src/snipper/fix_s.py
new file mode 100644
index 0000000000000000000000000000000000000000..0eed3c8ea9e9b15926a425aad73adc5aa60fcde5
--- /dev/null
+++ b/src/snipper/fix_s.py
@@ -0,0 +1,151 @@
+import functools
+from collections import defaultdict
+from snipper.snipper_main import full_strip, block_process
+
+def f2(lines, tag, i=0, j=0):
+    for k in range(i, len(lines)):
+        index = lines[k].find(tag, j if k == i else 0)
+        if index >= 0:
+            return k, index
+    return None, None
+
+def block_iterate(lines, tag):
+    contents = {'joined': lines}
+    while True:
+        contents = block_split(contents['joined'], tag)
+        if contents is None:
+            break
+
+        yield  contents
+
+def block_split(lines, tag):
+    stag = tag[:2]  # Start of any next tag.
+
+    def join(contents):
+        return contents['first'] + [contents['block'][0] + contents['post1']] + contents['block'][1:-1] \
+                + [contents['block'][-1] + contents['post2']] + contents['last']
+    contents = {}
+    i, j = f2(lines, tag)
+
+    def get_tag_args(line):
+        k = line.find(" ")
+        tag_args = (line[:k + 1] if k >= 0 else line)[len(tag):]
+        if len(tag_args) == 0:
+            return {'': ''}  # No name.
+        tag_args = dict([t.split("=") for t in tag_args.split(";")])
+        return tag_args
+
+    if i is None:
+        return None
+    else:
+        start_tag_args = get_tag_args(lines[i][j:])
+        START_TAG = f"{tag}={start_tag_args['']}" if '' in start_tag_args else tag
+        END_TAG = START_TAG
+        i2, j2 = f2(lines, END_TAG, i=i, j=j+1)
+        if i2 == None:
+            END_TAG = tag
+            i2, j2 = f2(lines, END_TAG, i=i, j=j+1)
+
+    if i == i2:
+        # Splitting a single line. To reduce confusion, this will be treated slightly differently:
+        l2 = lines[:i] + [lines[i][:j2], lines[i][j2:]] + lines[i2+1:]
+        c2 = block_split(l2, tag=tag)
+        c2['block'].pop()
+        c2['joined'] = join(c2)
+        return c2
+    else:
+        contents['first'] = lines[:i]
+        contents['last'] = lines[i2+1:]
+
+        def argpost(line, j):
+            nx_tag = line.find(stag, j+1)
+            arg1 = line[j+len(tag):nx_tag]
+            if nx_tag >= 0:
+                post = line[nx_tag:]
+            else:
+                post = ''
+            return arg1, post
+
+        contents['arg1'], contents['post1'] = argpost(lines[i], j)
+        contents['arg2'], contents['post2'] = argpost(lines[i2], j2)
+        blk = [lines[i][:j]] + lines[i+1:i2] + [lines[i2][:j2]]
+        contents['block'] = blk
+        contents['joined'] = join(contents)
+        contents['start_tag_args'] = start_tag_args
+        contents['name'] = start_tag_args['']
+        return contents
+
+
+def get_s(lines):
+    """ Return snips from 'lines' """
+    blocks = defaultdict(list)
+    for c in block_iterate(lines, "#!s"):
+        blocks[c['name']].append(c)
+    output = {}
+    for name, co in blocks.items():
+        output[name] = [l for c in co for l in c['block']]
+    return output
+
+import os
+
+def save_s(lines, output_dir, file_path): # save file snips to disk
+    content = get_s(lines)
+    if not os.path.isdir(output_dir):
+        os.mkdir(output_dir)
+    for name, ll in content.items():
+        if file_path is not None:
+            ll = [f"# {file_path}"] + ll
+        out = "\n".join(ll)
+        with open(output_dir + "/" + os.path.basename(file_path)[:-3] + ("_" + name if len(name) > 0 else name) + ".py", 'w') as f:
+            f.write(out)
+
+        # out = "\n".join([f"# {include_path_base}"] + ["\n".join(v[1]) for v in c if v[0] == outf])
+        # with open(outf, 'w') as f:
+        #     f.write(out)
+
+    # def block_fun(lines, start_extra, end_extra, art, output, **kwargs):
+    #     outf = output + ("_" + art if art is not None and len(art) > 0 else "") + ".py"
+    #     lines = full_strip(lines)
+    #     return lines, [outf, lines]
+    # try:
+    #     a,b,c,_ = block_process(lines, tag="#!s", block_fun=functools.partial(block_fun, output=output))
+    #     if len(c)>0:
+    #         kvs= { v[0] for v in c}
+    #         for outf in kvs:
+    #             out = "\n".join([f"# {include_path_base}"]  + ["\n".join(v[1]) for v in c if v[0] == outf] )
+    #             with open(outf, 'w') as f:
+    #                 f.write(out)
+    #
+    # except Exception as e:
+    #     print("lines are")
+    #     print("\n".join(lines))
+    #     print("Bad thing in #!s command in file", file)
+    #     raise e
+    # return lines
+
+s1 = """
+L1
+L2 #!s=a
+L3 #!s=b
+L4
+L5 
+L6 
+L7 #!s=a
+L8 
+L9 #!s=b
+went
+"""
+
+if __name__ == "__main__":
+    # for c in block_iterate(s1.splitlines(), tag="#!s"):
+    #     print(c['block'])
+    output = get_s(s1.splitlines())
+    for k, v in output.items():
+        print("name:", k)
+        print("\n".join(v))
+        print("="*10)
+    # contents = block_split(s1.splitlines(), tag="#!s")
+    # contents = block_split(contents['joined'], tag="#!s")
+    # lines2 = contents['first'] +
+    a = 234
+    pass
\ No newline at end of file
diff --git a/src/snipper/snip_dir.py b/src/snipper/snip_dir.py
index ca985685e80e703d1ea4eb0c2aecff10423dd916..0a68a9d22b51eda7d2755f0effb11c3b89268d94 100644
--- a/src/snipper/snip_dir.py
+++ b/src/snipper/snip_dir.py
@@ -1,10 +1,8 @@
 import os, shutil
-# from thtools.coursebox.core.info_paths import get_paths
-# from thtools.coursebox.core.info import class_information
-from snipper.snipper import censor_file
-# from thtools.coursebox.material.homepage_lectures_exercises import fix_shared
+from snipper.snipper_main import censor_file
 from pathlib import Path
 import time
+import fnmatch
 
 
 def snip_dir(source_dir, dest_dir, exclude=None, clean_destination_dir=True):
@@ -24,9 +22,7 @@ def snip_dir(source_dir, dest_dir, exclude=None, clean_destination_dir=True):
     out = dest_dir
     hw = {'base': source_dir,
           'exclusion': exclude}
-    # def fix_hw(info, hw, out, run_files=False, cut_files=False, students_irlc_tools=None, **kwargs):
-    # CE = info['CE']
-    # paths = get_paths()
+
     print(f"[snipper] Synchronizing directories: {hw['base']} -> {out}")
     if os.path.exists(out):
         shutil.rmtree(out)
@@ -38,7 +34,6 @@ def snip_dir(source_dir, dest_dir, exclude=None, clean_destination_dir=True):
 
     ls = list(Path(out).glob('**/*.*'))
     acceptable = []
-    import fnmatch
     for l in ls:
         split = os.path.normpath(os.path.relpath(l, out))
         m = [fnmatch.fnmatch(split, ex) for ex in exclude]
@@ -85,15 +80,4 @@ def snip_dir(source_dir, dest_dir, exclude=None, clean_destination_dir=True):
                 if os.path.isdir(rm_file + "\\"):
                     shutil.rmtree(rm_file)
 
-    # for f in hw['exclusion']:
-    #     rm_file = os.path.join(out, f)
-    #     if any([df_ in rm_file for df_ in hw['inclusion']]):
-    #         continue
-    #
-    #     rm_file = os.path.abspath(rm_file)
-    #     if os.path.isfile(rm_file):
-    #         os.remove(rm_file)
-    #     else:
-    #         if os.path.isdir(rm_file + "\\"):
-    #             shutil.rmtree(rm_file)
     return n
diff --git a/src/snipper/snipper.py b/src/snipper/snipper_main.py
similarity index 80%
rename from src/snipper/snipper.py
rename to src/snipper/snipper_main.py
index 386a36038fe1566cc60e95eb90542137306f2d76..188603358c62a1b0c274b2c9a28d6e4901c1f768 100644
--- a/src/snipper/snipper.py
+++ b/src/snipper/snipper_main.py
@@ -1,9 +1,8 @@
-from thtools.coursebox.core.info import find_tex_cite
 import os
 import functools
-from thtools import execute_command
 import textwrap
 import re
+# from snipper.fix_s import save_s
 
 COMMENT = '"""'
 def indent(l):
@@ -98,7 +97,6 @@ def block_process(lines, tag, block_fun):
 
 def rem_nonprintable_ctrl_chars(txt):
     """Remove non_printable ascii control characters """
-    #Removes the ascii escape chars
     try:
         txt = re.sub(r'[^\x20-\x7E|\x09-\x0A]','', txt)
         # remove non-ascii characters
@@ -118,8 +116,8 @@ def run_i(lines, file, output):
         lines = textwrap.dedent(s).strip().splitlines()
 
         if extra['python'] is None:
-            import thtools
-            if thtools.is_win():
+            import os
+            if os.name == 'nt':
                 import wexpect as we
             else:
                 import pexpect as we
@@ -204,29 +202,6 @@ def run_i(lines, file, output):
         raise e
     return lines
 
-def save_s(lines, file, output, include_path_base=None): # save file snips to disk
-    def block_fun(lines, start_extra, end_extra, art, output, **kwargs):
-        outf = output + ("_" + art if art is not None and len(art) > 0 else "") + ".py"
-        lines = full_strip(lines)
-        return lines, [outf, lines]
-    try:
-        a,b,c,_ = block_process(lines, tag="#!s", block_fun=functools.partial(block_fun, output=output))
-
-        if len(c)>0:
-            kvs= { v[0] for v in c}
-            for outf in kvs:
-
-                out = "\n".join([f"# {include_path_base}"]  + ["\n".join(v[1]) for v in c if v[0] == outf] )
-
-                with open(outf, 'w') as f:
-                    f.write(out)
-
-    except Exception as e:
-        print("lines are")
-        print("\n".join(lines))
-        print("Bad thing in #!s command in file", file)
-        raise e
-    return lines
 
 def run_o(lines, file, output):
     def block_fun(lines, start_extra, end_extra, art, output, **kwargs):
@@ -317,76 +292,12 @@ def fix_b2(lines, keep=False):
         else:
             l2 = ([id+start_extra] if len(start_extra) > 0 else []) + [id + f"# TODO: {cc} lines missing.", id+f'raise NotImplementedError("{ee}")']
 
-
-        # if "\n".join(l2).find("l=l")>0:
-        #     a = 2342342
         stats['n'] += cc
         return l2, cc
     lines2, _, _, cutout = block_process(lines, tag="#!b", block_fun=functools.partial(block_fun, stats=stats))
     return lines2, stats['n'], cutout
 
 
-def fix_references(lines, info, strict=True):
-    for cmd in info['new_references']:
-        lines = fix_single_reference(lines, cmd, info['new_references'][cmd], strict=strict)
-    return lines
-
-def fix_single_reference(lines, cmd, aux, strict=True):
-    references = aux
-    s = "\n".join(lines)
-    i = 0
-    while True:
-        (i, j), reference, txt = find_tex_cite(s, start=i, key=cmd)
-        if i < 0:
-            break
-        if reference not in references:
-            er = "cref label not found for label: " + reference
-            if strict:
-                raise IndexError(er)
-            else:
-                print(er)
-                continue
-        r = references[reference]
-        rtxt = r['pyref']
-        s = s[:i] + rtxt + s[j + 1:]
-        i = i + len(rtxt)
-        print(cmd, rtxt)
-
-    lines = s.splitlines(keepends=False)
-    return lines
-
-
-def fix_cite(lines, info, strict=True):
-    lines = fix_references(lines, info, strict=strict)
-
-    s = "\n".join(lines)
-    i = 0
-    all_refs = []
-    while True:
-        (i, j), reference, txt = find_tex_cite(s, start=i, key="\\cite")
-        if i < 0:
-            break
-        if reference not in info['references']:
-            raise IndexError("no such reference: " + reference)
-        ref = info['references'][reference]
-        label = ref['label']
-        rtxt = f"({label}" + (", "+txt if txt is not None else "") + ")"
-        r = ref['plain']
-        if r not in all_refs:
-            all_refs.append(r)
-        s = s[:i] + rtxt + s[j+1:]
-        i = i + len(rtxt)
-
-    cpr = "{{copyright}}"
-    if not s.startswith(COMMENT):
-        s = f"{COMMENT}\n{cpr}\n{COMMENT}\n" + s
-    if len(all_refs) > 0:
-        i = s.find(COMMENT, s.find(COMMENT)+1)
-        all_refs = ["  " + r for r in all_refs]
-        s = s[:i] + "\nReferences:\n" + "\n".join(all_refs) + "\n" + s[i:]
-
-    s = s.replace(cpr, info['code_copyright'])
-    return s
 
 def full_strip(lines, tags=None):
     if tags is None:
@@ -397,13 +308,12 @@ def full_strip(lines, tags=None):
 
 
 def censor_code(lines, keep=True):
-    # lines = code.split("\n")
     dbug = True
     lines = fix_f(lines, dbug)
     lines, nB, cut = fix_b2(lines, keep=True)
     return lines
 
-    # print("safs")
+
 
 
 def censor_file(file, info, paths, run_files=True, run_out_dirs=None, cut_files=True, solution_list=None,
@@ -479,4 +389,5 @@ def censor_file(file, info, paths, run_files=True, run_out_dirs=None, cut_files=
     with open(file, 'w', encoding='utf-8') as f:
         f.write(s2)
     return nB
-# lines: 294, 399, 420, 270
\ No newline at end of file
+# lines: 294, 399, 420, 270
+