]> mj.ucw.cz Git - ucwmac.git/blobdiff - ucwmac2.tex
Released v1.99.1.
[ucwmac.git] / ucwmac2.tex
index e7c48e8287cdd64668dc1a59c42a210e01627f8a..cb713d962067386d8c7bbe5594187e56eb8426d9 100644 (file)
@@ -24,7 +24,7 @@
        \pdfpkresolution=600    % Provide a reasonable default
 \fi\fi
 
-\ifx\directlua\undefined\else
+\ifx\luatexversion\undefined\else
        % In LuaTeX \pdfpkresolution is not enough
        \directlua{kpse.init_prog("luatex", 600, "ljfour")}
 \fi
 \def\sdef#1{\expandafter\def\csname#1\endcsname}
 \def\slet#1#2{\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname}
 
+% Assign a control sequence given as a string, complain if it is not defined.
+\def\sget#1#2{\ifcsname#2\endcsname
+               \expandafter\let\expandafter#1\csname#2\endcsname
+       \else
+               \errmessage{Undefined control sequence #2}%
+               \let#1\relax
+       \fi
+}
+
 % Add \protected to an existing macro
 \def\addprotected#1{\protected\edef#1{\expandafter\unexpanded\expandafter{#1}}}
 
@@ -57,8 +66,9 @@
 % If you modify these registers, call \setuppage afterwards
 \ifx\luatexversion\undefined
        % In LuaTeX, \pagewidth and \pageheight are primitive
-       \newdimen\pagewidth
-       \newdimen\pageheight
+       % (also, we need \csname here, because \newdimen is \outer)
+       \csname newdimen\endcsname\pagewidth
+       \csname newdimen\endcsname\pageheight
 \fi
 \newdimen\leftmargin
 \newdimen\rightmargin
 \def\liststyle#1{%
        \edef\markertmp{#1}
        \ifcsname item:\markertmp\endcsname
-               \slet{listmarker}{item:\markertmp}%
+               \sget\listmarker{item:\markertmp}%
        \else
-               \slet{listmarker}{metaitem:\markertometa#1^^X}%
-               \slet{markerinner}{item:\markertoinner#1^^X}%
+               \sget\listmarker{metaitem:\markertometa#1^^X}%
+               \sget\markerinner{item:\markertoinner#1^^X}%
        \fi
 }
 
        \fi
 }
 
+\def\endlist{\par\endgroup\postitemize}
+
+% List styles
+\sdef{item:o}{\raise0.2ex\hbox{$\bullet$}}
+\sdef{item:O}{\raise0.2ex\hbox{$\circ$}}
+\sdef{item:*}{\raise0.2ex\hbox{$\ast$}}
+\sdef{item:-}{--}
+\sdef{item:.}{\raise0.2ex\hbox{$\cdot$}}
+\sdef{item:n}{\the\itemcount}
+\sdef{item:i}{\romannumeral\itemcount}
+\sdef{item:I}{\uppercase\expandafter{\romannumeral\itemcount}}
+\sdef{item:a}{\char\numexpr 96+\itemcount\relax}
+\sdef{item:A}{\char\numexpr 64+\itemcount\relax}
+\sdef{item:g}{$\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$}
+
+% List meta-styles
+\sdef{metaitem:=.}{\markerinner.}
+\sdef{metaitem:=)}{\markerinner)}
+\sdef{metaitem:(=)}{(\markerinner)}
+
+% Old-style lists
+
 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip\itemmarkerskip}%
 \let\:=\singleitem}
 
 \def\singleitem{\par\leavevmode\copy\itembox\ignorespaces}
 
-\def\endlist{\par\endgroup\postitemize}
-
-% Markers for \itemize
-\def\ibull{\raise0.2ex\hbox{$\bullet$}}
-\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}\ignorespaces}
 
-% Numbering styles for \numlist
+% Old-style markers
+
+\def\ibull{\raise0.2ex\hbox{$\bullet$}}
+\def\idot{\raise0.2ex\hbox{$\cdot$}}
+\def\istar{\raise0.2ex\hbox{$\ast$}}
+
 \def\nnorm{\the\itemcount}
 \def\ndotted{\nnorm.}
 \def\nparen{\nnorm)}
 \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$)}
 
-% List styles
-\sdef{item:o}{\raise0.2ex\hbox{$\bullet$}}
-\sdef{item:O}{\raise0.2ex\hbox{$\circ$}}
-\sdef{item:*}{\raise0.2ex\hbox{$\ast$}}
-\sdef{item:-}{--}
-\sdef{item:.}{\raise0.2ex\hbox{$\cdot$}}
-\sdef{item:n}{\the\itemcount}
-\sdef{item:i}{\romannumeral\itemcount}
-\sdef{item:I}{\uppercase\expandafter{\romannumeral\itemcount}}
-\sdef{item:a}{\char\numexpr 96+\itemcount\relax}
-\sdef{item:A}{\char\numexpr 64+\itemcount\relax}
-\sdef{item:g}{$\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$}
-
-% List meta-styles
-\sdef{metaitem:=.}{\markerinner.}
-\sdef{metaitem:=)}{\markerinner)}
-\sdef{metaitem:(=)}{(\markerinner)}
-
 %%% Miscellanea %%%
 
 % {\I italic} with automatic italic correction