summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-04-25 00:02:06 +0000
committerKarl Berry <karl@freefriends.org>2007-04-25 00:02:06 +0000
commit18113d689eaddf1c57a5bc789f213daa4dfa358b (patch)
tree94eb58e547a98255d2f99ce9410944410bb1f26a
parent3bf9c09996ceea5ec6f6fcb33132626646196685 (diff)
new latex package cmdstring (23apr07)
git-svn-id: svn://tug.org/texlive/trunk@4189 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/tools/tpm-ctan-check2
-rw-r--r--Master/texmf-dist/doc/latex/cmdstring/README14
-rw-r--r--Master/texmf-dist/doc/latex/cmdstring/cmdstring.pdfbin0 -> 357871 bytes
-rw-r--r--Master/texmf-dist/doc/latex/cmdstring/cmdstring.tex121
-rw-r--r--Master/texmf-dist/tex/latex/cmdstring/cmdstring.sty32
-rw-r--r--Master/texmf-dist/tpm/cmdstring.tpm27
-rw-r--r--Master/texmf/lists/cmdstring8
-rw-r--r--Master/texmf/tpm/collection-latexextra.tpm1
8 files changed, 204 insertions, 1 deletions
diff --git a/Build/tools/tpm-ctan-check b/Build/tools/tpm-ctan-check
index da700966c35..e3d09294873 100755
--- a/Build/tools/tpm-ctan-check
+++ b/Build/tools/tpm-ctan-check
@@ -22,7 +22,7 @@ my @WorkingTPM = qw(
caption carlisle cbcoptic ccaption cdpbundl cellspace
changebar chappg chem-journal chemcompounds cherokee circ
citeref cjhebrew classicthesis
- clefval clock clrscode cmdtrack cmll colorinfo
+ clefval clock clrscode cmdstring cmdtrack cmll colorinfo
colortbl commath compactbib complexity comprehensive
computational-complexity cooking cool coollist coolstr cooltooltips
coordsys courier-scaled courseoutline coursepaper coverpage
diff --git a/Master/texmf-dist/doc/latex/cmdstring/README b/Master/texmf-dist/doc/latex/cmdstring/README
new file mode 100644
index 00000000000..30586634e23
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/cmdstring/README
@@ -0,0 +1,14 @@
+For programmers, it is quite common to use the name of a macro (for
+instance `foo' for the macro \foo, in other words, the letters f, o,
+and o). For this purpose, it is customary to call \string which does
+this sort of things... except that it prepends the escape character,
+controlled by the counter \escapechar, in front of the name. The
+traditional way of getting rid of it, is to set \escapechar to -1
+(without forgetting to restore the proper value at the end of the
+process) or to make use of \@gobble. The former has the drawback not
+to be expandible while the second isn't completely reliable. Here we
+extend the expandible methods to make it reliable.
+
+This material is subject to the LaTeX Project Public License.
+See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+for the details of that license.
diff --git a/Master/texmf-dist/doc/latex/cmdstring/cmdstring.pdf b/Master/texmf-dist/doc/latex/cmdstring/cmdstring.pdf
new file mode 100644
index 00000000000..1b61691e456
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/cmdstring/cmdstring.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/cmdstring/cmdstring.tex b/Master/texmf-dist/doc/latex/cmdstring/cmdstring.tex
new file mode 100644
index 00000000000..767c6fe1bb8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/cmdstring/cmdstring.tex
@@ -0,0 +1,121 @@
+\documentclass{article}
+
+\usepackage{etex}
+\usepackage{xifthen}
+\usepackage[ascii]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[warn]{textcomp}
+\usepackage[a4paper, pdftex, margin=1.5in]{geometry}
+\usepackage{lmodern}
+\usepackage{typetex}
+\usepackage{cmdstring}
+\usepackage{microtype}
+\usepackage{xcolor}
+\usepackage{url}
+\usepackage[bottom,hang]{footmisc}
+\usepackage[babel]{csquotes}
+\usepackage[british]{babel}
+\usepackage{hyperref}
+
+\setcounter{secnumdepth}{-\maxdimen}
+
+\newcommand*{\pack}{\textsf}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand*{\setdate}{}
+\def \setdate #1/#2/#3#4{%
+ \year = #1
+ \month = #2
+ \day = #3#4
+}
+
+\makeatletter
+\newcommand*{\getfileinfo}[1]{%
+ \def \filename {#1}%
+ \def \@tempb ##1 ##2 ##3\relax ##4\relax {%
+ \def \filedate {##1}%
+ \def \fileversion {##2}%
+ \def \fileinfo {##3}%
+ }%
+ \edef \@tempa {\csname ver@#1\endcsname}%
+ \expandafter \@tempb \@tempa \relax ? ? \relax \relax
+}
+\makeatother
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\title {The \pack{cmdstring} Package}
+\author {Josselin Noirel}
+\date {%
+ \getfileinfo{cmdstring.sty}
+ \expandafter \setdate \filedate
+ \today\ (\fileversion)}
+
+\begin{document}
+
+\maketitle
+
+\begin{abstract}
+ For programmers, it is quite common to use the \emph{name} of a~macro
+ (for instance `foo' for the macro \cmd{foo}, in other words, the letters
+ \emph{f}, \emph{o}, and~\emph{o}). For this purpose, it is customary
+ to call \cmd{string} which does this sort of things\dots\ except that it
+ prepends the escape character, controlled by the counter \cmd{escapechar},
+ in front of the name. The traditional ways of getting rid of it, is to
+ set \cmd{escapechar} to~$-1$ (without forgetting to restore the proper
+ value at the end of the process) or to make use of \cmd{@gobble}.
+ The former has the drawback not to be expandible while the second isn't
+ completely reliable. Here we extend the expandible methods to make it
+ reliable.
+\end{abstract}
+
+Use this package with
+%
+\begin{texcode}
+\cmd[1]{usepackage}{cmdstring}
+\end{texcode}
+or
+\begin{texcode}
+\cmd[1]{RequirePackage}{cmdstring}
+\end{texcode}
+%
+Then whatever the value of \cmd{escapechar},
+\tex{\cmd{cmdstring} {\meta{command}}} will give correct result. For
+instance `\tex{\cmd{cmdstring}~\cmd{documentclass}}' gives `\cmdstring
+\documentclass'; `\tex{\cmd{cmdstring}~\cmd{\\}}' gives `\cmdstring \\;
+`\tex{\cmd{cmdstring}~\cmd{\SPACE}}' gives `\cmdstring \ ', i.e., the
+command name without the escape~character.
+
+\newpage
+
+A~small test can be performed for all representative values of
+\cmd{escapechar}
+%
+\begin{texcode}
+\cmd{count}255 = -11 \newline
+\cmd{loop} \cmd{escapechar} = \cmd{count}255 \newline
+\ \ [\cmd{cmdstring} \cmd{documentclass}] \newline
+\ \ [\cmd{cmdstring} \cmd{\\}] \newline
+\ \ [\cmd{cmdstring} \cmd{\ }] \newline
+\ \ \cmd{ifnum} \cmd{count}255 < 300 \cmd{advance} \cmd{count}255 by 1 \newline
+\cmd{repeat}
+\end{texcode}
+%
+which gives
+%
+\begin{list}{}{}
+\item \font \tempfonta = ec-lmtt8 at 5pt
+ \tempfonta \baselineskip = 5.5pt \raggedright
+\count255 = -11
+\loop
+ \escapechar = \count255
+ [\cmdstring \documentclass]\nobreak\ %
+ [\cmdstring \\]\nobreak\ %
+ [\mbox{\cmdstring \ }]
+ \ifnum \count255 < 300
+ \advance \count255 by 1
+\repeat \par
+\end{list}
+
+\end{document}
diff --git a/Master/texmf-dist/tex/latex/cmdstring/cmdstring.sty b/Master/texmf-dist/tex/latex/cmdstring/cmdstring.sty
new file mode 100644
index 00000000000..ae9c445692d
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/cmdstring/cmdstring.sty
@@ -0,0 +1,32 @@
+% $Revision: 45 $
+\def \@tempa $#1 #2-#3-#4 #5${#2/#3/#4}
+\edef \filedate {\@tempa $Date: 2007-04-23 20:24:43 +0200 (Mon, 23 Apr 2007) $}
+\def \fileversion {v1.1}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cmdstring}%
+ [\filedate \space \fileversion \space Reliable string (JN)]
+
+\@ifdefinable \@gobblespace
+ {\expandafter \def \expandafter \@gobblespace \space {}}
+
+% v1.1: Modified after a suggestion of DAK
+% Test \escapechar > 255 removed to make the package
+% behave nicely with certain extensions of TeX
+
+\newcommand*{\cmdstring}{%
+ \ifnum \escapechar = 32
+ \expandafter \expandafter
+ \expandafter \@gobblespace
+ \expandafter \string
+ \else
+ \if \string \ \space
+ \expandafter\expandafter\expandafter \string
+ \else
+ \expandafter\expandafter\expandafter \expandafter
+ \expandafter\expandafter\expandafter \@gobble
+ \expandafter\expandafter\expandafter \string
+ \fi
+ \fi
+}
+
+\endinput
diff --git a/Master/texmf-dist/tpm/cmdstring.tpm b/Master/texmf-dist/tpm/cmdstring.tpm
new file mode 100644
index 00000000000..12993c1249b
--- /dev/null
+++ b/Master/texmf-dist/tpm/cmdstring.tpm
@@ -0,0 +1,27 @@
+<!DOCTYPE rdf:RDF SYSTEM "../../support/tpm.dtd">
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:TPM="http://texlive.dante.de/">
+ <rdf:Description about="http://texlive.dante.de/texlive/Package/cmdstring.zip">
+ <TPM:Name>cmdstring</TPM:Name>
+ <TPM:Type>Package</TPM:Type>
+ <TPM:Date>2007/04/23 17:24:00</TPM:Date>
+ <TPM:Version></TPM:Version>
+ <TPM:Creator>karl</TPM:Creator>
+ <TPM:Title>The cmdstring package.</TPM:Title>
+ <TPM:Description></TPM:Description>
+ <TPM:Author></TPM:Author>
+ <TPM:Size>363042</TPM:Size>
+ <TPM:License></TPM:License>
+ <TPM:Build/>
+ <TPM:RunFiles size="1911">
+texmf-dist/tex/latex/cmdstring/cmdstring.sty
+texmf-dist/tpm/cmdstring.tpm
+ </TPM:RunFiles>
+ <TPM:DocFiles size="362099">
+texmf-dist/doc/latex/cmdstring/README
+texmf-dist/doc/latex/cmdstring/cmdstring.pdf
+texmf-dist/doc/latex/cmdstring/cmdstring.tex
+ </TPM:DocFiles>
+ <TPM:Provides>Package/cmdstring</TPM:Provides>
+ </rdf:Description>
+</rdf:RDF>
+
diff --git a/Master/texmf/lists/cmdstring b/Master/texmf/lists/cmdstring
new file mode 100644
index 00000000000..95630eab968
--- /dev/null
+++ b/Master/texmf/lists/cmdstring
@@ -0,0 +1,8 @@
+texmf-dist/doc/latex/cmdstring/README
+texmf-dist/doc/latex/cmdstring/cmdstring.pdf
+texmf-dist/doc/latex/cmdstring/cmdstring.tex
+
+texmf-dist/tex/latex/cmdstring/cmdstring.sty
+texmf-dist/tpm/cmdstring.tpm
+
+texmf/lists/cmdstring
diff --git a/Master/texmf/tpm/collection-latexextra.tpm b/Master/texmf/tpm/collection-latexextra.tpm
index afc4ce6b6d2..79e6e5955ec 100644
--- a/Master/texmf/tpm/collection-latexextra.tpm
+++ b/Master/texmf/tpm/collection-latexextra.tpm
@@ -74,6 +74,7 @@ A large collection of add-on packages for LaTeX.
<TPM:Package name="cjw"/>
<TPM:Package name="clefval"/>
<TPM:Package name="clock"/>
+ <TPM:Package name="cmdstring"/>
<TPM:Package name="cmdtrack"/>
<TPM:Package name="cmsd"/>
<TPM:Package name="codepage"/>