Initial commit: Klammertext source distribution

Curated source subset assembled by klammertext-dev's doc/make_dist.sh: the Klammermachine (mac), the Standard Klammer Set (sks), the commands (com), editor plugins and install guides (doc), a test subset (tst), and lib/bin placeholders. Builds with 'make -C com'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-18 18:48:23 +02:00
commit 2ba7ceee7a
272 changed files with 27634 additions and 0 deletions

View File

@@ -0,0 +1,143 @@
% Header and footer definitions for the SKS @document klammer.
%
% Three page style sets, one per document structure:
%
% plain structure: No headers. Centered page number in footer.
% article structure: No headers. Centered page number in footer.
% First page has no header (same as regular pages).
% book structure: Verso header: chapter number + title.
% Recto header: section number + title.
% Page number in outer header margin.
% No footer. Chapter-opening pages get centered
% page number in footer and no header.
%
% Special styles used across structures:
% \pagestyle{empty} — title pages, copyright pages, part pages, blank pages
%
% The style names use a "sks" prefix to avoid clashing with LaTeX's
% built-in page style names:
% \pagestyle{sksplain}, \pagestyle{sksarticle}, \pagestyle{sksbook}
%
% titlesec's pagestyles option (loaded by titles.sty) provides \newpagestyle,
% \sethead, \setfoot, and the automatic marks \chaptertitle, \sectiontitle,
% \subsectiontitle.
\usepackage{ifthen}
% --- Font for header/footer text ---
\newcommand{\hdrfont}[1]{{\sffamily\scalefont{.9}{#1}}}
% --- Running head content ---
%
% These commands produce the running head text, using titlesec's automatic
% mark variables. They suppress output when the counter is zero (before
% the first heading of that level has appeared).
%
% The \sect dispatch from titles.sty shifts heading levels between book
% and article classes: in book class, \sA expands to \chapter and the
% top-level counter is \thechapter; in article class, \sA expands to
% \section and the top-level counter is \thesection. The running head
% commands follow the same shift.
\ifthenelse{\equal{\documentisbook}{true}}{%
\newcommand{\runningchapter}{%
\ifthenelse{\equal{0}{\thechapter}}{}{\hdrfont{\thechapter~~\chaptertitle}}}
\newcommand{\runningsection}{%
\ifthenelse{\equal{0}{\thesection}}{}{\hdrfont{\thesection~~\sectiontitle}}}
}{%
\newcommand{\runningchapter}{%
\ifthenelse{\equal{0}{\thesection}}{}{\hdrfont{\thesection~~\sectiontitle}}}
\newcommand{\runningsection}{%
\ifthenelse{\equal{0}{\thesubsection}}{}{\hdrfont{\thesubsection~~\subsectiontitle}}}
}
% --- Plain structure ---
%
% No headers, centered page number in footer, no rules.
\newpagestyle{sksplain}{%
\ifdefined\documentbottom
\setfoot{\hdrfont{\documentbottom}}{}{\hdrfont{\thepage}}%
\else
\setfoot{}{\hdrfont{\thepage}}{}%
\fi
}
% --- Article structure ---
%
% Same as plain: no headers, centered page number in footer, no rules.
% Defined as a separate style so that it can be extended independently
% (e.g., adding author/title running heads for longer articles).
\newpagestyle{sksarticle}{%
\ifdefined\documentbottom
\setfoot{\hdrfont{\documentbottom}}{}{\hdrfont{\thepage}}%
\else
\setfoot{}{\hdrfont{\thepage}}{}%
\fi
}
% --- Book structure ---
%
% Twoside layout with running heads and page numbers in the outer margin.
% Verso (even): chapter title in header.
% Recto (odd): section title in header.
% No footer on regular pages.
\newpagestyle{sksbook}{%
\sethead[\hdrfont{\thepage}]%
[]%
[\runningchapter]%
{\runningsection}%
{}%
{\hdrfont{\thepage}}%
\ifdefined\documentbottom
\setfoot[\hdrfont{\documentbottom}]%
[]%
[]%
{}%
{}%
{\hdrfont{\documentbottom}}%
\fi
}
% --- Book opening style ---
%
% \chapter internally calls \thispagestyle{plain}, so we must override
% LaTeX's built-in plain style for book structure. For plain and article
% structures, the override is harmless (plain is not used as the main
% page style, and this matches the centered-page-number convention).
\ifthenelse{\equal{\documentisbook}{true}}{%
\renewpagestyle{plain}{%
\ifdefined\documentbottom
\setfoot{\hdrfont{\documentbottom}}{}{\hdrfont{\thepage}}%
\else
\setfoot{}{}{\hdrfont{\thepage}}%
\fi
}
}{%
\renewpagestyle{plain}{%
\ifdefined\documentbottom
\setfoot{\hdrfont{\documentbottom}}{}{\hdrfont{\thepage}}%
\else
\setfoot{}{\hdrfont{\thepage}}{}%
\fi
}
}
% --- Noheader (compatibility) ---
%
% Used by toc.sty for TOC chapter entries. No running heads, centered
% page number in footer.
\newpagestyle{noheader}{%
\ifdefined\documentbottom
\setfoot{\hdrfont{\documentbottom}}{}{\hdrfont{\thepage}}%
\else
\setfoot{}{\hdrfont{\thepage}}{}%
\fi
}
\write0{Headers and page styles defined}

3
sks/section/sty/list.txt Normal file
View File

@@ -0,0 +1,3 @@
titles.sty
headerfooter.sty
toc.sty

View File

@@ -0,0 +1,11 @@
\usepackage{titles}
\usepackage{headerfooter}
\usepackage{toc}
%% \usepackage{etoolbox}
%% \makeatletter
%% %\patchcmd{\chapter}{\if@openright\cleardoublepage\else\newpage\fi}{}{}{}
%% %\patchcmd{\chapter}{\newpage}{}{}{}
%% %\patchcmd{\chapter}{\if@openright\clearpage\else\newpage\fi}{}{}{}
%% \patchcmd{\chapter}{\clearpage}{}{}{}
%% \makeatother

123
sks/section/sty/titles.sty Normal file
View File

@@ -0,0 +1,123 @@
% Section heading formatting for the SKS @document klammer.
%
% The \sect command dispatches between book and article document classes.
% Section klammers (@s1-@s7) emit \sA-\sE, which expand to the appropriate
% LaTeX sectioning command based on \documentisbook. The \defineheading
% utility eliminates duplication across heading levels.
\usepackage[bf,sf,big,raggedright,compact,newlinetospace,explicit,pagestyles,clearempty]{titlesec}
\usepackage{etoolbox}
\usepackage{ifthen}
% --- Structure dispatch ---
% Select first or second argument based on document class:
\newcommand{\sect}[2]{\ifthenelse{\equal{\documentisbook}{true}}{#1}{#2}}
% Sectioning commands, shifted by structure:
\newcommand{\sA}{\sect{\chapter}{\section}}
\newcommand{\sB}{\sect{\section}{\subsection}}
\newcommand{\sC}{\sect{\subsection}{\subsubsection}}
\newcommand{\sD}{\sect{\subsubsection}{\paragraph}}
\newcommand{\sE}{\sect{\paragraph}{\subparagraph}}
% Counters, shifted by structure:
\newcommand{\snA}{\sect{\thechapter}{\thesection}}
\newcommand{\snB}{\sect{\thesection}{\thesubsection}}
\newcommand{\snC}{\sect{\thesubsection}{\thesubsubsection}}
\newcommand{\snD}{\sect{\thesubsubsection}{\theparagraph}}
\newcommand{\snE}{\sect{\theparagraph}{\thesubparagraph}}
% Font sizes, shifted by structure:
\newcommand{\fsect}[2]{\ifthenelse{\equal{\documentisbook}{true}}{\sfont{#1}}{\sfont{#2}}}
\newcommand{\fA}{\fsect{1.6}{1.2}}
\newcommand{\fB}{\fsect{1.2}{1.1}}
\newcommand{\fC}{\fsect{1.1}{1.1}}
\newcommand{\fD}{\fsect{1.1}{1.1}}
\newcommand{\fE}{\fsect{1.1}{1.1}}
% --- Shared heading parameters ---
\newlength{\beforeheading}\setlength{\beforeheading}{4pt}
\newlength{\afterheading}\setlength{\afterheading}{-4pt}
\newcommand{\numsep}{8pt}
% Outdent section numbers into the left margin:
\newlength{\sectionoutdent}
\newcommand{\numleft}[1]{%
\ifthenelse{\equal{#1}{}}%
{}%
{\setlength{\sectionoutdent}{0pt-\widthof{#1}-8pt}%
\hspace*{\sectionoutdent}}}
% --- Heading definition utility ---
% Define titleformat and titlespacing for a heading level.
% #1 = LaTeX sectioning command (e.g., \section, \chapter)
% #2 = font command (e.g., \fA)
% #3 = counter (e.g., \thesection, \thechapter)
\newcommand{\defineheading}[3]{%
\titlespacing*{name=#1}{0pt}{\beforeheading}{\afterheading}%
\titleformat{name=#1}[block]%
{#2\numleft{#3}}%
{#2#3}%
{\numsep}%
{##1}%
\titlespacing*{name=#1,numberless}{0pt}{\beforeheading}{\afterheading}%
\titleformat{name=#1,numberless}[block]%
{#2}%
{}%
{0pt}%
{##1}%
}
% --- Heading definitions ---
%
% Register \titleformat for the actual LaTeX sectioning commands, not for
% \sA-\sE. When \sA{title} is used in the document, TeX expands \sA to
% \section or \chapter, and titlesec intercepts that command. Formatting
% registered for \sA would never be reached.
% In book structure, chapters start on recto (odd) pages. titlesec
% replaces \chapter's internals and ignores the book class's openright
% default, using \clearpage instead of \cleardoublepage. The
% \chapterbreak hook restores recto-start behavior.
\ifthenelse{\equal{\documentisbook}{true}}{%
\newcommand{\chapterbreak}{\cleardoublepage}
\titleclass{\chapter}{top}
\defineheading{\chapter}{\fA}{\thechapter}
\defineheading{\section}{\fB}{\thesection}
\defineheading{\subsection}{\fC}{\thesubsection}
\defineheading{\subsubsection}{\fD}{\thesubsubsection}
\defineheading{\paragraph}{\fE}{\theparagraph}
}{%
\defineheading{\section}{\fA}{\thesection}
\defineheading{\subsection}{\fB}{\thesubsection}
\defineheading{\subsubsection}{\fC}{\thesubsubsection}
\defineheading{\paragraph}{\fD}{\theparagraph}
\defineheading{\subparagraph}{\fE}{\thesubparagraph}
}
% --- Counter resets ---
\makeatletter
\@addtoreset{paragraph}{section}
\@addtoreset{paragraph}{subsection}
\@addtoreset{paragraph}{subsubsection}
\@addtoreset{subparagraph}{section}
\@addtoreset{subparagraph}{subsection}
\@addtoreset{subparagraph}{subsubsection}
\@addtoreset{subparagraph}{paragraph}
\makeatother
\setcounter{secnumdepth}{6}
\setcounter{tocdepth}{6}
% --- Part ---
\newcounter{partnumber}
\stepcounter{partnumber}
\newcommand{\partspace}{\hspace*{64pt}}
\newcommand{\partindent}[1]{\partspace\large\bfseries #1}

83
sks/section/sty/toc.sty Normal file
View File

@@ -0,0 +1,83 @@
\newlength{\tocindent}
\setlength{\tocindent}{8pt}
\newlength{\tocchaptermargin}
\setlength{\tocchaptermargin}{-72pt}
\newlength{\tocsectionmargin}
\setlength{\tocsectionmargin}{\tocchaptermargin + \tocindent}
\newlength{\tocsubsectionmargin}
\setlength{\tocsubsectionmargin}{\tocsectionmargin + \tocindent}
\newlength{\tocsubsubsectionmargin}
\setlength{\tocsubsubsectionmargin}{\tocsubsectionmargin + \tocindent}
\newlength{\tocparagraphmargin}
\setlength{\tocparagraphmargin}{\tocsubsubsectionmargin + \tocindent}
\newlength{\tocsubparagraphmargin}
\setlength{\tocsubparagraphmargin}{\tocparagraphmargin + \tocindent}
\newlength{\tocdotspacing}
\setlength{\tocdotspacing}{6pt}
% Compensate for outdenting of section titles:
% This has no effect:
\renewcommand{\contentsname}{\sfont{1.4}\hspace*{1em}Contents}
\newcommand{\afternumberspace}{~~}
\newcommand{\numberlabel}{\parbox[b]{64pt}
{\raggedleft\hspace*{8pt}\small\thecontentslabel}}
\renewcommand{\numberlabel}{\hspace*{-1\hoffset}\thecontentslabel\afternumberspace}
\newcommand{\pagenumber}{\parbox{\widthof{888}{\contentspage}}}
\newcommand{\tocpage}{~\titlerule*[\tocdotspacing]{.}
\makebox[\widthof{\thecontentspage}][r]{\small\thecontentspage}}
\newcommand{\interline}{\vspace*{-6pt}}
\titlecontents{chapter}[\tocchaptermargin]
{\vspace{6pt}\thispagestyle{noheader}}
{\numberlabel}
{\hspace*{-12pt}}
{\tocpage}
[\interline]
\titlecontents{section}[\tocsectionmargin]
{\ifthenelse{\equal{\documentisbook}{true}}{}{\vspace{6pt}}}
{\numberlabel}
{\hspace*{-18pt}}
{\tocpage}
[\interline]
\titlecontents{subsection}[\tocsubsectionmargin]
{}
{\numberlabel}
{\hspace*{-24pt}}
{\tocpage}
[\interline]
\titlecontents{subsubsection}[\tocsubsubsectionmargin]
{}
{\numberlabel}
{\hspace*{-30pt}}
{\tocpage}
[\interline]
\titlecontents{paragraph}[\tocparagraphmargin]
{}
{\numberlabel}
{\hspace*{-36pt}}
{\tocpage}
[\interline]
\titlecontents{subparagraph}[\tocsubparagraphmargin]
{}
{\numberlabel}
{\hspace*{-42pt}}
{\tocpage}
[\interline]