3
0
Fork 0
mirror of https://github.com/fsr/nopanic synced 2024-11-15 17:03:13 +01:00
nopanic/macros.tex
2023-09-20 16:12:36 +02:00

50 lines
1.6 KiB
TeX

\newcommand{\eseyear}{2023}
\newcommand{\ascii}{{\texttt{ascii}}}
\newcommand{\bafog}{BAföG}
\newcommand{\fancypageref}[1] {%
\changemenucolor{gray}{br}{named}{ese_bg_color}%
\changemenucolor{gray}{txt}{named}{ese_bg_color}%
\keys{Seite \pageref{#1}}%
\changemenucolor{gray}{br}{named}{ese_bg_color}%
\changemenucolor{gray}{txt}{named}{ese_bg_color}%
}
\newcounter{linkcounter}
\newcommand\linklist{}
\makeatletter
\def\@breaklinklistat{21}
\def\@breaklinklistandat{56}
\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" [NE,R,L]}%
%
\stepcounter{linkcounter}%
}{%
\protected@edef\@tmpkey{{\fontsize{9pt}{0}\selectfont\keys{\csname nopanic@link@\tmptoken\endcsname}}}%
}%
\href{#1}{\@tmpkey}%
}
\makeatother
\def\modulo#1#2{\ifnum#1=0 0\else(#1-#2*((2*#1-#2)/(2*#2)))\fi}