JoostSijm 4 سال پیش
والد
کامیت
a87444a2d0
7فایلهای تغییر یافته به همراه77 افزوده شده و 14 حذف شده
  1. 6 5
      .gitignore
  2. 67 0
      Makefile
  3. 0 0
      example.config.tex
  4. 3 0
      example.env
  5. 0 0
      main.tex
  6. 1 1
      preamble.tex
  7. 0 8
      set.sh

+ 6 - 5
.gitignore

@@ -27,8 +27,9 @@
 *.mtc
 *.mtc0
 *.swp
-// Compiled document
-master.pdf
-master.png
-
-paperconfig.tex
+publish.tex
+main.pdf
+main.png
+published/
+config.tex
+.env

+ 67 - 0
Makefile

@@ -0,0 +1,67 @@
+.PHONY: FORCE pdf publish watch clean purge config env docs ignore acknowledge
+
+-include .env
+export
+
+main: pdf
+
+# pdf			: generate the document as pdf
+# publish		: make a copy of pdf with desired name
+# watch			: continuious watch for changes
+# clean			: remove regeneratable latex files, except output
+# purge			: remove regeneratable latex files
+# init			: create config.tex and .env files
+# config		: copy clean config.tex file
+# env			: copy clean .env file
+# ignore		: add config.tex and .env to .gitignore
+# acknowledge	: remove config.tex and .env from .gitignore
+
+pdf: version
+	latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf $(document).tex
+
+publish: version
+	if [ ! -d "published" ]; then mkdir published; fi
+	sed -i 's/\\pagecolor/%\\pagecolor/g' config.tex
+	latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf $(document).tex 
+	sed -i 's/%\\pagecolor/\\pagecolor/g' config.tex
+	cp $(publish).pdf published/$(publish)_$(currentvolume)_$(currentissue).pdf
+	cp $(publish).pdf published/$(publish)_$(currentvolume)_$(currentissue)_$(shell date --iso-8601=seconds).pdf
+	latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf $(document).tex 
+	convert -verbose -density 150 published/$(publish)_$(currentvolume)_$(currentissue).pdf -strip -quality 100 -sharpen 0x1.0 -append published/$(publish)_$(currentvolume)_$(currentissue).png
+	convert published/$(publish)_$(currentvolume)_$(currentissue).png -trim published/$(publish)_$(currentvolume)_$(currentissue).png
+	cp published/$(publish)_$(currentvolume)_$(currentissue).png published/$(publish)_$(currentvolume)_$(currentissue)_$(shell date --iso-8601=seconds).png
+
+version:
+	sed -i '/currentvolume/c\\\currentvolume{$(currentvolume)}' config.tex
+	sed -i '/currentissue/c\\\currentissue{$(currentissue)}' config.tex
+
+watch:
+	latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -pvc $(document).tex
+
+clean:
+	latexmk -c
+
+purge:
+	latexmk -C
+
+init: config env docs
+
+config: FORCE
+	cp example.config.tex config.tex
+
+env:
+	cp example.env .env
+
+docs:
+	cp docs/template_news.tex docs/news.tex
+	cp docs/template_short_news.tex docs/short_news.tex
+
+
+ignore: acknowledge
+	echo config.tex >> .gitignore
+	echo .env >> .gitignore
+
+acknowledge:
+	sed -i '/config.tex/d' .gitignore
+	sed -i '/.env/d' .gitignore
+

+ 0 - 0
template_paperconfig.tex → example.config.tex


+ 3 - 0
example.env

@@ -0,0 +1,3 @@
+document="main"
+publish="final"
+

+ 0 - 0
master.tex → main.tex


+ 1 - 1
preamble.tex

@@ -25,7 +25,7 @@
 \usepackage{newspaper}
 
 % config newspaper
-\input{paperconfig}
+\input{config}
 \date{\today}
 
 \SetPaperName{Craftbroec}

+ 0 - 8
set.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-
-sed -i 's/\\pagecolor/%\\pagecolor/g' paperconfig.tex
-pdflatex master.tex
-sed -i 's/%\\pagecolor/\\pagecolor/g' paperconfig.tex
-convert -verbose -density 150 master.pdf -strip -quality 100 -sharpen 0x1.0 -append master.png
-convert master.png -trim master.png
-pdflatex master.tex