feat(template): add multifile-tex
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ^ make editor happy
|
||||||
|
|
||||||
|
#
|
||||||
|
# Use https://direnv.net/ to automatically load the dev shell.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
|
||||||
|
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
|
||||||
|
fi
|
||||||
|
|
||||||
|
watch_file nix/**
|
||||||
|
watch_file -- **/*.nix
|
||||||
|
|
||||||
|
# Adding files to git includes them in a flake
|
||||||
|
# But it is also a bit much reloading.
|
||||||
|
# watch_file .git/index .git/HEAD
|
||||||
|
use flake . --show-trace
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
*.aux
|
||||||
|
*.aux
|
||||||
|
*.fdb_latexmk
|
||||||
|
*.fls
|
||||||
|
*.pdf
|
||||||
|
*.sta
|
||||||
|
*.toc
|
||||||
|
.auctex-auto/
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
\documentclass[class=report, crop=false]{standalone}
|
||||||
|
\usepackage[subpreambles=true]{standalone}
|
||||||
|
\usepackage{import}
|
||||||
|
\usepackage{lipsum}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\chapter{Chapter One}
|
||||||
|
|
||||||
|
\lipsum[25]
|
||||||
|
|
||||||
|
\end{document}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
\documentclass[class=report, crop=false]{standalone}
|
||||||
|
\usepackage[subpreambles=true]{standalone}
|
||||||
|
\usepackage{import}
|
||||||
|
\usepackage{lipsum}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\chapter{Chapter Two}
|
||||||
|
|
||||||
|
\lipsum[40]
|
||||||
|
|
||||||
|
\subimport{.}{tikz-fig}
|
||||||
|
|
||||||
|
\end{document}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
\documentclass{standalone}
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usetikzlibrary{positioning}
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\begin{tikzpicture}[
|
||||||
|
roundnode/.style={circle, draw=green!60, fill=green!5, very thick, minimum size=7mm},
|
||||||
|
squarednode/.style={rectangle, draw=red!60, fill=red!5, very thick, minimum size=5mm},
|
||||||
|
]
|
||||||
|
%Nodes
|
||||||
|
\node[squarednode] (maintopic) {2};
|
||||||
|
\node[roundnode] (uppercircle) [above=of maintopic] {1};
|
||||||
|
\node[squarednode] (rightsquare) [right=of maintopic] {3};
|
||||||
|
\node[roundnode] (lowercircle) [below=of maintopic] {4};
|
||||||
|
|
||||||
|
%Lines
|
||||||
|
\draw[->] (uppercircle.south) -- (maintopic.north);
|
||||||
|
\draw[->] (maintopic.east) -- (rightsquare.west);
|
||||||
|
\draw[->] (rightsquare.south) .. controls +(down:7mm) and +(right:7mm) .. (lowercircle.east);
|
||||||
|
|
||||||
|
\end{tikzpicture}
|
||||||
|
\end{document}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
description = "LaTeX environment";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
};
|
||||||
|
outputs = inputs @ {
|
||||||
|
self,
|
||||||
|
flake-parts,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
flake-parts.lib.mkFlake {inherit inputs;} (top: {
|
||||||
|
imports = [];
|
||||||
|
flake = {};
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
perSystem = {
|
||||||
|
pkgs,
|
||||||
|
self',
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
tex = pkgs.texlive.combine {
|
||||||
|
inherit
|
||||||
|
(pkgs.texlive)
|
||||||
|
scheme-basic
|
||||||
|
latexmk
|
||||||
|
lipsum
|
||||||
|
standalone
|
||||||
|
filehook
|
||||||
|
svn-prov
|
||||||
|
import
|
||||||
|
pgf
|
||||||
|
luatex85
|
||||||
|
;
|
||||||
|
};
|
||||||
|
mainTexFileDrv = dir: file:
|
||||||
|
pkgs.stdenvNoCC.mkDerivation rec {
|
||||||
|
name = "${dir}/file";
|
||||||
|
src = self;
|
||||||
|
buildInputs = [tex];
|
||||||
|
phases = ["unpackPhase" "buildPhase" "installPhase"];
|
||||||
|
buildPhase = ''
|
||||||
|
export PATH="${pkgs.lib.makeBinPath (buildInputs ++ [pkgs.coreutils])}";
|
||||||
|
env \
|
||||||
|
HOME=$(mktemp -d) \
|
||||||
|
SOURCE_DATE_EPOCH=${toString self.lastModified} \
|
||||||
|
latexmk "${dir}/${file}.tex"
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp "${dir}/${file}.pdf" $out/
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
legacyPackages = pkgs;
|
||||||
|
|
||||||
|
packages.default = self'.packages.main;
|
||||||
|
packages.main = mainTexFileDrv "main";
|
||||||
|
packages.c01 = mainTexFileDrv "chapters" "01";
|
||||||
|
packages.c02 = mainTexFileDrv "chapters" "02";
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShellNoCC {
|
||||||
|
buildInputs = [tex pkgs.texlab];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Use lualatex as the engine
|
||||||
|
$pdf_mode = 1;
|
||||||
|
$pdflatex = 'lualatex -interaction=nonstopmode %O %S';
|
||||||
|
$do_cd = 1;
|
||||||
|
$clean_ext = "sta"
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
\documentclass{report}
|
||||||
|
|
||||||
|
\usepackage[subpreambles=true]{standalone}
|
||||||
|
\usepackage{import}
|
||||||
|
|
||||||
|
\title{Standalone package example}
|
||||||
|
\author{The almightly Flake}
|
||||||
|
\date{\today}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
|
||||||
|
\maketitle
|
||||||
|
|
||||||
|
\tableofcontents
|
||||||
|
|
||||||
|
\import{chapters}{01}
|
||||||
|
|
||||||
|
\import{chapters}{02}
|
||||||
|
|
||||||
|
\end{document}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
_: {
|
||||||
|
flake.templates.multifile-tex = {
|
||||||
|
path = ./_multifile_tex;
|
||||||
|
description = "A multifile tex report.";
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user