Skip to content

Instantly share code, notes, and snippets.

@emir-munoz
Forked from svenwltr/Makefile
Created February 6, 2017 18:13
Show Gist options
  • Save emir-munoz/dc81481d81a594ab2398149c93d7c31f to your computer and use it in GitHub Desktop.
Save emir-munoz/dc81481d81a594ab2398149c93d7c31f to your computer and use it in GitHub Desktop.
LaTeX draft corner
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
% vim: sts=3:ts=3:sw=3 :
\documentclass[
12pt,
a4paper,
twoside,
%openright
]{scrreprt}
\usepackage{tikz}
\usepackage[all]{background}
\usepackage{blindtext} % lorem ipsum generator
\providecommand{\MyGitRevision}{Unbekannte Revision}
\newcommand{\MyDraftCorner}{
\ifthispageodd{ % different picture for left and right pages
% right corner
\begin{tikzpicture}[remember picture,overlay,x=-4mm, y=-4mm, xshift=15cm]
\draw [black] (12, 0) -- (0, 12);
\node[text=black,rotate=-45] at (3,3) {Entwurf};
\node[text=black,rotate=-45] at (4,4) {\today};
\node[text=black,rotate=-45] at (5,5) {\MyGitRevision};
\end{tikzpicture}
}{
% left corner
\begin{tikzpicture}[remember picture,overlay,x=-4mm, y=-4mm, xshift=-10.3cm]
\draw [black] (12, 12) -- (0, 0);
\node[text=black,rotate=45] at (9,3) {Entwurf};
\node[text=black,rotate=45] at (8,4) {\today};
\node[text=black,rotate=45] at (7,5) {\MyGitRevision};
\end{tikzpicture}
}
}
% define background for each page
\SetBgContents{\MyDraftCorner}
\SetBgPosition{current page.north}
\SetBgOpacity{1.0}
\SetBgAngle{0.0}
\SetBgScale{0.7}
\begin{document}
\blinddocument
\end{document}
MASTER=document.tex
DESCRIBE=$(shell git describe --tags --dirty)
SOURCE="\def\MyGitRevision{$(DESCRIBE)}\input{$(MASTER)}"
full:
make pdf
make pdf
pdf:
pdflatex "\def\MyGitRevision{$(DESCRIBE)}\input{$(MASTER)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment