about summary refs log tree commit diff stats
path: root/templates/latex
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-04 12:26:52 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-04 12:26:52 +0200
commit8961c2bed80314d79c3d642765128d85632f18e4 (patch)
treec8235e22d3f7c96fb6538a69d6067ec2f83ce3b2 /templates/latex
parentfeat(common/init): Safe the %INIT_ variables for later use (diff)
downloadflake-templates-8961c2bed80314d79c3d642765128d85632f18e4.tar.gz
flake-templates-8961c2bed80314d79c3d642765128d85632f18e4.zip
feat(templates/latex/presentation): Init
Diffstat (limited to 'templates/latex')
-rw-r--r--templates/latex/presentation/%INIT_APPLICATION_NAME.tex60
l---------templates/latex/presentation/.envrc1
-rw-r--r--templates/latex/presentation/.gitignore8
l---------templates/latex/presentation/.reuse1
l---------templates/latex/presentation/README.md1
l---------templates/latex/presentation/build.sh1
l---------templates/latex/presentation/cog.toml1
-rw-r--r--templates/latex/presentation/content/static/questions.tex10
-rw-r--r--templates/latex/presentation/content/static/title.tex28
-rw-r--r--templates/latex/presentation/flake.nix139
l---------templates/latex/presentation/git_template1
l---------templates/latex/presentation/headers/preamble.tex1
l---------templates/latex/presentation/headers/preamble/beamer1
l---------templates/latex/presentation/headers/preamble/core1
-rw-r--r--templates/latex/presentation/headers/preamble/mod.tex2
-rw-r--r--templates/latex/presentation/headers/preamble_local.tex0
l---------templates/latex/presentation/init1
l---------templates/latex/presentation/init.local1
-rw-r--r--templates/latex/presentation/lpm.toml37
-rwxr-xr-xtemplates/latex/presentation/present.sh14
-rw-r--r--templates/latex/presentation/references/reference.bib0
-rwxr-xr-xtemplates/latex/presentation/scripts/fix_notes.sh23
l---------templates/latex/presentation/shell_line_editor.sh1
l---------templates/latex/presentation/treefmt.nix1
l---------templates/latex/presentation/update.sh1
l---------templates/latex/presentation/watch.sh1
26 files changed, 336 insertions, 0 deletions
diff --git a/templates/latex/presentation/%INIT_APPLICATION_NAME.tex b/templates/latex/presentation/%INIT_APPLICATION_NAME.tex
new file mode 100644
index 0000000..a04a7dd
--- /dev/null
+++ b/templates/latex/presentation/%INIT_APPLICATION_NAME.tex
@@ -0,0 +1,60 @@
+% LTeX: language=%INIT_LANGUAGE
+\documentclass[
+  a4paper, 12pt,
+  draft,
+  % final,
+  hyperref={ pdflang=%INIT_DATE_TIME_LANGUAGE },
+]{beamer}
+
+\input{headers/preamble.tex}
+\input{headers/preamble_local.tex}
+
+\title{\textbf{%INIT_APPLICATION_NAME_STYLIZED}}
+\author{%INIT_AUTHOR_NAME \\
+\href{mailto:%INIT_AUTHOR_EMAIL}{%INIT_AUTHOR_EMAIL}\\[1cm]
+{\small Supervisor: TODO}}
+\date{\DTMToday}
+
+% For the copyright section
+\SetYears{%INIT_YEAR}
+\SetAuthors{%INIT_AUTHOR_NAME}
+
+\logo{\includegraphics[height=1cm]{references/images/logo}}
+
+\usetheme[block=fill]{moloch}
+
+% \setbeameroption{hide notes} % Only slides
+% \setbeameroption{show only notes} % Only notes
+% \setbeameroption{show notes on second screen} % Both
+
+\pdfpcsetup{
+    % Other settings can be package options, or can go here
+    duration=10,
+}
+
+\makeatletter
+\hypersetup{
+  pdftitle={\@title},
+  pdfsubject={},
+  pdfauthor={\@authors},
+  pdfkeywords={TODO},
+}
+\makeatother
+
+\includeonly {
+    % lpm::next_chapter_includeonly_marker
+}
+
+\begin{document}
+\input{content/static/title}
+
+% lpm::next_chapter_marker
+
+\input{content/static/questions}
+
+\appendix
+\begin{frame}
+	\printbibliography
+	\printindex
+\end{frame}
+\end{document}
diff --git a/templates/latex/presentation/.envrc b/templates/latex/presentation/.envrc
new file mode 120000
index 0000000..db044c7
--- /dev/null
+++ b/templates/latex/presentation/.envrc
@@ -0,0 +1 @@
+../../../common/.envrc
\ No newline at end of file
diff --git a/templates/latex/presentation/.gitignore b/templates/latex/presentation/.gitignore
new file mode 100644
index 0000000..539b891
--- /dev/null
+++ b/templates/latex/presentation/.gitignore
@@ -0,0 +1,8 @@
+# build
+/result
+/build
+
+/resources.local
+
+# dev env
+.direnv
diff --git a/templates/latex/presentation/.reuse b/templates/latex/presentation/.reuse
new file mode 120000
index 0000000..d538161
--- /dev/null
+++ b/templates/latex/presentation/.reuse
@@ -0,0 +1 @@
+../../../common/.reuse
\ No newline at end of file
diff --git a/templates/latex/presentation/README.md b/templates/latex/presentation/README.md
new file mode 120000
index 0000000..d250a7b
--- /dev/null
+++ b/templates/latex/presentation/README.md
@@ -0,0 +1 @@
+../../../common/README.md
\ No newline at end of file
diff --git a/templates/latex/presentation/build.sh b/templates/latex/presentation/build.sh
new file mode 120000
index 0000000..4220aab
--- /dev/null
+++ b/templates/latex/presentation/build.sh
@@ -0,0 +1 @@
+../../../common/scripts/latex/build.sh
\ No newline at end of file
diff --git a/templates/latex/presentation/cog.toml b/templates/latex/presentation/cog.toml
new file mode 120000
index 0000000..a5be520
--- /dev/null
+++ b/templates/latex/presentation/cog.toml
@@ -0,0 +1 @@
+../../../common/cog.toml
\ No newline at end of file
diff --git a/templates/latex/presentation/content/static/questions.tex b/templates/latex/presentation/content/static/questions.tex
new file mode 100644
index 0000000..40c3803
--- /dev/null
+++ b/templates/latex/presentation/content/static/questions.tex
@@ -0,0 +1,10 @@
+% LTeX: language=%INIT_LANGUAGE
+
+{
+\logo{}
+
+\begin{frame}[standout]
+	% TODO change to your needed language
+	\shadowtext{Questions?}
+\end{frame}
+}
diff --git a/templates/latex/presentation/content/static/title.tex b/templates/latex/presentation/content/static/title.tex
new file mode 100644
index 0000000..30ad3d9
--- /dev/null
+++ b/templates/latex/presentation/content/static/title.tex
@@ -0,0 +1,28 @@
+% LTeX: language=%INIT_LANGUAGE
+
+\maketitle
+
+% \begin{frame}{Content}
+% 	\setbeamertemplate{section in toc}[sections numbered]
+% 	\tableofcontents[hideallsubsections]
+% \end{frame}
+
+\begin{frame}[fragile]{Copyright}
+	% TODO: Translate this section (or remove this comment, if your language of choice is English)
+
+	This presentation is available under:
+	\begin{center}
+		\url{%INIT_HOME_PAGE}
+	\end{center}
+
+	\makeatletter
+	Copyright \textcopyright{} \@authors{} \@years{}\\
+	\ \\
+	This work is licensed under the terms of the %INIT_SPDX_LICENSE_IDENTIFIER licence.
+	The licence text can be found online at \url{%INIT_LICENSE_URL}.
+	\
+	\makeatother
+
+	% TODO match the logo to your real license
+	\begin{center}\ccbysa\end{center}
+\end{frame}
diff --git a/templates/latex/presentation/flake.nix b/templates/latex/presentation/flake.nix
new file mode 100644
index 0000000..8bdb11b
--- /dev/null
+++ b/templates/latex/presentation/flake.nix
@@ -0,0 +1,139 @@
+{
+  description = "%INIT_DESCRIPTION";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+    treefmt-nix = {
+      url = "github:numtide/treefmt-nix";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+      };
+    };
+    flake_version_update = {
+      url = "git+https://codeberg.org/soispha/flake_version_update.git";
+      inputs = {
+        systems.follows = "systems";
+        nixpkgs.follows = "nixpkgs";
+        flake-utils.follows = "flake-utils";
+      };
+    };
+    lpm = {
+      url = "git+https://codeberg.org/bpeetz/lpm.git";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+        flake-compat.follows = "flake-compat";
+        flake-utils.follows = "flake-utils";
+        rust-overlay.follows = "rust-overlay";
+        crane.follows = "crane";
+        systems.follows = "systems";
+      };
+    };
+
+    # inputs for following
+    systems = {
+      url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
+    };
+    flake-compat = {
+      url = "github:edolstra/flake-compat";
+      flake = false;
+    };
+    flake-utils = {
+      url = "github:numtide/flake-utils";
+      inputs = {
+        systems.follows = "systems";
+      };
+    };
+    crane = {
+      url = "github:ipetkov/crane";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+      };
+    };
+    rust-overlay = {
+      url = "github:oxalica/rust-overlay";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+        flake-utils.follows = "flake-utils";
+      };
+    };
+  };
+
+  outputs = {
+    self,
+    nixpkgs,
+    flake-utils,
+    treefmt-nix,
+    lpm,
+    flake_version_update,
+    ...
+  }:
+    flake-utils.lib.eachDefaultSystem (system: let
+      pkgs = nixpkgs.legacyPackages.${system};
+
+      # This version is set automatically on `cog bump --auto`;
+      version = "v%INIT_APPLICATION_VERSION"; # GUIDING VERSION STRING
+
+      # TODO reduce to the needed ones
+      texlive = pkgs.texlive.combined.scheme-full;
+
+      treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
+
+      build = pkgs.stdenv.mkDerivation {
+        pname = "%INIT_APPLICATION_NAME";
+        inherit version;
+        src = ./.;
+
+        buildInputs = [
+          texlive
+        ];
+
+        # Run local
+        preferLocalBuild = true;
+        allowSubstitutes = false;
+
+        buildPhase = ''
+          # TODO: I have no idea, why calling it with `./build.sh` does not work <2024-03-20>
+          bash ./build.sh
+        '';
+
+        installPhase = ''
+          install -D "./build/%INIT_APPLICATION_NAME.pdf" "$out/%INIT_APPLICATION_NAME.pdf";
+        '';
+      };
+    in {
+      packages.default = build;
+
+      checks = {
+        inherit build;
+        formatting = treefmtEval.config.build.check self;
+      };
+
+      formatter = treefmtEval.config.build.wrapper;
+
+      devShells.default = pkgs.mkShell {
+        env = {
+          FONTCONFIG_FILE = pkgs.makeFontsConf {
+            fontDirectories = [
+              "${pkgs.fira-mono}/share/fonts/opentype"
+              "${pkgs.fira}/share/fonts/opentype"
+            ];
+          };
+        };
+
+        packages = with pkgs; [
+          cocogitto
+          reuse
+          flake_version_update.packages."${system}".default
+          lpm.packages."${system}".default
+          texlive
+
+          wl-mirror
+
+          zathura
+
+          pdfpc
+        ];
+      };
+    });
+}
diff --git a/templates/latex/presentation/git_template b/templates/latex/presentation/git_template
new file mode 120000
index 0000000..50f92d9
--- /dev/null
+++ b/templates/latex/presentation/git_template
@@ -0,0 +1 @@
+../../../common/git_template
\ No newline at end of file
diff --git a/templates/latex/presentation/headers/preamble.tex b/templates/latex/presentation/headers/preamble.tex
new file mode 120000
index 0000000..c042d48
--- /dev/null
+++ b/templates/latex/presentation/headers/preamble.tex
@@ -0,0 +1 @@
+../../../../common/latex/preamble.tex
\ No newline at end of file
diff --git a/templates/latex/presentation/headers/preamble/beamer b/templates/latex/presentation/headers/preamble/beamer
new file mode 120000
index 0000000..5ab5a9c
--- /dev/null
+++ b/templates/latex/presentation/headers/preamble/beamer
@@ -0,0 +1 @@
+../../../../../common/latex/preamble/beamer
\ No newline at end of file
diff --git a/templates/latex/presentation/headers/preamble/core b/templates/latex/presentation/headers/preamble/core
new file mode 120000
index 0000000..f7f9f73
--- /dev/null
+++ b/templates/latex/presentation/headers/preamble/core
@@ -0,0 +1 @@
+../../../../../common/latex/preamble/core
\ No newline at end of file
diff --git a/templates/latex/presentation/headers/preamble/mod.tex b/templates/latex/presentation/headers/preamble/mod.tex
new file mode 100644
index 0000000..a8d5fc7
--- /dev/null
+++ b/templates/latex/presentation/headers/preamble/mod.tex
@@ -0,0 +1,2 @@
+\input{headers/preamble/beamer/mod.tex}
+\input{headers/preamble/core/mod.tex}
diff --git a/templates/latex/presentation/headers/preamble_local.tex b/templates/latex/presentation/headers/preamble_local.tex
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/templates/latex/presentation/headers/preamble_local.tex
diff --git a/templates/latex/presentation/init b/templates/latex/presentation/init
new file mode 120000
index 0000000..6b3141c
--- /dev/null
+++ b/templates/latex/presentation/init
@@ -0,0 +1 @@
+../../../common/init
\ No newline at end of file
diff --git a/templates/latex/presentation/init.local b/templates/latex/presentation/init.local
new file mode 120000
index 0000000..e1f9d58
--- /dev/null
+++ b/templates/latex/presentation/init.local
@@ -0,0 +1 @@
+../../../common/inits/latex/init.local
\ No newline at end of file
diff --git a/templates/latex/presentation/lpm.toml b/templates/latex/presentation/lpm.toml
new file mode 100644
index 0000000..56e40fb
--- /dev/null
+++ b/templates/latex/presentation/lpm.toml
@@ -0,0 +1,37 @@
+main_file = "%INIT_APPLICATION_NAME.tex"
+
+[templates]
+section = '''
+%! TEX root = ../../../%INIT_APPLICATION_NAME.tex
+% LTeX: language=%INIT_LANGUAGE
+
+\begin{frame}{lpm::new_section_name} % lpm::current_date
+        \setbeamercolor{itemize/enumerate body}{fg=gray}
+
+        \begin{enumerate}[<+-|alert@+>]
+            \item
+        \end{enumerate}
+\end{frame}
+'''
+
+chapter = """
+%! TEX root = ../../../%INIT_APPLICATION_NAME.tex
+% LTeX: language=%INIT_LANGUAGE
+
+% Chapter (lpm::current_date)
+\section{lpm::new_chapter_name}
+"""
+
+figure = '''
+% LTeX: language=%INIT_LANGUAGE
+\documentclass{standalone}
+
+\input{../headers/preamble.tex}
+\input{../headers/preamble_local.tex}
+
+\begin{document} % lpm::current_date (lpm::new_figure_name)
+\begin{tikzpicture}
+	\draw node[left] {ping?} (0,0) -- (3,0) node[right] {Pong!} ;
+\end{tikzpicture}
+\end{document}
+'''
diff --git a/templates/latex/presentation/present.sh b/templates/latex/presentation/present.sh
new file mode 100755
index 0000000..19b17e5
--- /dev/null
+++ b/templates/latex/presentation/present.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env sh
+
+killall swayidle
+pgrep gammastep | xargs kill
+
+# This avoids the `task` run in the `.zshrc`
+export NVIM="true"
+
+wl-mirror HDMI-A-1 &
+
+pdfpc --windowed=both ./build/%INIT_APPLICATION_NAME.pdf &
+riverctl send-to-output -current-tags next
+
+# vim: ft=sh
diff --git a/templates/latex/presentation/references/reference.bib b/templates/latex/presentation/references/reference.bib
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/templates/latex/presentation/references/reference.bib
diff --git a/templates/latex/presentation/scripts/fix_notes.sh b/templates/latex/presentation/scripts/fix_notes.sh
new file mode 100755
index 0000000..c5caf5b
--- /dev/null
+++ b/templates/latex/presentation/scripts/fix_notes.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env sh
+
+# Compiling this document with pdflatex, will leave all utf8 chars in the `\note`s
+# mangled. But, `pdfpc` interprets them as markdown, thus replacing all of them with their
+# respective html entities results in them looking correct in during the presentation.
+#
+# This script automatically replaces them in the source files.
+#
+# # Known Bugs
+# It does not account for `\note`s spanning multiple lines. So, for example, this would not
+# be fixed:
+# ```latex
+# \note {
+#   Ästhetik ist hierbei nicht mit den Wundern der Kunst zu verwechseln.
+# }
+# ```
+
+rg '\\note' --files-with-matches | while IFS= read -r file; do
+    [ "$(basename "$file")" = "$(basename "$0")" ] && continue
+
+    echo "Fixing: '$file'"
+    sed --in-place 's/^\(.*\)\\note\(.*\){\(.*\)}/printf "%s\\\\\\note%s{%s}" "\1" "\2" "$( echo "\3" | sed "s@ä@\\\&auml\;@g" | sed "s@ö@\\\&ouml\;@g" | sed "s@ü@\\\&uuml\;@g" | sed "s@Ä@\\\&Auml\;@g" | sed "s@Ö@\\\&Ouml\;@g" | sed "s@Ü@\\\&Uuml\;@g" | sed "s@ß@\\\&szlig\;@g" | sed "s@→@\\\&rarr\;@g" )"/eg' "$file"
+done
diff --git a/templates/latex/presentation/shell_line_editor.sh b/templates/latex/presentation/shell_line_editor.sh
new file mode 120000
index 0000000..e2ec043
--- /dev/null
+++ b/templates/latex/presentation/shell_line_editor.sh
@@ -0,0 +1 @@
+../../../common/shell_line_editor.sh
\ No newline at end of file
diff --git a/templates/latex/presentation/treefmt.nix b/templates/latex/presentation/treefmt.nix
new file mode 120000
index 0000000..01b71f7
--- /dev/null
+++ b/templates/latex/presentation/treefmt.nix
@@ -0,0 +1 @@
+../../../common/treefmt.nix
\ No newline at end of file
diff --git a/templates/latex/presentation/update.sh b/templates/latex/presentation/update.sh
new file mode 120000
index 0000000..e84e4e3
--- /dev/null
+++ b/templates/latex/presentation/update.sh
@@ -0,0 +1 @@
+../../../common/scripts/update.sh
\ No newline at end of file
diff --git a/templates/latex/presentation/watch.sh b/templates/latex/presentation/watch.sh
new file mode 120000
index 0000000..fa5d4ea
--- /dev/null
+++ b/templates/latex/presentation/watch.sh
@@ -0,0 +1 @@
+../../../common/scripts/latex/watch.sh
\ No newline at end of file