summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-01-01 12:55:27 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-01-01 13:45:48 +0100
commit4bf500858e0e25821a48835386571d95a299bf77 (patch)
treec2bb4bc655eb22b571cd17de7224fa906ca9192c
parentc018f8e3023575112addf61e38f58cd2d75b3862 (diff)
Add svgbob setup for plotting graphics
This reverts commit 208d92f0f5992d8d79cafcab194888a5e33087ff and adds the setup for svgbob. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--doc/paper/Makefile33
-rw-r--r--doc/paper/gen/.gitignore2
-rw-r--r--doc/paper/gen/1.bob12
-rw-r--r--doc/paper/main.tex2
-rw-r--r--doc/paper/shell.nix1
5 files changed, 47 insertions, 3 deletions
diff --git a/doc/paper/Makefile b/doc/paper/Makefile
index 4826882..4c6be00 100644
--- a/doc/paper/Makefile
+++ b/doc/paper/Makefile
@@ -29,6 +29,12 @@ ECHO_CMD=$(shell which echo)
RM_CMD=$(shell which rm)
+# The svgbob compiler
+SVGBOBC=$(shell which svgbob)
+
+# Inkscape path to compile svg to tex
+INKSCAPEC=$(shell which inkscape)
+
##
## Flags
##
@@ -42,7 +48,7 @@ export MAKE_FLAGS
#
# Flags for the latex compilre
#
-LATEX_FLAGS=-halt-on-error
+LATEX_FLAGS=-halt-on-error -shell-escape
export LATEX_FLAGS
#
@@ -56,6 +62,9 @@ export ECHO_FLAGS
#
RM_FLAGS=-f
+# Inkscape flags
+INKSCAPE_FLAGS=-D -o
+
##
## Standard commands
@@ -70,6 +79,8 @@ export ECHO
RM=$(RM_CMD) $(RM_FLAGS)
export RM
+SVGBOB=$(SVGBOBC)
+INKSCAPE=$(INKSCAPEC) $(INKSCAPE_FLAGS)
##
## Files
@@ -103,6 +114,10 @@ MAKELOG=make.log
export MAKELOG
+# All svgbob files
+SVGBOB_ALL_SOURCES=$(shell find gen -name *.bob -type f)
+SVGBOB_FILES=$(patsubst gen/%.bob,%,$(SVGBOB_ALL_SOURCES))
+
##
@@ -116,6 +131,13 @@ export MAKELOG
SCRIPTS=scripts
export SCRIPTS
+#
+# The directory where are the generator scripts
+#
+GEN_DIR=gen
+export GEN_DIR
+
+
##
@@ -153,7 +175,14 @@ all: $(PDF_FILE)
#
test one_time: $(AUX_FILE)
+gen_tex: $(SVGBOB_FILES)
+# Generate pictures with svgbob
+$(SVGBOB_FILES): %: $(SVGBOB_ALL_SOURCES)
+ @$(ECHO) "\t[SVGBOB]\t$@\t$(GEN_DIR)/$@.svg"
+ @$(SVGBOB) $(GEN_DIR)/$@.bob -o $(GEN_DIR)/$@.svg
+ @$(ECHO) "\t[INKSCAPE]\t$@.svg\t$(GEN_DIR)/$@.pdf"
+ @$(INKSCAPEC) $(INKSCAPE_FLAGS) $(GEN_DIR)/$@.png $(GEN_DIR)/$@.svg 2> /dev/null
##
@@ -164,7 +193,7 @@ test one_time: $(AUX_FILE)
#
# Generate main.aux from TeX sources
#
-$(AUX_FILE): $(LATEX_MAIN_SOURCE)
+$(AUX_FILE): $(LATEX_MAIN_SOURCE) gen_tex
@$(ECHO) "\t[LATEX]"
@$(LATEX) $(LATEX_FLAGS) -draftmode $< >> $(MAKELOG)
diff --git a/doc/paper/gen/.gitignore b/doc/paper/gen/.gitignore
new file mode 100644
index 0000000..c215392
--- /dev/null
+++ b/doc/paper/gen/.gitignore
@@ -0,0 +1,2 @@
+*.svg
+*.png
diff --git a/doc/paper/gen/1.bob b/doc/paper/gen/1.bob
new file mode 100644
index 0000000..a1ddc66
--- /dev/null
+++ b/doc/paper/gen/1.bob
@@ -0,0 +1,12 @@
+Svgbob is a diagramming model
+which uses a set of typing characters
+to approximate the intended shape.
+
+ .---.
+ /-o-/--
+ .-/ / /->
+ ( * \/
+ '-. \
+ \ /
+ '
+
diff --git a/doc/paper/main.tex b/doc/paper/main.tex
index f71d05e..953064b 100644
--- a/doc/paper/main.tex
+++ b/doc/paper/main.tex
@@ -229,7 +229,7 @@ copy& More table copy$^{\mathrm{a}}$& & \\
\end{table}
\begin{figure}[htbp]
-%\centerline{\includegraphics{fig1.png}}
+\centerline{\includegraphics{gen/1.png}}
\caption{Example of a figure caption.}
\label{fig}
\end{figure}
diff --git a/doc/paper/shell.nix b/doc/paper/shell.nix
index 1c59fbd..3defb8f 100644
--- a/doc/paper/shell.nix
+++ b/doc/paper/shell.nix
@@ -6,6 +6,7 @@ in
pkgs.mkShell rec {
buildInputs = [
pkgs.svgbob
+ pkgs.inkscape
(texlive.combine {
inherit (texlive)