]> mj.ucw.cz Git - ucwmac.git/commitdiff
Itemization
authorMartin Mares <mj@ucw.cz>
Sat, 25 Sep 2010 11:21:42 +0000 (13:21 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 9 Oct 2010 11:05:45 +0000 (13:05 +0200)
ucwmac-test.tex [new file with mode: 0644]
ucwmac.tex

diff --git a/ucwmac-test.tex b/ucwmac-test.tex
new file mode 100644 (file)
index 0000000..6786417
--- /dev/null
@@ -0,0 +1,52 @@
+\input ucwmac.tex
+
+\pageunderlay{\placeat{0pt}{0pt}{\crosshair{10pt}}}
+
+\def\hd#1{\bigskip\leftline{\bf #1}\medskip}
+
+\hd{Box placement: ordinary word, vbox, vtop, vhang, vhanglines}
+
+\def\brum{\hbox{Brum}}
+\def\brums{\brum\brum\brum}
+
+\noindent
+\placeat{0pt}{0pt}{\vlap{\hbox to 0.5\hsize{\hrulefill}}}%
+\placeat{0pt}{0pt}{\crosshair{10pt}}%
+\brum{}
+\vbox{\brums}
+\vtop{\brums}
+\vhang{\brums}
+\vhanglines{\brums}
+
+\hd{Itemization}
+
+\noindent An~itemized list:
+
+\itemize\ibull
+\:It is an important and popular fact that things are not always what
+they seem.  For instance, on the planet Earth, man had always assumed
+that he was more intelligent than dolphins because he had achieved so
+much -- the wheel, New York, wars and so on -- whilst all the dolphins
+had ever done was muck about in the water having a good time.  But
+conversely, the dolphins had always believed that they were far more
+intelligent than man -- for precisely the same reasons.
+\:Curiously enough, the dolphins had long known of the impending
+destruction of the of the planet Earth and had made many attempts to
+alert mankind to the danger; but most of their communications were
+misinterpreted\dots{} --- Douglas Addams: HHG
+\:Third:
+       \itemize\istar
+       \:Primus
+       \:Secundus
+       \:Tertius
+       \:Graecus:
+               \numlist\ngreek
+               \:alpha
+               \:beta
+               \:gamma
+               \endlist
+       \endlist
+\:Fourth
+\endlist
+
+\bye
index 881c6dbce2943508f74b724d0f03b6458df21c3b..1afa3d97bed82b5d0ec8c19196118f42aca0d1bc 100644 (file)
 
 \def\wigglepage{\ifodd\pageno\else\advance\hoffset by \evenpageshift\fi}
 
+%%% Itemization %%%
+
+% Default dimensions of itemized lists
+\newdimen\itemindent           \itemindent=0.5in
+\newdimen\itemnarrow           \itemnarrow=0.5in                       % make lines narrower by this amount
+\newskip\itemmarkerskip                \itemmarkerskip=0.4em                   % between marker and the item
+\newskip\preitemizeskip                \preitemizeskip=3pt plus 2pt minus 1pt  % before the list
+\newskip\postitemizeskip       \postitemizeskip=3pt plus 2pt minus 1pt % after the list
+\newskip\interitemskip         \interitemskip=2pt plus 1pt minus 0.5pt % between two items
+
+% Analogues for nested lists
+\newdimen\nesteditemindent     \nesteditemindent=0.25in
+\newdimen\nesteditemnarrow     \nesteditemnarrow=0.25in
+\newskip\prenesteditemizeskip  \prenesteditemizeskip=0pt
+\newskip\postnesteditemizeskip \postnesteditemizeskip=0pt
+
+\newif\ifitems\itemsfalse
+\newbox\itembox
+\newcount\itemcount
+
+\def\preitemize{
+       \ifitems
+               \vskip\prenesteditemizeskip
+               \advance\leftskip by \nesteditemindent
+               \advance\rightskip by \nesteditemnarrow
+       \else
+               \vskip\preitemizeskip
+               \advance\leftskip by \itemindent
+               \advance\rightskip by \itemnarrow
+       \fi
+       \parskip=\interitemskip
+}
+
+\def\postitemize{
+       \ifitems
+               \vskip\postnesteditemizeskip
+       \else
+               \vskip\postitemizeskip
+       \fi
+}
+
+\def\inititemize{\begingroup\preitemize\itemstrue\parindent=0pt}
+
+\def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip\itemmarkerskip}%
+\let\:=\singleitem}
+
+\def\singleitem{\par\leavevmode\copy\itembox}
+
+\def\endlist{\par\endgroup\postitemize}
+
+\def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
+\def\idot{\raise0.2ex\hbox{$\cdot$}}
+\def\istar{\raise0.2ex\hbox{$\ast$}}
+
+\def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
+\let\itemnumbering=#1}
+
+\def\numbereditem{\par\leavevmode\advance\itemcount by 1
+\llap{\itemnumbering\hskip\itemmarkerskip}}
+
+\def\nnorm{\the\itemcount}
+\def\ndotted{\nnorm.}
+\def\nparen{\nnorm)}
+\def\nroman{\romannumeral\itemcount}
+\def\nromanp{\nroman)}
+\def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
+\def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
+\def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
+\zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
+\or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
+
+\def\itm{\:}
+
 %%% Epilog %%%
 
 % Let's hide all internal macros