From a032120bf8fe1e905082ade0dd14fd2198a4574b Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Wed, 27 Jan 2021 22:40:15 +0100
Subject: Added offset calculation variables

---
 zeitung/parts/studenttemplate.tex | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

(limited to 'zeitung/parts/studenttemplate.tex')

diff --git a/zeitung/parts/studenttemplate.tex b/zeitung/parts/studenttemplate.tex
index d5c1586..72e7763 100644
--- a/zeitung/parts/studenttemplate.tex
+++ b/zeitung/parts/studenttemplate.tex
@@ -2,19 +2,38 @@
 
 \clearpage
 
-% TODO: Add offset calculation variables (pretty easy)
 \providecommand\studentimages[1]{%
+	% Ring
+	\def\ringx{50pt}
+	\def\ringy{250pt}
+	\def\ringwidth{250pt}
+	\def\ringimgwidth{180pt}
+	\def\ringoffset{(\ringwidth - \ringimgwidth) / 2}
 	\AddToShipoutPictureBG*{
 		\AtTextUpperLeft{
-			\put(-15, -215){\includegraphics[keepaspectratio=true, width=180pt]{parts/students/figures/#1.jpg}}
-			\put(-50, -250){\includegraphics[keepaspectratio=true, width=250pt]{ring.png}}
+			\put(-\ringx + \ringoffset, -\ringy + \ringoffset){
+				\includegraphics[keepaspectratio=true, width=\ringimgwidth]{parts/students/figures/#1.jpg}
+			}
+			\put(-\ringx, -\ringy){
+				\includegraphics[keepaspectratio=true, width=\ringwidth]{ring.png}
+			}
 		}
 	}
 
+	% Frame
+	\def\framex{130pt}
+	\def\framey{40pt}
+	\def\framewidth{180pt}
+	\def\frameimgwidth{160pt}
+	\def\frameoffset{(\framewidth - \frameimgwidth) / 2}
 	\AddToShipoutPictureBG*{
 		\AtTextLowerLeft{
-			\put(\textwidth - 120, 50){\includegraphics[keepaspectratio=true, width=160pt]{parts/students/figures/#1_child.jpg}}
-			\put(\textwidth - 130, 40){\includegraphics[keepaspectratio=true, width=180pt]{rahmen.png}}
+			\put(\textwidth - \framex + \frameoffset, \framey + \frameoffset){
+				\includegraphics[keepaspectratio=true, width=\frameimgwidth]{parts/students/figures/#1_child.jpg}
+			}
+			\put(\textwidth - \framex, \framey){
+				\includegraphics[keepaspectratio=true, width=\framewidth]{rahmen.png}
+			}
 		}
 	}
 }
-- 
cgit v1.2.3

