summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-03-13 23:47:26 +0000
committerKarl Berry <karl@freefriends.org>2007-03-13 23:47:26 +0000
commit9f788918f4e0a58fe14ab233810562a8bd517bc0 (patch)
tree20cad4419d00e637be5de205bf91ba434c0f949a /Master/texmf-dist/source/latex
parent7528bed5b6dc85d8d97044a2ad1ea49a55b96a90 (diff)
syntrace update (13mar07)
git-svn-id: svn://tug.org/texlive/trunk@4031 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/syntrace/syntrace.dtx141
1 files changed, 102 insertions, 39 deletions
diff --git a/Master/texmf-dist/source/latex/syntrace/syntrace.dtx b/Master/texmf-dist/source/latex/syntrace/syntrace.dtx
index 653603b1a28..cb65d15a9bb 100644
--- a/Master/texmf-dist/source/latex/syntrace/syntrace.dtx
+++ b/Master/texmf-dist/source/latex/syntrace/syntrace.dtx
@@ -21,13 +21,37 @@
% \fi
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
-%<package>\ProvidesPackage{syntrace}[2006/08/13 v1.0 Package for dealing with trace in synttree]
+%<package>\ProvidesPackage{syntrace}[2006/08/17 v1.1 Package for dealing with trace in syntaxic tree]
%<package>\RequirePackage{ifthen}
-%<package>\RequirePackage{synttree}
+%<package>\DeclareOption{synttree}{
+%<package>\AtEndOfPackage{%
+%<package>\IfFileExists{synttree.sty}{%
+%<package>\RequirePackage{synttree}\syntraceaddresetmacro{synttree}%
+%<package>}{%
+%<package>\PackageWarning{syntrace}{Unable to locate synttree package}
+%<package>}
+%<package>}
+%<package>}
+%<package>\DeclareOption{qtree}{
+%<package>\AtEndOfPackage{%
+%<package>\IfFileExists{qtree.sty}{%
+%<package>\RequirePackage{qtree}\syntraceaddresetmacro{Tree}%
+%<package>}{%
+%<package>\PackageWarning{syntrace}{Unable to locate qtree package}
+%<package>}
+%<package>}
+%<package>}
+%<package>\DeclareOption{i-start}{
+%<package>\AtEndOfPackage{%
+%<package>\setcounter{syntrace@startvalue}{8}
+%<package>}
+%<package>}
+%<package>\ExecuteOptions{synttree}
+%<package>\ProcessOptions
%
%<*driver>
\documentclass{ltxdoc}
-\usepackage{syntrace}
+\usepackage[qtree,i-start]{syntrace}
\usepackage{verbatim}
\EnableCrossrefs
\CodelineIndex
@@ -47,19 +71,27 @@
% This file describe the \textsf{syntrace} package. This package is intended for \LaTeX\ users who must deal with
% traces in synttree.
% \end{abstract}
+%
+% \section{Options}
+%
+% \DescribeMacro{synttree} The |synttree| option add the synttree command of the synttree package to the auto reset commands. With this option, the |\synttree| command is redefined to auto reset trace counter. A |\synttree*| command is add that work like |\synttree|, but without auto reset. This option is enabled is a default options.
+%
+% \DescribeMacro{qtree} The |qtree| option add the Tree command of the qtree package to the auto reset command.
+%
+% \DescribeMacro{i-start} The |i-start| change the first label of trace to i instance of a.
%
% \section{Usage}
% The \textsf{syntrace} package add a way to deal with trace in tree produce using the \textsf{synttree} package.
%
-% \DescribeMacro{\traceLabel} The |\traceLabel{label}| set and draw a start trace. The parameter is the label to use for
+% \DescribeMacro{\traceLabel} The |\traceLabel{label}| set and draw a end trace. The parameter is the label to use for
% the reference.
%
% \DescribeMacro{\traceReference} The |\traceReference{ref}| draw a trace linked with the specified reference.
%
-% \DescribeMacro{\synttree} The |\synttree| is redefined to auto reset the counter of trace at the start of a tree. The |\synttree*| work as the standard |\synttree| command (without auto reseting the counter).
+% \DescribeMacro{\syntraceresetmacro} The |\syntraceresetmacro{commande name without slash}| add auto-reset to this command.
%
% \section{Examples}
-% \subsection{Simply example}
+% \subsection{Simply example with synttree}
% \begin{verbatim}
% \synttree[A %
% [B [C\traceLabel{l1}] [D]] %
@@ -70,39 +102,45 @@
% [B [C\traceLabel{l1}] [D]] %
% [E [F] [\traceReference{l1}]]%
% ]
-% \subsection{One complexe example}
+% \subsection{One complex example with synttree}
% \begin{verbatim}
-% \synttree[AgrP
-% [\traceReference{sujet1}]
-% [Agr'
-% [Arg [\traceReference{verbe1}]]
-% [TP
-% [T'
-% [T [\traceReference{verbe1}]]
-% [VP
-% [DP\traceLabel{sujet1} [.t Le chat]]
-% [V' [V [dort\traceLabel{verbe1}]]]
+% \synttree*[AgrP
+% [DP\traceLabel{sujet1} [.t Le chat]]
+% [Agr'
+% [Arg [dort\traceLabel{verbe1}]]
+% [TP
+% [T'
+% [T [\traceReference{verbe1}]]
+% [VP
+% [\traceReference{sujet1}]
+% [V' [V [\traceReference{verbe1}]]]
+% ]
% ]
% ]
% ]
% ]
-% ]
% \end{verbatim}
-% \synttree[AgrP
-% [\traceReference{sujet1}]
-% [Agr'
-% [Arg [\traceReference{verbe1}]]
-% [TP
-% [T'
-% [T [\traceReference{verbe1}]]
-% [VP
-% [DP\traceLabel{sujet1} [.t Le chat]]
-% [V' [V [dort\traceLabel{verbe1}]]]
+% \synttree*[AgrP
+% [DP\traceLabel{sujet1} [.t Le chat]]
+% [Agr'
+% [Arg [dort\traceLabel{verbe1}]]
+% [TP
+% [T'
+% [T [\traceReference{verbe1}]]
+% [VP
+% [\traceReference{sujet1}]
+% [V' [V [\traceReference{verbe1}]]]
+% ]
% ]
% ]
% ]
% ]
-% ]
+% \subsection{One example with qtree}
+% \syntraceaddresetmacro{Tree}
+% \begin{verbatim}
+% \Tree [.S [.NP subject\traceLabel{s1} ] [.VP [.V verb ] [.NP \traceReference{s1} ]]]
+% \end{verbatim}
+% \Tree [.S [.NP subject\traceLabel{s1} ] [.VP [.V verb ] [.NP \traceReference{s1} ]]]
% \section{Implementation}
%
% \begin{macro}{syntrace@startvalue}
@@ -169,20 +207,45 @@
}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{synttree}
-% This macro add the autoreset to the synttree command
+% \begin{macro}{\syntraceaddresetmacro}
+% This macro add autoreset to a command and add a starred version to this command that have the default functionnality
% \begin{macrocode}
-\let\syntrace@syntree=\synttree
-\def\synttree{\@ifstar%
- \syntrace@syntree%
- \syntree@star%
+\newcommand*{\syntraceaddresetmacro}[1]{%
+ \expandafter\ifx%
+ \csname syntrace@old@#1\endcsname
+ \relax%
+ \PackageInfo{syntrace}{Adding auto-reset to #1}%
+ \expandafter\let\csname syntrace@old@#1\expandafter\endcsname%
+ \csname #1\endcsname%
+ \expandafter\def\csname#1\endcsname{\@ifstar{%
+ \csname syntrace@old@#1\endcsname%
+ }{%
+ \syntrace@reset%
+ \csname syntrace@old@#1\endcsname%
+ }%
+ }%
+ \else
+ \PackageWarning{syntrace}{#1 allready set as auto-reset}%
+ \fi
}
-\def\syntree@star{%
- \syntrace@reset%
- \syntrace@syntree%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\syntraceremoveresetmacro}
+% This macro remove autoreset to a command
+% \begin{macrocode}
+\newcommand*{\syntraceremoveresetmacro}[1]{%
+ \expandafter\ifx%
+ \csname syntrace@old@#1\endcsname
+ \relax%
+ \PackageWarning{syntrace}{#1 is not set as auto-reset}%
+ \else
+ \PackageInfo{syntrace}{Removing auto-reset from #1}%
+ \expandafter\let\csname #1\expandafter\endcsname%
+ \csname syntrace@old@#1\endcsname%
+ \expandafter\let\csname syntrace@old@#1\expandafter\endcsname\relax%
+ \fi
}
% \end{macrocode}
% \end{macro}
% \Finale
-
\endinput \ No newline at end of file