diff options
26 files changed, 687 insertions, 127 deletions
diff --git a/latex/.envrc b/latex/.envrc deleted file mode 100644 index 1d383f2..0000000 --- a/latex/.envrc +++ /dev/null @@ -1,2 +0,0 @@ -use flake | use nix -watch flake.nix diff --git a/latex/.gitignore b/latex/.gitignore deleted file mode 100644 index 099b827..0000000 --- a/latex/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# build dirs -/result -/build - -.direnv diff --git a/latex/cog.toml b/latex/cog.toml deleted file mode 100644 index 316fb11..0000000 --- a/latex/cog.toml +++ /dev/null @@ -1,28 +0,0 @@ -from_latest_tag = false -tag_prefix = "v" -ignore_merge_commits = false -pre_package_bump_hooks = [] -post_package_bump_hooks = [] - -branch_whitelist = [ - "prime", -] - -pre_bump_hooks = [ - "nix build", # verify the project builds - "flake_version_update --version v{{version}} --input-file flake.nix", -] -post_bump_hooks = [ - "git push", - "git push origin v{{version}}", # push the new tag to origin -] - -[commit_types] - -[changelog] -path = "NEWS.md" -authors = [] - -[bump_profiles] - -[packages] diff --git a/latex/content/static/title.tex b/latex/content/static/title.tex deleted file mode 100644 index aaf4c6e..0000000 --- a/latex/content/static/title.tex +++ /dev/null @@ -1,12 +0,0 @@ -% LTeX: language=de-DE - -\maketitle -\tableofcontents -\vspace*{\fill} -\makeatletter -Copyright \textcopyright{} \@authors{} \@years{}\\ -\ \\ -Dieses Werk ist lizenziert unter den Bedingungen der CC BY-SA 4.0. -Der Lizenztext ist online unter \url{http://creativecommons.org/licenses/by-sa/4.0/legalcode} abrufbar. -\makeatother -\clearpage diff --git a/latex/main.tex b/latex/main.tex deleted file mode 100644 index 8130689..0000000 --- a/latex/main.tex +++ /dev/null @@ -1,22 +0,0 @@ -%\documentclass[a4paper, 12pt, nosolutions]{report} -\documentclass[a4paper, 12pt]{report} -% LTeX: language=de-DE -\input{headers/preamble.tex} -\input{headers/preamble_local.tex} - - -\title{\textbf{TODO}} -\author{name} -\authors{name\inst} -\years{2023} -\date{\DTMToday} - -\includeonly{} - -\begin{document} - \input{content/static/title} - - % NEXT_CHAPTER - - \printbibliography\relax -\end{document} diff --git a/templates/latex/.envrc b/templates/latex/.envrc new file mode 100644 index 0000000..3bc1085 --- /dev/null +++ b/templates/latex/.envrc @@ -0,0 +1,9 @@ +use flake || use nix +watch_file flake.nix + +PATH_add ./scripts + +if on_git_branch; then + echo && git status --short --branch && + echo && git fetch --verbose +fi diff --git a/templates/latex/.gitignore b/templates/latex/.gitignore new file mode 100644 index 0000000..539b891 --- /dev/null +++ b/templates/latex/.gitignore @@ -0,0 +1,8 @@ +# build +/result +/build + +/resources.local + +# dev env +.direnv diff --git a/templates/latex/.licensure.yml b/templates/latex/.licensure.yml new file mode 100644 index 0000000..551ddfc --- /dev/null +++ b/templates/latex/.licensure.yml @@ -0,0 +1,155 @@ +--- +# Regexes which if matched by a file path will always be excluded from +# getting a license header +excludes: + - .*lock + - \.git/.* + - LICENSE.spdx + - COPYING + - COPYING.LESSER + - .*\.(rst|txt|pdf) +# Definition of the licenses used on this project and to what files +# they should apply. +# +# No default license configuration is provided. This section must be +# configured by the user. +licenses: + # Either a regex or the string "any" to determine to what files this + # license should apply. It is common for projects to have files + # under multiple licenses or with multiple copyright holders. This + # provides the ability to automatically license files correctly + # based on their file paths. + # + # If "any" is provided all files will match this license. + - files: any + # + # The license identifier, a list of common identifiers can be + # found at: https://spdx.org/licenses/ but existence of the ident + # in this list it is not enforced unless auto_template is set to + # true. + ident: CC-BY-SA-4.0 + # + # A list of authors who hold copyright over these files + authors: + # Provide either your full name or company name for copyright purposes + - name: Benedikt Peetz + # Optionally provide email for copyright purposes + email: "benedikt.peetz@b-peetz.de" + + # The template that will be rendered to generate the header before + # comment characters are applied. Available variables are: + # - [year]: substituted with the current year. + # - [name of author]: Substituted with name of the author and email + # if provided. If email is provided the output appears as Full + # Name <email@example.com>. If multiple authors are provided the + # list is concatenated together with commas. + template: | + <TODO> 2024 - [year] (C) by [name of author] + SPDX-License-Identifier: CC-BY-SA-4.0 + + <TODO> is licensed under a + Creative Commons Attribution-ShareAlike 4.0 International License. + + You should have received a copy of the license along with this + work. If not, see <https://creativecommons.org/licenses/by-sa/4.0/>. + + + # If auto_template is true then template is ignored and the SPDX + # API will be queried with the ident value to automatically + # determine the license header template. auto_template works best + # with licenses that have a standardLicenseHeader field defined in + # their license info JSON, if it is not then we will use the full + # licenseText to generate the header which works fine for short + # licenses like MIT but can be quite lengthy for other licenses + # like BSD-4-Clause. The above default template is valid for most + # licenses and is recommended for MIT, and BSD licenses. Common + # licenses that work well with the auto_template feature are GPL + # variants, and the Apache 2.0 license. + # + # Important Note: this means the ident must be a valid SPDX identifier + # auto_template: true + + # If true try to detect the text wrapping of the template, and unwrap it + unwrap_text: false + +# Define type of comment characters to apply based on file extensions. +comments: + # The extensions (or singular extension) field defines which file + # extensions to apply the commenter to. + - extensions: + - js + - go + # The commenter field defines the kind of commenter to + # generate. There are two types of commenters: line and block. + # + # This demonstrates a line commenter configuration. A line + # commenter type will apply the comment_char to the beginning of + # each line in the license header. It will then apply a number of + # empty newlines to the end of the header equal to trailing_lines. + # + # If trailing_lines is omitted it is assumed to be 0. + commenter: + type: line + comment_char: "//" + trailing_lines: 1 + + - extensions: + - rs + - tri + - css + - cpp + - c + - h + # This demonstrates a block commenter configuration. A block + # commenter type will add start_block_char as the first character + # in the license header and add end_block_char as the last character + # in the license header. If per_line_char is provided each line of + # the header between the block start and end characters will be + # line commented with the per_line_char + # + # trailing_lines works the same for both block and line commenter + # types + commenter: + type: block + start_block_char: "/*\n" + end_block_char: "*/\n" + per_line_char: "*" + trailing_lines: 1 + + - extension: + - html + - md + commenter: + type: block + start_block_char: "<!--\n" + end_block_char: "-->\n" + trailing_lines: 1 + + - extensions: + - el + - lisp + commenter: + type: line + comment_char: ";;;" + trailing_lines: 1 + + - extensions: + - tex + commenter: + type: line + comment_char: "%" + trailing_lines: 1 + + # The extension string "any" is special and so will match any file + # extensions. Commenter configurations are always checked in the + # order they are defined, so if any is used it should be the last + # commenter configuration or else it will override all others. + # + # In this configuration if we can't match the file extension we fall + # back to the popular '#' line comment used in most scripting + # languages. + - extension: any + commenter: + type: line + comment_char: '#' + trailing_lines: 1 diff --git a/latex/LICENSE b/templates/latex/LICENSE index dbb2b35..dbb2b35 100644 --- a/latex/LICENSE +++ b/templates/latex/LICENSE diff --git a/latex/LICENSE.spdx b/templates/latex/LICENSE.spdx index 082e0dc..20d2ea0 100644 --- a/latex/LICENSE.spdx +++ b/templates/latex/LICENSE.spdx @@ -4,4 +4,4 @@ Creator: TODO PackageName: TODO PackageOriginator: TODO PackageHomePage: TODO -PackageLicenseDeclared: CC BY-SA 4.0 +PackageLicenseDeclared: CC-BY-SA-4.0 diff --git a/templates/latex/README.md b/templates/latex/README.md new file mode 100644 index 0000000..466604a --- /dev/null +++ b/templates/latex/README.md @@ -0,0 +1,10 @@ +# TODO + +Some text about the project. + +## Licence +This document is licensed under a +Creative Commons Attribution-ShareAlike 4.0 International License. + +You should have received a copy of the license along with this +work. If not, see <https://creativecommons.org/licenses/by-sa/4.0/>. diff --git a/templates/latex/build.sh b/templates/latex/build.sh new file mode 100755 index 0000000..1932138 --- /dev/null +++ b/templates/latex/build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# if no parameter is given, use 'dst' as destination directory +if [ -z "$1" ]; then + dst=build +else + dst="$1" +fi + +# find all directories which are not the destination dir or inside it +find . -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir +do + mkdir --parents "$dst/$dir" +done +latexmk -outdir="$dst" -file-line-error -pdflatex -recorder ./main.tex diff --git a/templates/latex/cog.toml b/templates/latex/cog.toml new file mode 100644 index 0000000..500ed32 --- /dev/null +++ b/templates/latex/cog.toml @@ -0,0 +1,24 @@ +tag_prefix = "v" +branch_whitelist = ["main", "prime"] +ignore_merge_commits = false + +pre_bump_hooks = [ + "nix flake check", # verify the project builds + "./scripts/renew_copyright_header.sh", # update the license header in each file + "flake_version_update --version v{{version}} --input-file flake.nix", # update the version in the flake.nix file + "nix fmt", # format +] +post_bump_hooks = [ + "git push", + "git push origin v{{version}}", # push the new tag to origin +] + +[bump_profiles] + +[changelog] +path = "NEWS.md" +template = "remote" +remote = "TODO" +repository = "TODO" +owner = "TODO" +authors = [{ signature = "Benedikt Peetz", username = "bpeetz" }] diff --git a/templates/latex/content/static/title.tex b/templates/latex/content/static/title.tex new file mode 100644 index 0000000..e4a833d --- /dev/null +++ b/templates/latex/content/static/title.tex @@ -0,0 +1,14 @@ +% LTeX: language=en-GB + +\maketitle + +\tableofcontents +\vspace*{\fill} +\makeatletter +Copyright \textcopyright{} \@authors{} \@years{}\\ +\ \\ +This work is licensed under the terms of the CC BY-SA 4.0 licence. +The licence text can be found online at \url{http://creativecommons.org/licenses/by-sa/4.0/legalcode}. +\ +\makeatother +\clearpage diff --git a/templates/latex/flake.lock b/templates/latex/flake.lock new file mode 100644 index 0000000..e095a79 --- /dev/null +++ b/templates/latex/flake.lock @@ -0,0 +1,210 @@ +{ + "nodes": { + "crane": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711681752, + "narHash": "sha256-LEg6/dmEFxx6Ygti5DO9MOhGNpyB7zdxdWtzv/FCTXk=", + "owner": "ipetkov", + "repo": "crane", + "rev": "ada0fb4dcce4561acb1eb17c59b7306d9d4a95f3", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake_version_update": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1685288691, + "narHash": "sha256-oP6h34oJ8rm6KlUpyZrX+ww3hnoWny2ecrEXxkU7F3c=", + "ref": "refs/heads/prime", + "rev": "e9a97e01eca780bd16e1dbdbd8856b59558f4959", + "revCount": 5, + "type": "git", + "url": "https://codeberg.org/soispha/flake_version_update.git" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/soispha/flake_version_update.git" + } + }, + "lpm": { + "inputs": { + "crane": [ + "crane" + ], + "flake-compat": [ + "flake-compat" + ], + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": [ + "rust-overlay" + ], + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1711915832, + "narHash": "sha256-5vFraJ2xnDvuEI2zeUbre8amzVDLAneODNNdJb6HSZk=", + "ref": "refs/heads/prime", + "rev": "67f3079cd49deb116ba215244e7a1a1575a71ede", + "revCount": 10, + "type": "git", + "url": "https://codeberg.org/Soispha/lpm.git" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/Soispha/lpm.git" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1711715736, + "narHash": "sha256-9slQ609YqT9bT/MNX9+5k5jltL9zgpn36DpFB7TkttM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "807c549feabce7eddbf259dbdcec9e0600a0660d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "flake_version_update": "flake_version_update", + "lpm": "lpm", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", + "systems": "systems", + "treefmt-nix": "treefmt-nix" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711851236, + "narHash": "sha256-EJ03x3N9ihhonAttkaCrqxb0djDq3URCuDpmVPbNZhA=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "f258266af947599e8069df1c2e933189270f143a", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1680978846, + "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", + "owner": "nix-systems", + "repo": "x86_64-linux", + "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "x86_64-linux", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711803027, + "narHash": "sha256-Qic3OvsVLpetchzaIe2hJqgliWXACq2Oee6mBXa/IZQ=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "1810d51a015c1730f2fe05a255258649799df416", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/latex/flake.nix b/templates/latex/flake.nix index 52f7353..ca4edeb 100644 --- a/latex/flake.nix +++ b/templates/latex/flake.nix @@ -1,64 +1,71 @@ { - description = ""; # TODO + description = "TODO"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - # 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; - }; - crane = { - url = "github:ipetkov/crane"; + + treefmt-nix = { + url = "github:numtide/treefmt-nix"; inputs = { nixpkgs.follows = "nixpkgs"; - flake-compat.follows = "flake-compat"; - flake-utils.follows = "flake-utils"; - rust-overlay.follows = "rust-overlay"; }; }; - flake-utils = { - url = "github:numtide/flake-utils"; + 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"; }; }; - rust-overlay = { - url = "github:oxalica/rust-overlay"; + lpm = { + url = "git+https://codeberg.org/Soispha/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"; }; }; - # bins - flake_version_update = { - url = "git+https://codeberg.org/soispha/flake_version_update.git"; + # 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"; - flake-utils.follows = "flake-utils"; }; }; - lpm = { - url = "git+https://codeberg.org/Soispha/lpm.git"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; inputs = { nixpkgs.follows = "nixpkgs"; - flake-compat.follows = "flake-compat"; flake-utils.follows = "flake-utils"; - rust-overlay.follows = "rust-overlay"; }; }; }; outputs = { + self, nixpkgs, flake-utils, - flake_version_update, + treefmt-nix, lpm, + flake_version_update, ... }: flake-utils.lib.eachDefaultSystem (system: let @@ -69,9 +76,11 @@ # TODO reduce to the needed ones texlive = pkgs.texlive.combined.scheme-full; - in { - packages.default = pkgs.stdenv.mkDerivation { - pname = ""; # TODO + + treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; + + build = pkgs.stdenv.mkDerivation { + pname = "TODO"; inherit version; src = ./.; @@ -79,17 +88,33 @@ texlive ]; + # Run local + preferLocalBuild = true; + allowSubstitutes = false; + buildPhase = '' - latexmk -file-line-error main.tex + # TODO: I have no idea, why calling it with `./build.sh` does not work <2024-03-20> + bash ./build.sh ''; installPhase = '' - install -D $scr/build/*.pdf $out/; + install -D ./build/main.pdf $out/TODO; ''; }; + in { + packages.default = build; + + checks = { + inherit build; + formatting = treefmtEval.config.build.check self; + }; + + formatter = treefmtEval.config.build.wrapper; + devShells.default = pkgs.mkShell { packages = with pkgs; [ cocogitto + licensure flake_version_update.packages."${system}".default lpm.packages."${system}".default texlive @@ -99,5 +124,3 @@ }; }); } -# vim: ts=2 - diff --git a/latex/headers/preamble.tex b/templates/latex/headers/preamble.tex index 9620808..bc8aa8a 100644 --- a/latex/headers/preamble.tex +++ b/templates/latex/headers/preamble.tex @@ -9,14 +9,29 @@ % \usepackage{textcomp} % support for yen and so on, not needed since latex2e(2020) % references -\usepackage[ngerman]{babel} % For German language support, with reformed orthography! +\usepackage[british]{babel} % For English language support, with reformed orthography! +% \usepackage[brithish]{babel} % For English language support, with reformed orthography! \usepackage{csquotes} % required by biblatex % \usepackage{biber} % required by biblatex + +% \usepackage{biblatex-dw} \usepackage[backend=biber, - style=numeric, - autocite=superscript + style=footnote-dw, + % + pageref=true, + annotation=true, + library=true, + % + % style=numeric, + autocite=superscript, + % FIXME: Keep this here? <2024-03-20> + doi=true, + isbn=true, + loccittracker=true, + opcittracker=true ]{biblatex} % For bibtex references -\addbibresource{resources/reference} +\addbibresource{resources/reference.bib} +% \renewcommand{\autocite}[1]{\footcite{#1}\supercite{#1}} % \bibliography{res/reference} % Set the location of the references % dates, time @@ -63,23 +78,24 @@ \usepackage{emptypage} % no page numbers and headings on empty pages % \usepackage[a4paper, left=2cm, right=2cm, top=2cm, bottom=2cm]{geometry} % For nice margins % \usepackage{xspace} % Adds a space when it thinks it is necessary -% \usepackage{blindtext} % blindtext +\usepackage{blindtext} % blindtext % tikz style config \tikzset{help_lines/.style={step=.5cm,gray!50,very thin}} % notes -\usepackage{todonotes} +% \usepackage{todonotes} % links % \usepackage[hidelinks]{hyperref} % Links in the pdf +\usepackage[nospace]{varioref} \usepackage[pdflang=de-DE]{hyperref} -\hypersetup{ - colorlinks, - linkcolor={black}, - citecolor={black}, - urlcolor={blue!80!black} - } +% \hypersetup{ +% colorlinks, +% linkcolor={black}, +% citecolor={black}, +% urlcolor={blue!80!black} +% } % \usepackage{stmaryrd} % for \lightning @@ -215,15 +231,15 @@ \DTMnewdatestyle{margindate}{ \renewcommand*\DTMdisplaydate[4]{ - \MakeLowercase{\DTMgermanshortweekdayname{##4}}\space + \MakeLowercase{\DTMshortweekdayname{##4}}\space \number##3\relax\space - \MakeLowercase{\DTMgermanshortmonthname{##2}}\space + \MakeLowercase{\DTMshortmonthname{##2}}\space \DTMtwodigits{\DTMtwodigits{##1}} } \renewcommand*\DTMDisplaydate[4]{ - \DTMgermanshortweekdayname{##4}\space + \DTMshortweekdayname{##4}\space ##3\space - \DTMgermanshortmonthname{##2}\space + \DTMshortmonthname{##2}\space \DTMtwodigits{\DTMtwodigits{##1}} } } @@ -247,13 +263,13 @@ \margindate{#2} } -\pagestyle{fancy} -\fancyhf{} -\fancyhead[LE, RO]{} -\fancyhead[RO, LE]{\@lesson} -\fancyhead[RE, LO]{} -\fancyfoot[LE, RO]{\thepage} -\fancyfoot[C]{\leftmark} +% \pagestyle{fancy} +% \fancyhf{} +% \fancyhead[LE, RO]{} +% \fancyhead[RO, LE]{\@lesson} +% \fancyhead[RE, LO]{} +% \fancyfoot[LE, RO]{\thepage} +% \fancyfoot[C]{\leftmark} % Parameters diff --git a/latex/headers/preamble_local.tex b/templates/latex/headers/preamble_local.tex index e69de29..e69de29 100644 --- a/latex/headers/preamble_local.tex +++ b/templates/latex/headers/preamble_local.tex diff --git a/templates/latex/lpm.toml b/templates/latex/lpm.toml new file mode 100644 index 0000000..5a3565d --- /dev/null +++ b/templates/latex/lpm.toml @@ -0,0 +1,19 @@ +[last_chapter] +user_name = "static" +number = 0 + +[templates] +section = ''' +%! TEX root = ../../../main.tex +% LTeX: language=en-GB + +\section{REPLACMENT_SECTION_TITLE} % DATE +This is some text +''' + +chapter = ''' +%! TEX root = ../../main.tex +% LTeX: language=en-GB + +\chapter{REPLACEMENT_CHAPTER} +''' diff --git a/templates/latex/main.tex b/templates/latex/main.tex new file mode 100644 index 0000000..591e600 --- /dev/null +++ b/templates/latex/main.tex @@ -0,0 +1,44 @@ +% LTeX: language=en-GB +%\documentclass[a4paper, 12pt, nosolutions]{report} +% \documentclass[a4paper, 12pt, onecolumn]{report} +\documentclass[a4paper, 12pt, twocolumn]{scrartcl} + +\input{headers/preamble.tex} +\input{headers/preamble_local.tex} + +\title{\textbf{TODO}} +\author{Benedikt Peetz \\ +\href{mailto:benedikt.peetz@b-peetz.de}{benedikt.peetz@b-peetz.de}\\[1cm] +{\small Supervisor: TODO}} +\date{\DTMToday} + +% For the copyright section +\years{2024} +\authors{Benedikt Peetz} + +\makeatletter +\hypersetup{ + pdftitle={\@title}, + pdfsubject={}, + pdfauthor={\@authors}, + pdfkeywords={TODO}, + colorlinks, + linkcolor={black}, + citecolor={black}, + urlcolor={blue!80!black} +} +\makeatother + + +\includeonly{} + +\begin{document} + \onecolumn + \input{content/static/title} + \twocolumn + + % NEXT_CHAPTER + + \clearpage{} + \printbibliography\relax +\end{document} diff --git a/templates/latex/references/reference.bib b/templates/latex/references/reference.bib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/templates/latex/references/reference.bib diff --git a/templates/latex/scripts/extract_text_from_all.sh b/templates/latex/scripts/extract_text_from_all.sh new file mode 100755 index 0000000..dd8818f --- /dev/null +++ b/templates/latex/scripts/extract_text_from_all.sh @@ -0,0 +1,7 @@ +#! /usr/bin/env sh + +grep 'INPUT ./' ./build/main.fls | uniq | sed 's/INPUT //' | while read -r file; do + if ! [ "$(basename "$file")" = preamble.tex ] && ! [ "$(basename "$file")" = gymnasium.png ]; then + printf "\n%% Filename: %s\n" "$file"; grep -v '^\s*%' "$file"; + fi; + done diff --git a/templates/latex/scripts/renew_copyright_header.sh b/templates/latex/scripts/renew_copyright_header.sh new file mode 120000 index 0000000..f286da9 --- /dev/null +++ b/templates/latex/scripts/renew_copyright_header.sh @@ -0,0 +1 @@ +../../../common/renew_copyright_header.sh \ No newline at end of file diff --git a/templates/latex/treefmt.nix b/templates/latex/treefmt.nix new file mode 120000 index 0000000..6a4fe7d --- /dev/null +++ b/templates/latex/treefmt.nix @@ -0,0 +1 @@ +../../treefmt.nix \ No newline at end of file diff --git a/templates/latex/update.sh b/templates/latex/update.sh new file mode 100755 index 0000000..49216b8 --- /dev/null +++ b/templates/latex/update.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +nix flake update diff --git a/treefmt.nix b/treefmt.nix new file mode 100644 index 0000000..3de59f8 --- /dev/null +++ b/treefmt.nix @@ -0,0 +1,70 @@ +{ + treefmt-nix, + pkgs, +}: +treefmt-nix.lib.evalModule pkgs ( + {pkgs, ...}: { + # Used to find the project root + projectRootFile = "flake.nix"; + + programs = { + alejandra.enable = true; + rustfmt.enable = true; + clang-format.enable = true; + mdformat.enable = true; + shfmt = { + enable = true; + indent_size = 4; + }; + shellcheck.enable = true; + prettier = { + settings = { + arrowParens = "always"; + bracketSameLine = false; + bracketSpacing = true; + editorconfig = true; + embeddedLanguageFormatting = "auto"; + endOfLine = "lf"; + # experimentalTernaries = false; + htmlWhitespaceSensitivity = "css"; + insertPragma = false; + jsxSingleQuote = true; + printWidth = 80; + proseWrap = "always"; + quoteProps = "consistent"; + requirePragma = false; + semi = true; + singleAttributePerLine = true; + singleQuote = true; + trailingComma = "all"; + useTabs = false; + vueIndentScriptAndStyle = false; + + tabWidth = 4; + overrides = { + files = ["*.js"]; + options.tabwidth = 2; + }; + }; + }; + stylua.enable = true; + ruff = { + enable = true; + format = true; + }; + taplo.enable = true; + }; + + settings = { + global.excludes = ["CHANGELOG.md"]; + formatter = { + clang-format = { + options = ["--style" "GNU"]; + }; + shfmt = { + includes = ["*.bash"]; + }; + }; + }; + } +) |