3
0
Fork 0
mirror of https://github.com/fsr/nopanic synced 2024-11-15 00:43:12 +01:00

put macros in separate command, introduce \bafog → BAföG

This commit is contained in:
Peter Nerlich 2021-09-18 00:02:46 +02:00
parent 0b5e192adb
commit 981e19ff49
3 changed files with 39 additions and 37 deletions

37
macros.tex Normal file
View file

@ -0,0 +1,37 @@
\newcommand{\ascii}{{\texttt{ascii}}}
\newcommand{\bafog}{BAföG}
\newcounter{linkcounter}
\newcommand\linklist{}
\makeatletter
\def\@breaklinklistat{22}
\def\@breaklinklistandat{54}
\newcommand{\link}[1]{%
\edef\tmptoken{\detokenize{#1}}%
\@ifundefined{nopanic@link@\tmptoken}{%
\edef\@linknumber{\arabic{linkcounter}}%
\protected@edef\@tmpkey{{\fontsize{9pt}{0}\selectfont\keys{\@linknumber}}}%
\expandafter\global\expandafter\edef\csname nopanic@link@\tmptoken\endcsname{\arabic{linkcounter}}%
%
% Standard print output:
\expandafter\g@addto@macro\expandafter\linklist\expandafter{\@tmpkey & \url{#1}}%
\ifx\@breaklinklistat\@linknumber
\g@addto@macro\linklist{\\}%
\else
\ifx\@breaklinklistandat\@linknumber
\g@addto@macro\linklist{\\}%
\else
\g@addto@macro\linklist{\\*}%
\fi
\fi
%
% Link system output:
\immediate\write\linklistfile{RewriteRule "^\@linknumber$" "#1"}%
%
\stepcounter{linkcounter}%
}{%
\protected@edef\@tmpkey{{\fontsize{9pt}{0}\selectfont\keys{\csname nopanic@link@\tmptoken\endcsname}}}%
}%
\href{#1}{\@tmpkey}%
}
\makeatother

View file

@ -17,44 +17,11 @@
\input{preamble.tex}
\input{macros.tex}
% we need this dummy counter to make a label at the spieleabendplakat
\newcounter{dummy}
\newcounter{linkcounter}
\newcommand\linklist{}
\makeatletter
\def\@breaklinklistat{22}
\def\@breaklinklistandat{54}
\newcommand{\link}[1]{%
\edef\tmptoken{\detokenize{#1}}%
\@ifundefined{nopanic@link@\tmptoken}{%
\edef\@linknumber{\arabic{linkcounter}}%
\protected@edef\@tmpkey{{\fontsize{9pt}{0}\selectfont\keys{\@linknumber}}}%
\expandafter\global\expandafter\edef\csname nopanic@link@\tmptoken\endcsname{\arabic{linkcounter}}%
%
% Standard print output:
\expandafter\g@addto@macro\expandafter\linklist\expandafter{\@tmpkey & \url{#1}}%
\ifx\@breaklinklistat\@linknumber
\g@addto@macro\linklist{\\}%
\else
\ifx\@breaklinklistandat\@linknumber
\g@addto@macro\linklist{\\}%
\else
\g@addto@macro\linklist{\\*}%
\fi
\fi
%
% Link system output:
\immediate\write\linklistfile{RewriteRule "^\@linknumber$" "#1"}%
%
\stepcounter{linkcounter}%
}{%
\protected@edef\@tmpkey{{\fontsize{9pt}{0}\selectfont\keys{\csname nopanic@link@\tmptoken\endcsname}}}%
}%
\href{#1}{\@tmpkey}%
}
\makeatother
\sloppy % forces "ugly" line breaks
\pagestyle{plain}

View file

@ -71,5 +71,3 @@
\addtokomafont{disposition}{\normalfont\fontspec{Open Sans}}
\defaultfontfeatures{Ligatures=TeX} % enable ligatures (e.g. --) for new fonts
\newcommand{\ascii}{{\texttt{ascii}}}