From 4ea9595c9cb9aab0a87e4fec643b0268c77bdd09 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 15 May 2016 15:30:11 +0000
Subject: zhspacing from.tds.zip

git-svn-id: svn://tug.org/texlive/trunk@41145 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/generic/zhspacing/zhsusefulmacros.sty      | 97 ++++++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 Master/texmf-dist/tex/generic/zhspacing/zhsusefulmacros.sty

(limited to 'Master/texmf-dist/tex/generic/zhspacing/zhsusefulmacros.sty')

diff --git a/Master/texmf-dist/tex/generic/zhspacing/zhsusefulmacros.sty b/Master/texmf-dist/tex/generic/zhspacing/zhsusefulmacros.sty
new file mode 100644
index 00000000000..d6c5fec5b8a
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/zhspacing/zhsusefulmacros.sty
@@ -0,0 +1,97 @@
+%	zhsusefulmacros.sty
+%	This file provides several useful LaTeX macros as well as \ifLaTeX@e,
+%	and \futurenonspacelet.
+%	Licensed under LPPL.
+\catcode`\@=11
+\ifx\@usefulmacros@defined\@undefined\else
+  \expandafter\endinput
+\fi
+\def\@usefulmacros@defined{\relax}
+\def\@usefulmacros@LaTeX@e{LaTeX2e}
+\def\ifLaTeX@e{\ifx\fmtname\@usefulmacros@LaTeX@e}
+\ifLaTeX@e\else
+\def\@nnil{\@nil}%
+\def\@empty{}%
+\def\@fornoop#1\@@#2#3{}%
+\long\def\@for#1:=#2\do#3{%
+  \expandafter\def\expandafter\@fortmp\expandafter{#2}%
+  \ifx\@fortmp\@empty \else
+    \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi}%
+\long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
+       #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi}%
+\long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
+       \expandafter\@fornoop \else
+      #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}}%
+\def\@tfor#1:={\@tf@r#1 }%
+\long\def\@tf@r#1#2\do#3{\def\@fortmp{#2}\ifx\@fortmp\space\else
+    \@tforloop#2\@nil\@nil\@@#1{#3}\fi}%
+\long\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
+       \expandafter\@fornoop \else
+      #4\relax\expandafter\@tforloop\fi#2\@@#3{#4}}%
+\long\def\@ifnextchar#1#2#3{%
+  \let\reserved@d=#1%
+  \def\reserved@a{#2}%
+  \def\reserved@b{#3}%
+  \futurelet\@let@token\@ifnch}
+\def\@ifnch{%
+  \ifx\@let@token\@sptoken
+    \let\reserved@c\@xifnch
+  \else
+    \ifx\@let@token\reserved@d
+      \let\reserved@c\reserved@a
+    \else
+      \let\reserved@c\reserved@b
+    \fi
+  \fi
+  \reserved@c}
+\def\:{\let\@sptoken= } \:  % this makes \@sptoken a space token
+\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch}
+%
+\long\def\@firstoftwo#1#2{#1}
+\long\def\@secondoftwo#1#2{#2}
+\expandafter\ifx\csname ifcsname\endcsname\relax
+\def\@ifundefined#1{%
+  \expandafter\ifx\csname#1\endcsname\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi}
+\else
+\def\@ifundefined#1{%
+  \unless\ifcsname#1\endcsname
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi}
+\fi
+%
+\def\@namedef#1{\expandafter\def\csname #1\endcsname}
+%
+\fi % end of \ifLaTeX@e\else
+
+\def\@BTcs{}
+\let\nexttoken\relax
+\let\next\relax
+\def\futurenonspacelet#1{\def\@BTcs{#1}%
+   \afterassignment\@BTfnslone\let\nexttoken= }
+\def\@BTfnslone{\expandafter\futurelet\@BTcs\@BTfnsltwo}
+\def\@BTfnsltwo{\expandafter\ifx\@BTcs\@sptoken\let\next=\@BTfnslthree
+   \else\let\next=\nexttoken\fi \next}
+\def\@BTfnslthree{\afterassignment\@BTfnslone\let\next= }
+
+\ifx\fbox\@undefined
+\newbox\fbox@tmpbox
+\newdimen\fbox@linewidth
+\newdimen\fbox@tmpdim
+\fbox@linewidth=0.4pt
+\long\def\fbox#1{%
+  \setbox\fbox@tmpbox=\hbox{#1}%
+  \fbox@tmpdim=2\fbox@linewidth
+  \advance\fbox@tmpdim\wd\fbox@tmpbox
+  \leavevmode\hbox{\vbox{\hrule height \fbox@linewidth width \fbox@tmpdim
+  \hbox{\vrule width \fbox@linewidth height \ht\fbox@tmpbox
+  #1\vrule width \fbox@linewidth height \ht\fbox@tmpbox}%
+  \hrule height \fbox@linewidth width \fbox@tmpdim
+  }}%
+}
+\fi
-- 
cgit v1.2.3

