summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/trimspaces
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-09-18 00:01:50 +0000
committerKarl Berry <karl@freefriends.org>2009-09-18 00:01:50 +0000
commit8508e50c1ba6aedbcc89f9146c9d563478dcd193 (patch)
tree52d837e4a27a8542aee93bd088209c59f9d508ae /Master/texmf-dist/tex/latex/trimspaces
parent84ea92b10d85753f2d44ae4ce9b17d4338c40603 (diff)
new latex package trimspaces (16sep09)
git-svn-id: svn://tug.org/texlive/trunk@15352 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/trimspaces')
-rw-r--r--Master/texmf-dist/tex/latex/trimspaces/trimspaces.sty58
1 files changed, 58 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/trimspaces/trimspaces.sty b/Master/texmf-dist/tex/latex/trimspaces/trimspaces.sty
new file mode 100644
index 00000000000..c4b681c3bd5
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/trimspaces/trimspaces.sty
@@ -0,0 +1,58 @@
+%% LaTeX2e file `trimspaces.sty'
+%% generated by the `filecontents' environment
+%% from source `trimspaces' on 2009/09/17.
+%%
+\ProvidesPackage{trimspaces}[2009/09/17 v1.1
+ Trim spaces around a token list]
+
+% Trimming surrounding spaces:
+\catcode`\Q=3
+\newcommand\trim@spaces[1]{%
+ \romannumeral-`\q\trim@trim@\noexpand#1Q Q%
+}
+\long\def\trim@trim@#1 Q{\trim@trim@@#1Q}
+\long\def\trim@trim@@#1Q#2{#1}
+\catcode`\Q=11
+
+\newcommand\trim@spaces@noexp[1]{%
+ \unexpanded\expandafter\expandafter\expandafter
+ {\trim@spaces{#1}}%
+}
+
+\newcommand\trim@spaces@in[1]{%
+ \edef#1{\expandafter\trim@spaces@noexp\expandafter{#1}}%
+}
+
+% Trimming preceding spaces:
+\newcommand\trim@pre@space[1]{%
+ \romannumeral-`\.\expandafter\noexpand#1%
+}
+
+\newcommand\trim@pre@space@noexp[1]{%
+ \unexpanded\expandafter{%
+ \romannumeral-`\.\expandafter\noexpand#1%
+ }%
+}
+
+\newcommand\trim@pre@space@in[1]{%
+ \expandafter\def\expandafter#1\expandafter{%
+ \romannumeral-`\.\expandafter\noexpand#1%
+ }%
+}
+
+% Trimming trailing space:
+\catcode`\Q=3
+\newcommand\trim@post@space[1]{\trim@trim@#1Q Q}
+\catcode`\Q=11
+
+\newcommand\trim@post@space@noexp[1]{%
+ \unexpanded\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ {\trim@post@space{#1}}%
+}
+
+\newcommand\trim@post@space@in[1]{%
+ \edef#1{\expandafter\trim@post@space@noexp\expandafter{#1}}%
+}
+
+% That's it.