summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/coolfn/coolfn.sty
blob: f3f83b5889df481d444e4605636709fafd1d0e22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
\def\coolfnversionnumber{1.2.2}
\ProvidesPackage{coolfn}
[2023/11/16\coolfnversionnumber\
 A cool way to format footnotes]
% This work may be distributed and/or modified under the 
% conditions of the LaTeX Project Public License, either version 1.3c 
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Elijah Z Granet

%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FOOTNOTES
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% from https://tex.stackexchange.com/questions/305033/
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[bottom]{footmisc}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% multi paragraph footnotes
% are inherently pretty bad 
% but they happen in law
% so might as well deal with them? so a slight spacing to compensate
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{Parskip}{%
   \par
   \parskip=0.25\baselineskip \advance\parskip by 0pt plus 1pt
   \parindent=\z@
   \def\@listI{\leftmargin\leftmargini
      \topsep\z@ \parsep\parskip \itemsep\z@}
   \let\@listi\@listI
   \@listi
   \def\@listii{\leftmargin\leftmarginii
      \labelwidth\leftmarginii\advance\labelwidth-\labelsep
      \topsep\z@ \parsep\parskip \itemsep\z@}
   \def\@listiii{\leftmargin\leftmarginiii
       \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
       \topsep\z@ \parsep\parskip \itemsep\z@}
   \partopsep=\z@
}{\par}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\fnindent}{1em}
\usepackage{calc}% for maths
\newlength{\lengtha}
\setlength{\lengtha}{\textwidth}
\newlength{\lengthb}%maths again
\newlength{\lengthc}

\setlength{\lengthc}{\fnindent}
\setlength{\lengthb}{1.25\lengthc}%parblock

\makeatletter
\@ifclassloaded{memoir}{
}{
\usepackage{hanging}
}
\makeatother
  % for hanging paragraphs
\renewcommand\footnoterule{}
% ^ no one wants a rule sep for FN!
\AtBeginDocument{\flushbottom}
%^just to be safe 
\makeatletter
\long\def\@makefntext#1{\leavevmode
  \@makefnmark\nobreak
  #1%
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the magic
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
 \renewcommand{\@makefntext}[1]{%
\begin{minipage}[t]{\lengthb}%
\noindent\normalfont%
\@thefnmark%

\end{minipage}%
\begin{minipage}[t]{\textwidth-\lengthb}%
\begin{Parskip}\begin{hangparas}{\lengthc}{1}
\noindent#1\end{hangparas}\end{Parskip}%
\end{minipage}%
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%