From 325c6122330906a52b4a359f9a55dee200238fae Mon Sep 17 00:00:00 2001
From: Christian Krause <christian.krause@idiv.de>
Date: Mon, 3 Jun 2019 08:25:23 +0200
Subject: [PATCH] adds csv to table example to results

---
 Makefile                  |  3 ++-
 chapter-1-introduction.md |  5 +----
 chapter-3-results.md      | 17 +++++++++++++++++
 metadata.yml              |  1 +
 results.csv               |  3 +++
 5 files changed, 24 insertions(+), 5 deletions(-)
 create mode 100644 results.csv

diff --git a/Makefile b/Makefile
index 12b1cab..2f046e2 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ PANDOCFLAGS = \
 	--standalone \
 	--pdf-engine=xelatex \
 
+SOURCES_CSV = $(wildcard *.csv)
 SOURCES_MD = $(sort $(wildcard chapter-*.md))
 
 default: all
@@ -18,7 +19,7 @@ $(SUBDIRS):
 
 subdirs: $(SUBDIRS)
 
-document.pdf: $(SUBDIRS) metadata.yml $(SOURCES_MD)
+document.pdf: $(SUBDIRS) metadata.yml $(SOURCES_CSV) $(SOURCES_MD)
 	$(PANDOC) $(PANDOCFLAGS) -o document.pdf metadata.yml $(SOURCES_MD)
 
 check: spellcheck
diff --git a/chapter-1-introduction.md b/chapter-1-introduction.md
index a4754aa..e154071 100644
--- a/chapter-1-introduction.md
+++ b/chapter-1-introduction.md
@@ -116,10 +116,7 @@ table <- read.csv('example.csv')
 Tables
 ------
 
-| header 1 | header 2 | header 3 |
-| -------- | :------: | -------: |
-| left     | centered |   424242 |
-| aligned  | content  |       42 |
+See the **Results** chapter below for some examples.
 
 LaTeX if you need it
 --------------------
diff --git a/chapter-3-results.md b/chapter-3-results.md
index 455a6c8..b1efb97 100644
--- a/chapter-3-results.md
+++ b/chapter-3-results.md
@@ -1,2 +1,19 @@
 Results
 =======
+
+You can manually lay out tables using Markdown.
+
+| header 1 | header 2 | header 3 |
+| -------- | :------: | -------: |
+| left     | centered |   424242 |
+| aligned  | content  |       42 |
+
+Table: These are my super significant results.
+
+You can automatically insert tables from your results if you store them in CSV.
+
+\begin{table}
+  \centering
+  \csvautobooktabular{results.csv}
+  \caption{These are my super significant results.}
+\end{table}
diff --git a/metadata.yml b/metadata.yml
index 6c85c58..9c6c061 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -21,6 +21,7 @@ abstract: |
   proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 
 header-includes: |
+  \usepackage{csvsimple}
   \usepackage{draftwatermark}
 
 papersize: a4paper
diff --git a/results.csv b/results.csv
new file mode 100644
index 0000000..88700c7
--- /dev/null
+++ b/results.csv
@@ -0,0 +1,3 @@
+a,b,c
+1,2,3
+4,5,6
-- 
GitLab