Skip to content
Browse files

Create main.tex automatically when converting to LaTeX.

  • Loading branch information...
1 parent aa74e5e commit ebb982241f00c6e85a81a0e08fd164dc23a8830a @pettter committed Oct 21, 2012
Showing with 36 additions and 3 deletions.
  1. +36 −3 src/convert_to_tex.sh
View
39 src/convert_to_tex.sh
@@ -5,9 +5,42 @@ else
DIR=$1
fi
mkdir $DIR
+
+cat > $DIR/main.tex <<EOF
+\documentclass[oribibl,a4paper]{book}
+
+\usepackage{amsmath,amssymb,latexsym}
+\usepackage{algorithm, algorithmic}
+\usepackage{a4}
+\usepackage{graphicx}
+\usepackage{varioref}
+\usepackage{hyperref}
+\usepackage{paralist}
+\usepackage{eurosym}
+
+
+
+\begin{document}
+
+\title{The Cryptoparty Handbook}
+\author{Various authors}
+
+\maketitle
+\tableofcontents
+\clearpage
+EOF
+
+
for d in chapter*; do
mkdir $DIR/$d
+ echo "\\graphicspath{{./$d/}}" >> $DIR/main.tex
+ title=`echo $d | sed 's/chapter_[0-9][0-9]_//; s/_/ /g; s/^./\U&/; s/ ./\U&/g'`
+ echo "\\chapter{$title}" >> $DIR/main.tex
+ for f in $d/*.md; do
+ pandoc -f markdown -t latex $f -o $DIR/$f.tex
+ echo "\\clearpage
+\\input{$f.tex}" >> $DIR/main.tex
+ done
done
-for f in */*.md; do
- pandoc -f markdown -t latex $f -o $DIR/$f.tex
-done
+
+echo '\end{document}' >> $DIR/main.tex

0 comments on commit ebb9822

Please sign in to comment.
Something went wrong with that request. Please try again.