summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2013-09-06 11:53:43 (GMT)
committer Jaromil <jaromil@dyne.org>2013-09-06 11:53:43 (GMT)
commit9e94c714b2ebe54c72911a66d91cbcb5e7d9fb15 (patch)
tree8a0d16dce6e673b8818f8bacd08a1f16fb3d4ba1
parent18570425831f572acab050f16e966a349d500918 (diff)
correct latex rendering of indexes and figures
added makeindex also in the template generator
-rwxr-xr-xtools/autorg-new-article21
-rwxr-xr-xtools/autorg-tex2pdf32
2 files changed, 44 insertions, 9 deletions
diff --git a/tools/autorg-new-article b/tools/autorg-new-article
index 18e4d1b..f35f9fd 100755
--- a/tools/autorg-new-article
+++ b/tools/autorg-new-article
@@ -49,6 +49,9 @@ cat <<EOF > $1
#+LATEX_HEADER: \usepackage{hyperref}
#+LATEX_HEADER: \usepackage{graphicx}
+#+LATEX_HEADER: \usepackage{makeidx}
+#+LATEX_HEADER: \makeindex
+
#+LATEX_HEADER: \usepackage{lmodern}
#+LATEX_HEADER: \usepackage[hang,small]{caption}
#+LATEX_HEADER: \usepackage{float}
@@ -100,4 +103,22 @@ Author: $fullname
#+LATEX: \newpage
+
+* Introduction
+
+
+: Write your article here
+: Leave printindex as last
+
+
+* Conclusion
+
+* Contributor details
+
+* References
+
+
+
+#+LATEX: \printindex
+
EOF \ No newline at end of file
diff --git a/tools/autorg-tex2pdf b/tools/autorg-tex2pdf
index 060db04..ae05779 100755
--- a/tools/autorg-tex2pdf
+++ b/tools/autorg-tex2pdf
@@ -19,6 +19,11 @@ act() {
error "usage: $0 filename.tex"
return 1 }
+file $1 | grep -i latex > /dev/null
+{ test "$?" = "0" } || {
+ error "not a latex file: $1"
+ return 1 }
+
notice "Rendering Tex file into PDF: $1"
file="${1%%.tex}"
@@ -30,24 +35,33 @@ file="${1%%.tex}"
touch ${file}.log
act "First pass with LaTex"
-latex $1 >> ${file}.log
+latex -interaction nonstopmode $1 >> ${file}.log
-act "Generating the Index"
-makeindex ${file}.idx >> ${file}.log
+if [ -r ${file}.idx ]; then
+ act "Generating the Index"
+ makeindex ${file}.idx >> ${file}.log
-act "Including the Index"
-cat $1 | awk '
+ act "Including the Index"
+ cat $1 | awk '
/\\printindex/ { system("cat '"$file.ind"'"); next }
{ print $0 }' > ${file}.full.tex
+else # nothing to add to the latex
+
+ cp ${file}.tex ${file}.full.tex
+
+fi
+
+act "Second pass with LaTex"
+latex -interaction nonstopmode ${file}.full.tex >> ${file}.full.log
act "Rendering the PDF"
-texi2dvi --pdf --verbose --batch ${file}.full.tex >> ${file}.log
+texi2dvi --pdf --batch ${file}.full.tex >> ${file}.full.log
-act "cleaning up leftovers"
+act "Optimizing the PDF"
+qpdf --linearize ${file}.full.pdf ${file}.pdf
-{ test -r ${file}.full.pdf } && {
- mv ${file}.full.pdf ${file}.pdf }
+act "cleaning up leftovers"
for i in aux dvi out ilg idx idxs ind toc; do
rm -f ${file}.${i}