Browse Source

Initialize and addition of files

koerschens 3 years ago
commit
83cd74456f
3 changed files with 140 additions and 0 deletions
  1. 115 0
      addcopyright.sh
  2. 8 0
      example.sh
  3. 17 0
      template.tex

+ 115 - 0
addcopyright.sh

@@ -0,0 +1,115 @@
+#!/bin/bash
+
+input=""
+output=""
+
+authors=""
+title=""
+venue=""
+year=""
+notice=""
+
+while [ "$#" -gt 0 ]; do
+    case "$1" in
+        "--input")
+            input="$2"
+            shift 2
+            ;;
+        
+        "--output")
+            output="$2"
+            shift 2
+            ;;
+        
+        "--authors")
+            authors="$2"
+            shift 2
+            ;;
+        
+        "--title")
+            title="$2"
+            shift 2
+            ;;
+        
+        "--venue")
+            venue="$2"
+            shift 2
+            ;;
+        
+        "--year")
+            year="$2"
+            shift 2
+            ;;
+        
+        "--notice")
+            notice="$2"
+            shift 2
+            ;;
+        
+        "--help")
+            echo "Usage: bash addcopyright.sh --input INPUT --output OUTPUT --authors AUTHORS --title PAPERTITLE --venue VENUE --year YEAR --notice COPYRIGHT_NOTICE"
+            exit
+            ;;
+        
+        *)
+            echo "Invalid value: $$1"
+            echo
+            echo "Usage: bash addcopyright.sh --input INPUT --output OUTPUT --authors AUTHORS --title PAPERTITLE --venue VENUE --year YEAR --notice COPYRIGHT_NOTICE"
+            exit
+            ;;
+    esac
+done
+
+if [ "$input" = "" ]; then
+    echo "Input file is missing. Please provide this value with --input."
+    exit
+fi
+if [ "$output" = "" ]; then
+    echo "Output file is missing. Please provide this value with --output."
+    exit
+fi
+if [ "$authors" = "" ]; then
+    echo "Authors are missing. Please provide this value with --authors."
+    exit
+fi
+if [ "$title" = "" ]; then
+    echo "Paper title is missing. Please provide this value with --title."
+    exit
+fi
+if [ "$venue" = "" ]; then
+    echo "Venue is missing. Please provide this value with --venue."
+    exit
+fi
+if [ "$year" = "" ]; then
+    echo "Year is missing. Please provide this value with --year."
+    exit
+fi
+if [ "$notice" = "" ]; then
+    echo "Copyright notice is missing. Please provide this value with --notice."
+    exit
+fi
+
+
+input=$(realpath "$input")
+output=$(realpath "$output")
+
+output_dir=$(dirname $output)
+output_fname=$(basename $output)
+output_fname="${output_fname%.*}"
+
+thisdir=$(dirname "$0")
+
+cat "$thisdir/template.tex" | \
+    sed 's~<INPUT>~'"$input"'~g' | \
+    sed 's~<AUTHORS>~'"$authors"'~g' | \
+    sed 's~<TITLE>~'"$title"'~g' | \
+    sed 's~<VENUE>~'"$venue"'~g' | \
+    sed 's~<YEAR>~'"$year"'~g' | \
+    sed 's~<CNOTICE>~'"$notice"'~g' > temp.tex
+
+pdflatex temp.tex
+pdflatex temp.tex
+
+mv temp.pdf "$output"
+
+rm -f temp.aux temp.fdb_latexmk temp.fls temp.log temp.out temp.synctex.gz temp.tex

+ 8 - 0
example.sh

@@ -0,0 +1,8 @@
+bash addcopyright.sh \
+    --input path/to/paper.pdf \
+    --output ./paperwcopyright.pdf \
+    --authors 'M. Exampleauthor, J. Additionalauthor and R. Lastauthor' \
+    --title 'Fancy Paper Title' \
+    --venue 'German Conference on Pattern Recognition (GCPR)' \
+    --year 2021 \
+    --notice 'Will be published on Springer.'

+ 17 - 0
template.tex

@@ -0,0 +1,17 @@
+\documentclass{article}
+\usepackage{pdfpages}
+\usepackage[pdfborder={0 0 0}]{hyperref}
+\usepackage{url}
+\usepackage{tikz}
+\usetikzlibrary{positioning}
+\definecolor{fsublue}{RGB}{62,106,190}
+\begin{document}
+  \includepdf[pages=1,pagecommand={\thispagestyle{empty}\begin{tikzpicture}[remember picture, overlay]
+      \node (node1) at (current page.north) {}; 
+      \node[align=center,fill=fsublue!50,font=\scriptsize] (node2) [below=of node1] 
+        {<AUTHORS>:\\<TITLE>.\\%
+         <VENUE>. <YEAR>.\\<CNOTICE>%
+        };
+    \end{tikzpicture}}]{<INPUT>}
+  \includepdf[pages=2-last]{<INPUT>}
+\end{document}