URI: 
       tAdd notes_compile.sh - flashcard-tools - Tools for working with LaTeX flashcards
  HTML git clone git://lumidify.org/flashcard-tools.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
   DIR commit b4cee38a78c34d042fa6b0092cc2b819d1bb1395
   DIR parent 8480ba4774c5d109bb466939e34456f7b3dedba3
  HTML Author: lumidify <nobody@lumidify.org>
       Date:   Wed, 29 Apr 2020 11:01:14 +0200
       
       Add notes_compile.sh
       
       Diffstat:
         M README.md                           |       5 +++++
         A notes_compile.sh                    |      21 +++++++++++++++++++++
       
       2 files changed, 26 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/README.md b/README.md
       t@@ -37,6 +37,11 @@
        * gentsv.sh - Generates a TSV file suitable for importing into Mnemosyne.
          Note that you still need to add the definitions (`defs.tex`) for the project
          into the Mnemosyne config.
       +* notes_compile.sh <file> - Generates a regular PDF document from the LaTeX file
       +  given as an argument, including all the definitions from `defs.tex`. This
       +  is useful when some extra information is needed to understand the cards,
       +  for instance when each chapter has a set of conventions that apply to the
       +  whole chapter and can't be repeated on each card.
        
        ### Sample Workflow
        
   DIR diff --git a/notes_compile.sh b/notes_compile.sh
       t@@ -0,0 +1,21 @@
       +if [ $# -eq 0 ]
       +then
       +        echo "USAGE: ./notes_compile.sh <tex file>"
       +        exit 1
       +fi
       +
       +if [ ! -e "$1" ]
       +then
       +        echo "File doesn't exist: $1"
       +        exit 1
       +fi
       +
       +body=`cat "$1"`
       +echo '\\documentclass[12pt]{article}' > notes_compile.tex
       +echo '\\usepackage[a4paper]{geometry}' >> notes_compile.tex
       +echo '\\geometry{top=1.0in, bottom=1.0in, left=0.5in, right=0.5in}' >> notes_compile.tex
       +cat defs.tex >> notes_compile.tex
       +printf '\\begin{document}\n%s\n\\end{document}\n' "$body" >> notes_compile.tex
       +pdflatex notes_compile.tex
       +mv notes_compile.pdf `basename $1 .tex`.pdf
       +rm notes_compile.{aux,log,tex}