-
Notifications
You must be signed in to change notification settings - Fork 0
/
itemize_md.tex
54 lines (51 loc) · 1.1 KB
/
itemize_md.tex
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
\def\+{+}
\makeatletter
\catcode`\ =12\let\@nl@space= \catcode`\ =10
\newcount\@nl@rlevel
\newcount\@nl@llevel
\@nl@llevel=-1
\def\@nl{%
\catcode`\ =12
\global\@nl@rlevel=0
\futurelet\@nl@store\@nl@%
}
\def\@nl@gobble#1{\futurelet\@nl@store\@nl@}
\def\@nl@enditemize{
\ifnum\the\@nl@rlevel<\the\@nl@llevel%
\end{itemize}%
\egroup%
\expandafter\@nl@enditemize%
\else%
\ifnum\the\@nl@rlevel=\the\@nl@llevel\else%
\errmessage{Error: inconsistent identation}
\fi%
\fi%
}
\def\@nl@{%
\ifx\@nl@store\@nl@space%
\global\advance\@nl@rlevel by 1
\expandafter\@nl@gobble%
\else%
\catcode`\ =10
\ifx\@nl@store+%
\ifnum\the\@nl@rlevel>\the\@nl@llevel%
\bgroup%
\@nl@llevel=\the\@nl@rlevel
\begin{itemize}%
\fi%
\@nl@enditemize%
\item \expandafter\expandafter\expandafter\@gobble%
\else%
\ifx\@nl@store\@nl%
\global\@nl@rlevel=-1\relax\@nl@enditemize\par
\else\space\fi%
\fi%
\fi%
}
\catcode`\^^M=\active%
\AtBeginDocument{%
\catcode`\^^M=\active%
\let^^M=\@nl%
}%
\catcode`\^^M=5
\makeatother