-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllpnatded.sty
More file actions
56 lines (43 loc) · 1.62 KB
/
llpnatded.sty
File metadata and controls
56 lines (43 loc) · 1.62 KB
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
%%% % -*- coding: utf-8 -*-
%%% ----------------------------------------------------------------------------
%%% llpnatded.sty
%%% Typeset LLP-style natural deduction with LaTeX3
%%%
%%% Copyright : 2023 (c) Yang Ming-Tian <i@skylee.xyz>
%%% Repository: https://github.com/skylee03/llpnatded
%%% License : The LaTeX Project Public License 1.3c
%%% ----------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{llpnatded}[2023/10/25 LLP Natural Deduction]
\RequirePackage{expl3}
\RequirePackage{xparse}
\makeatletter
\newlength{\textsize}
\setlength{\textsize}{\f@size pt}
\makeatother
\ExplSyntaxOn
\int_new:N \g_depth_int
\int_new:N \g_maxdepth_int
\tl_new:N \l_row_tl
\NewExpandableDocumentCommand \ndopen {} {
\cline{ \int_eval:n { \g_depth_int + 1 } - \int_eval:n { \g_depth_int + 1 } }
\int_gset:Nn \g_depth_int { \g_depth_int + 1 }
}
\NewExpandableDocumentCommand \ndclose {} {
\cline{ \g_depth_int - \int_eval:n { \g_maxdepth_int + 3 }}
\int_gset:Nn \g_depth_int { \g_depth_int - 1 }
}
\NewExpandableDocumentCommand \ndstep { m m m } {
\prg_replicate:nn { \g_depth_int } { \tl_put_right:Nn \l_row_tl { { \vrule height \textsize } & } }
\prg_replicate:nn { \g_maxdepth_int - \g_depth_int }{ \tl_put_right:Nn \l_row_tl { & } }
\tl_put_right:Nn \l_row_tl { #1 \tl_if_empty:nTF {#1} {} { . } & #2 & #3 \\ }
\l_row_tl
}
\NewDocumentEnvironment { nd } { m } {
\int_gset:Nn \g_maxdepth_int #1
\begin{displaymath}\begin{array}{ \prg_replicate:nn { \g_maxdepth_int } { @{}p{.6em}@{} } rcl }
}{
\end{array}\end{displaymath}
}
\ExplSyntaxOff
\endinput