current experimental state

This commit is contained in:
nobody 2024-12-07 07:13:08 +01:00
parent 3904b31b7b
commit 78170e6bcc
7 changed files with 3516 additions and 28 deletions

3
.gitignore vendored
View file

@ -1,6 +1,9 @@
*.aux
*.hd
*.log
*.out
*.toc
*.pdf
_minted-*
*.fdb_latexmk
*.fls

View file

@ -12,5 +12,11 @@ clean:
distclean:
latexmk -C
mwe.pdf: mwe.tex
latexmk -pdflua -lualatex="lualatex --shell-escape %O %S" $<
doku.pdf: doku.tex cccbform.cls logo.pdf
latexmk -pdflua -lualatex="lualatex --shell-escape %O %S" $<
%.pdf :: %.tex cccbform.cls logo.pdf
latexmk -pdflua $<

18
README.md Normal file
View file

@ -0,0 +1,18 @@
# Formulare
## Zutaten
* Debian: texlive-base, latexmk, TODO
+ relevant sind: luahbtex / lualatex, latexmk, sowie diverse Pakete (siehe .cls)
* Font: Recursive (<https://recursive.design>) als variable font gobal installiert
## Kurzanleitung
* `make` baut alles, neue `.tex`-Datei sollte automatisch gefunden werden
* im Zweifel ein bestehendes Dokument kopieren und anpassen, die meisten
Sachen sollten relativ einfach verständlich sein
* es gibt ein paar Sonderzeichen in TeX, die nicht einfach so verwendet
werden können; meist ist es ausreichend einen Backslash davor zu packen,
ansonsten sollte <http://detexify.kirelabs.org/classify.html> helfen
(das Ergebnis sollte ohne `\usepackage{…}` auskommen und `textmode` sein)

View file

@ -1,14 +1,35 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cccbform}[2024-11-08 In the Beginning, There Was Chaos]
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\ProvidesClass{cccbform}[2024/12/08 In the Beginning, There Was Chaos]
\LoadClass{scrartcl}
\RequirePackage{geometry, calc, xparse, xcolor, hyperref, tikz, tikzpagenodes,
fontspec, changepage, letltxmacro, textpos}
\RequirePackage{geometry, calc, fontspec, tikz, hyperref, changepage, letltxmacro}
\RequirePackage[ngerman]{babel}
\usetikzlibrary{calc}
\geometry{a4paper, margin=1.5cm, inner=2.5cm}
\pagestyle{empty}
% allow disabling PDF forms in case they cause printing problems
% (*most* viewers don't print them, so we need "fake" fields below them anyways
% but some do, and always put the form field on top (even if explicitly placed
% below other elements), which then obscures the label text)
\newif\if@DoPdfForm
\@DoPdfFormtrue
\DeclareOption{noform}{\@DoPdfFormfalse}
\newif\if@Example
\@Examplefalse
\DeclareOption{example}{ % for embedded examples in the documentation
\geometry{a6paper, margin=1ex}
\@Exampletrue
}
\DeclareOption{shortexample}{
\geometry{paperwidth=105mm, paperheight=74mm, margin=1ex}
\@Exampletrue
\AtEndDocument{%
\pageheight=\pagetotal
\advance\pageheight by 2ex
}
}
\ProcessOptions\relax
% address
@ -18,10 +39,6 @@
10117~Berlin
}
% page
\geometry{a4paper, margin=1.5cm, inner=2.5cm}
\pagestyle{empty}
\setmainfont[
Renderer=HarfBuzz,
ItalicFont=Recursive,
@ -67,20 +84,6 @@
ItalicFeatures={RawFeature={+axis={MONO=0.0,CASL=0.4,slnt=-15,CRSV=1,wght=500}}}
]{Recursive}
% fonts
% cmr: 0 / 2.502 / 1.251 / 0.834 / 2.586 / 6.0 / 0.834 || -3
%\setmainfont{Barlow} % 0 / 1.2 / 0.6 / 0.4 / 3.036 / 6.0 / 0.4 || -2
%\setmainfont{Monaspace Neon} % 0 / 3.72 / 1.86 / 1.24 / 3.081 / 6.0 / 1.24 || -7
%\setmainfont{Baltic Sund} % 0 / 1.476 / 0.738 / 0.492 / 3.0 / 6.0 / 0.492 || -3
%\setmainfont{Cabin Sketch} % 0 / 1.35 / 0.675 / 0.45 / 3.03 / 6.0 / 0.45 || -2
%\setmainfont{Consolas} % 0 / 3.2988 / 0 / 0 / 2.941 / 6.0 / 0 || -6
%\setmainfont{Eagle Lake} % 0 / 1.787 / 0.89355 / 0.5957 / 3.2 / 6.0 / 0.5957 || -3
%\setmainfont{Fira Sans} % 0 / 1.59 / 0.795 / 0.53 / 3.162 / 6.0 / 0.53 || -3
%\setmainfont{Gentium Book Plus} % 0 / 1.32 / 0.66 / 0.44 / 2.72 / 6.0 / 0.44 || -2
%\setmainfont{Ubuntu} % 0 / 1.38 / 0.69 / 0.46 / 3.12 / 6.0 / 0.46 || -2
%\setmainfont{Ubuntu Condensed} % 0 / 1.17 / 0.58 / 0.39 / 3.12 / 6.0 / 0.39 || -2
%\setmainfont{Ubuntu Mono} % 0 / 3.0 / 0 / 0 / 3.12 / 6.0 / 0 || -5
% colors
\definecolor{fieldcolor}{gray}{0.85}
\definecolor{bordercolor}{gray}{0.1}
@ -486,17 +489,29 @@
% put the logo in the top right corner
\NewDocumentCommand{\@logo}{}{
\begin{tikzpicture}[remember picture, overlay]
\node[anchor=north east] at (current page.north east) [xshift=-1.5cm, yshift=-1.5cm] {%
\includegraphics[width=3cm]{logo.pdf}%
};
\end{tikzpicture}%
\if@Example
\begin{tikzpicture}[remember picture, overlay]
\node[anchor=north east] at (current page.north east) [xshift=-0.5cm, yshift=-0.5cm] {%
\includegraphics[width=1.5cm]{logo.pdf}%
};
\end{tikzpicture}%
\else
\begin{tikzpicture}[remember picture, overlay]
\node[anchor=north east] at (current page.north east) [xshift=-1.5cm, yshift=-1.5cm] {%
\includegraphics[width=3cm]{logo.pdf}%
};
\end{tikzpicture}%
\fi
}
% LogoTitle{title} - logo on the right, title on the left
\NewDocumentCommand{\LogoTitle}{m}{
\@logo
\\[1cm]{\titlefont\huge\bfseries #1}\\[1.5cm]
\if@Example
\\[0.5cm]{\titlefont\huge\bfseries #1}\\[1cm]
\else
\\[1cm]{\titlefont\huge\bfseries #1}\\[1.5cm]
\fi
}
% AddressTitle{title} - title at the top, address, then the form below
@ -516,11 +531,14 @@
}
\NewDocumentCommand{\PageFoldMarks}{}{
\if@Example
\else
\begin{tikzpicture}[remember picture,overlay]
\draw ($(current page.north west)!0.33!(current page.south west)$) -- ++(7.5mm,0cm);
\draw ($(current page.north west)!0.50!(current page.south west)$) -- ++(1.25cm,0cm);
\draw ($(current page.north west)!0.66!(current page.south west)$) -- ++(7.5mm,0cm);
\end{tikzpicture}
\fi
}
% fold markers

113
doku.tex Normal file
View file

@ -0,0 +1,113 @@
\documentclass{ltxdoc}
\usepackage{tikz,fancyvrb,geometry,minted,fontspec}
\usepackage[ngerman]{babel}
\usetikzlibrary{positioning}
\geometry{a4paper,margin=2cm}
\setmainfont[
Renderer=HarfBuzz,
ItalicFont=Recursive,
BoldFont=Recursive,
BoldItalicFont=Recursive,
Scale=0.9,
UprightFeatures={
RawFeature={+ss01,+ss02,+ss08,+case},
RawFeature={+axis={MONO=0.0,CASL=0.2,slnt=0,CRSV=0,wght=400}}
},
BoldFeatures={RawFeature={+axis={MONO=0.0,CASL=0.2,slnt=0,CRSV=0,wght=700}}},
BoldItalicFeatures={RawFeature={+axis={MONO=0.0,CASL=0.2,slnt=-15,CRSV=1,wght=700}}},
ItalicFeatures={RawFeature={+axis={MONO=0.0,CASL=0.2,slnt=-15,CRSV=1,wght=400}}}
]{Recursive}
\setmonofont[
Renderer=HarfBuzz,
ItalicFont=Recursive,
BoldFont=Recursive,
BoldItalicFont=Recursive,
Scale=0.9,
UprightFeatures={
RawFeature={+ss01,+ss02,+ss08,+case},
RawFeature={+axis={MONO=1.0,CASL=0.2,slnt=0,CRSV=0,wght=400}}
},
BoldFeatures={RawFeature={+axis={MONO=1.0,CASL=0.2,slnt=0,CRSV=0,wght=700}}},
BoldItalicFeatures={RawFeature={+axis={MONO=1.0,CASL=0.2,slnt=-15,CRSV=1,wght=700}}},
ItalicFeatures={RawFeature={+axis={MONO=1.0,CASL=0.2,slnt=-15,CRSV=1,wght=400}}}
]{Recursive}
\newfontfamily\titlefont[
Renderer=HarfBuzz,
ItalicFont=Recursive,
BoldFont=Recursive,
BoldItalicFont=Recursive,
Scale=0.9,
UprightFeatures={
RawFeature={+ss01,+ss02,+ss08,+case},
RawFeature={+axis={MONO=0.0,CASL=0.4,slnt=0,CRSV=1,wght=500}}
},
BoldFeatures={RawFeature={+axis={MONO=0.0,CASL=0.4,slnt=0,CRSV=1,wght=800}}},
BoldItalicFeatures={RawFeature={+axis={MONO=0.0,CASL=0.4,slnt=-15,CRSV=1,wght=800}}},
ItalicFeatures={RawFeature={+axis={MONO=0.0,CASL=0.4,slnt=-15,CRSV=1,wght=500}}}
]{Recursive}
\directlua{ os.execute "mkdir -p cccbform-examples" }
\directlua{ os.execute "cp cccbform.cls cccbform-examples/" }
\directlua{ os.execute "cp logo.pdf cccbform-examples/" }
\NewDocumentCommand{\LineCount}{m}{\directlua{
local n, f = 0, io.open("cccbform-examples/#1.tex")
for l in f:lines() do n = n + 1 end
tex.print( n - 1 )
}}
\NewDocumentEnvironment{ShortExample}{m}{
\VerbatimEnvironment
\begin{VerbatimOut}{cccbform-examples/#1.tex}[]
\documentclass[shortexample]{cccbform}
\begin{document}}{
\end{document}
\end{VerbatimOut}
\directlua{ os.execute "cd cccbform-examples ; latexmk -pdflua #1.tex" }
\edef\lc{\LineCount{#1}}
\begin{tikzpicture}
\node[anchor=north west, inner sep=1ex, draw] (code) {
\begin{minipage}[t]{0.45\textwidth}
\inputminted[firstline=3,lastline=\lc]{tex}{cccbform-examples/#1.tex}
\end{minipage}
};
\node[anchor=north west, right=2mm of code, draw] (output) {
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{cccbform-examples/#1.pdf}
\end{minipage}
};
\end{tikzpicture}
}
\NewDocumentEnvironment{StandaloneExample}{m}{
\VerbatimEnvironment%
\begin{VerbatimOut}{cccbform-examples/#1.tex}}%
{\end{VerbatimOut}%
\directlua{ os.execute "cd cccbform-examples ; latexmk -pdflua #1.tex" }
\edef\lc{\LineCount{#1}}
\begin{tikzpicture}
\node[anchor=north west, inner sep=1ex, draw] (code) {
\begin{minipage}[t]{0.45\textwidth}
\inputminted[firstline=3,lastline=\lc]{tex}{cccbform-examples/#1.tex}
\end{minipage}
};
\node[anchor=north west, right=2mm of code, draw] (output) {
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{cccbform-examples/#1.pdf}
\end{minipage}
};
\end{tikzpicture}
}
\title{\texttt{cccbform} -- Formulare für den CCCB}
\author{Frank Nord}
\begin{document}
\maketitle
\tableofcontents
\section{Übersicht}
\begin{ShortExample}{test}
\Text{Test}
\end{ShortExample}
\end{document}

3281
fvextra.sty Normal file

File diff suppressed because it is too large Load diff

49
mwe.tex Normal file
View file

@ -0,0 +1,49 @@
\documentclass{standalone}
\usepackage{tikz,fvextra,minted,luacode}
\usetikzlibrary{positioning}
\directlua{ os.execute "mkdir -p examples" }
\NewDocumentCommand{\LineCount}{m}{\directlua{
local n, f = 0, io.open("examples/#1.tex")
for l in f:lines() do n = n + 1 end
tex.print( n - 1 )
}}
\newwrite\examplefile
\NewDocumentEnvironment{ShortExample}{m}{
\VerbatimEnvironment
\immediate\openout\examplefile=examples/#1.tex\relax
\begin{VerbatimWrite}[writefilehandle=\examplefile]
\documentclass{standalone}
\begin{document}
\end{VerbatimWrite}
\begin{VerbatimWrite}[writefilehandle=\examplefile]}%
{\end{VerbatimWrite}
\begin{VerbatimWrite}[writefilehandle=\examplefile]
\end{document}
\end{VerbatimWrite}
\immediate\closeout\examplefile
\directlua{ os.execute( "cd examples ; latexmk -pdflua ".."#1"..".tex" ) }
\edef\lc{\LineCount{#1}}
\begin{tikzpicture}
\node[anchor=north west, inner sep=1ex, draw] (code) {
\begin{minipage}[t]{0.45\textwidth}
\inputminted[autogobble=true,firstline=3,lastline=\lc]{tex}{examples/#1.tex}
\end{minipage}
};
\node[anchor=north west, right=2mm of code, draw] (output) {
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{examples/#1.pdf}
\end{minipage}
};
\end{tikzpicture}
}
\begin{document}
\begin{ShortExample}{test}
Test
\end{ShortExample}
\end{document}