From 4410259cca365e9db37ad702454b642b12aa027f Mon Sep 17 00:00:00 2001 From: mirabilos <thorsten.glaser@teckids.org> Date: Wed, 15 May 2019 02:27:24 +0200 Subject: [PATCH] bibliography for KOMA-Script auto-sizing itself by largest entry --- teckids2jahresbericht.cls | 4 ++-- teckids2proto.cls | 4 ++-- teckids2pubmat.cls | 6 +++--- teckids2style.sty | 23 ++++++++++++++++++++++- teckids2urkunde.cls | 4 ++-- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/teckids2jahresbericht.cls b/teckids2jahresbericht.cls index 1c83415..b65409e 100644 --- a/teckids2jahresbericht.cls +++ b/teckids2jahresbericht.cls @@ -19,11 +19,11 @@ % of said person’s immediate fault when using the work as intended. \NeedsTeXFormat{LaTeX2e}% -\ProvidesClass{teckids2jahresbericht}[2019/05/14 1.2 Teckids Jahresbericht class]% +\ProvidesClass{teckids2jahresbericht}[2019/05/15 1.2 Teckids Jahresbericht class]% \PassOptionsToPackage{paper=a4}{typearea}% \RequirePackage{fancyhdr}% -\LoadClass[toc=sectionentrywithdots]{scrartcl}% +\LoadClass[bibliography=totocnumbered,bibliography=leveldown,toc=sectionentrywithdots]{scrartcl}% \RequirePackage{teckids2style}% \RequirePackage{tikz}% diff --git a/teckids2proto.cls b/teckids2proto.cls index 7d062d5..f108583 100644 --- a/teckids2proto.cls +++ b/teckids2proto.cls @@ -19,11 +19,11 @@ % of said person’s immediate fault when using the work as intended. \NeedsTeXFormat{LaTeX2e}% -\ProvidesClass{teckids2proto}[2019/05/14 0.2 Teckids Protokoll TeX/LaTeX class, second epoch]% +\ProvidesClass{teckids2proto}[2019/05/15 0.2 Teckids Protokoll TeX/LaTeX class, second epoch]% \PassOptionsToPackage{paper=a4}{typearea}% \RequirePackage{fancyhdr}% -\LoadClass[toc=sectionentrywithdots]{scrartcl}% +\LoadClass[bibliography=totocnumbered,bibliography=leveldown,toc=sectionentrywithdots]{scrartcl}% \RequirePackage{teckids2style}% \newcommand{\teckidsprotohdr}[1]{% diff --git a/teckids2pubmat.cls b/teckids2pubmat.cls index 652dc00..c59bc76 100644 --- a/teckids2pubmat.cls +++ b/teckids2pubmat.cls @@ -1,6 +1,6 @@ % Dokumentklasse „Unterrichtsmaterial 2.0“ für den Teckids e.V. % -% Copyright © 2015, 2017, 2018 +% Copyright © 2015, 2017, 2018, 2019 % Thorsten Glaser <thorsten.glaser@teckids.org> % Copyright © 2013 % Dominik George <nik@naturalnet.de> @@ -21,11 +21,11 @@ % of said person’s immediate fault when using the work as intended. \NeedsTeXFormat{LaTeX2e}% -\ProvidesClass{teckids2pubmat}[2019/05/14 1.4 Teckids OER TeX/LaTeX class, second epoch]% +\ProvidesClass{teckids2pubmat}[2019/05/15 1.4 Teckids OER TeX/LaTeX class, second epoch]% \PassOptionsToPackage{paper=a4}{typearea}% \RequirePackage{fancyhdr}% -\LoadClass[toc=sectionentrywithdots]{scrartcl}% +\LoadClass[bibliography=totocnumbered,bibliography=leveldown,toc=sectionentrywithdots]{scrartcl}% \RequirePackage{teckids2style}% \newcommand{\teckidspubmatnamegroup}{% diff --git a/teckids2style.sty b/teckids2style.sty index 0eeff0d..4a78a10 100644 --- a/teckids2style.sty +++ b/teckids2style.sty @@ -31,7 +31,7 @@ % • (em dash) → \dash \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{teckids2style}[2019/05/14 1.12 Teckids TeX/LaTeX style, second epoch]% for Tₑχ/LᴬTᴇΧ +\ProvidesPackage{teckids2style}[2019/05/15 1.14 Teckids TeX/LaTeX style, second epoch]% for Tₑχ/LᴬTᴇΧ \RequirePackage{accsupp}% \RequirePackage[utf8]{inputenc}% @@ -468,5 +468,26 @@ \begin{minipage}[c]{.4\linewidth}\teckidslogo[\linewidth]\end{minipage} }% +% use \begin{autosizedbibliography} +% to auto-detect the widest reference label +\gdef\bibitem@longest{1}% +\AtEndDocument{\immediate\write\@auxout{\gdef\noexpand\bibitem@longest{\bibitem@longest}}}% +\newenvironment{autosizedbibliography}{% + \begin{thebibliography}{\bibitem@longest}% +}{% + \end{thebibliography}% +}% +\let\bibitem@stock\bibitem% +\newcommand{\bibitem@sizer}[2][]{% + \settowidth\@tempdimb{\@biblabel{#1}}% + \settowidth\@tempdima{\@biblabel{\bibitem@longest}}% + \ifdim\@tempdima<\@tempdimb% + \gdef\bibitem@longest{#1}% + \fi% + \bibitem@stock[#1]{#2}% +}% +% now \bibitem{foo} = \bibitem[foo]{foo} +\renewcommand{\bibitem}{\@dblarg\bibitem@sizer}% + % uncomment to figure out overfull hbox %\overfullrule=2cm diff --git a/teckids2urkunde.cls b/teckids2urkunde.cls index 4945953..41a9bec 100644 --- a/teckids2urkunde.cls +++ b/teckids2urkunde.cls @@ -19,11 +19,11 @@ % of said person’s immediate fault when using the work as intended. \NeedsTeXFormat{LaTeX2e}% -\ProvidesClass{teckids2jahresbericht}[2019/05/14 1.1 Teckids Urkunde class]% +\ProvidesClass{teckids2jahresbericht}[2019/05/15 1.1 Teckids Urkunde class]% \PassOptionsToPackage{paper=a4}{typearea}% \RequirePackage{fancyhdr}% -\LoadClass[toc=sectionentrywithdots]{scrartcl}% +\LoadClass[bibliography=totocnumbered,bibliography=leveldown,toc=sectionentrywithdots]{scrartcl}% \RequirePackage{teckids2style}% \teckidsgeometry[hmargin=2cm,top=0.5cm]% -- GitLab