diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:08:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:08:24 +0000 |
commit | 4088113460d3f3ed4e7ed6d70c6f386e7d5231e1 (patch) | |
tree | cc5afbca5e804c9d14cf5047f1778aec1a531704 /Master/texmf-dist/tex/latex | |
parent | 51c9c1de791ccba9b422f218fe9f7520a944498c (diff) |
syntax
git-svn-id: svn://tug.org/texlive/trunk@1365 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/syntax/syntax.tex | 482 |
1 files changed, 482 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/syntax/syntax.tex b/Master/texmf-dist/tex/latex/syntax/syntax.tex new file mode 100644 index 00000000000..0c2ef8e621b --- /dev/null +++ b/Master/texmf-dist/tex/latex/syntax/syntax.tex @@ -0,0 +1,482 @@ +% Dieses File ist dazu gedacht, im Vorspann von LaTeX Dokumenten vermittels +% \include{syntax.tex} eingebunden zu werden. Es stellt dann die Umgebung +% syntaxdiagramm zur Verfuegung, mit deren Hilfe Syntaxdiagramme fuer +% z.B. Pascal erzeugt werden koennen. +% +% syntax.tex benoetigt nur noch folgendes LaTeX Paket: +% - fancybox.sty +% (Es muss im Vorspann des aufrufenden Dokumentes eingebunden werden.) +% +% Beispiele zur Verwendung siehe: syntaxtest.tex +% zur naeheren Dokumentation siehe: syntaxintro.tex +% zur Entwicklung des Codes siehe: syntaxdevel.tex +% +% Bernd Worsch 29.6.97 +% +% 05.07.97 \Leer als vertikale Stuetze +% groessere Abstaende in Alternativen-Umgebung +% +% to-do-list: +% -- Oval fuer SynVar ueber picture erzeugen -> fancybox unnoetig +% -- Alternativen-Parameter automatisch bestimmen +% -- Dokumentation (syntaxuse.tex) +% -- Kommentare im Quelltext +% -- Als sty-File implementieren + + + +\typeout{Verwende: 'syntax.tex' v0.02 von Bernd Worsch} + + + +%%%% Anlegen der benoetigten Laengen und Boxen + +\newlength{\breite} +\newlength{\hoehe} +\newlength{\tiefe} +\newlength{\gesamthoehe} +\newlength{\tmpLength} + +\newsavebox{\Messbox} + +\newlength{\LineLengStan} +\newlength{\LineThikStan} +\setlength{\LineLengStan}{4mm} +\setlength{\LineThikStan}{\fboxrule} + +\newsavebox{\Centerbox} +\newlength{\Centercor} + +\newlength{\VertSkipStan} +\setlength{\VertSkipStan}{3mm} + +\newsavebox{\upperbox} +\newsavebox{\lowerbox} +\newsavebox{\togetherbox} +\newlength{\VertLineLength} +\newlength{\VertSkip} + +\newlength{\upperVertLineLength} +\newlength{\lowerVertLineLength} + +\newlength{\tabulcor} + +%%%%% Beginn Syntaxdiagramm Befehle und Umgebungen + +\newenvironment{Syntaxdiagramm}[1][\PfeilR]% + {% +% +%%%% Befehl zum Vermessen von TeX-Strukturen +% +%\newcommand{\Messe}[1] +% { +% \sbox{\Messbox}{##1} +% +% \setlength{\breite}{\wd\Messbox} +% \setlength{\hoehe}{\ht\Messbox} +% \setlength{\tiefe}{\dp\Messbox} +% \setlength{\gesamthoehe}{\hoehe} +% \addtolength{\gesamthoehe}{\tiefe} +% \setlength{\tmpLength}{\hoehe} +% \addtolength{\tmpLength}{-\tiefe} +% \setlength{\tmpLength}{-0.5\tmpLength} +% +% \fbox +% { +% \begin{tabular}{ll} +% Breite: & \the\breite \\ +% Hoehe: & \the\hoehe \\ +% Tiefe: & \the\tiefe \\ +% Gesamthoehe: & \the\gesamthoehe \\ +% CenterCor: & \the\tmpLength +% \end{tabular} +% +% \usebox{\Messbox} +% } +% } +% +%%%% Befehl zum Justieren von Boxen +% +\newcommand{\CenterToBaseLine}[1] + {% + \sbox{\Centerbox}{##1}% + \setlength{\Centercor}{\ht\Centerbox}% + \addtolength{\Centercor}{-\dp\Centerbox}% + \setlength{\Centercor}{-0.5\Centercor}% + \addtolength{\Centercor}{0.5\LineThikStan}% + \raisebox{\Centercor}{\usebox{\Centerbox}}% + }% +% +%%%% Grundelemente eines Syntaxdiagramms +% +\newcommand{\Leer}% + {\rule[-1.3ex]{0pt}{2.5ex}}% +% +\newcommand{\Linie}% + {\rule{\LineLengStan}{\LineThikStan}}% +% +\newcommand{\KurzeLinie}% + {\rule{0.5\LineLengStan}{\LineThikStan}}% +% +\newcommand{\Tri} + {% + \CenterToBaseLine + {% + \setlength{\unitlength}{1pt}% + \begin{picture}(0,0)% + \put(0,0){\vector(0,1){0}}% + \end{picture}% + }% + }% +% +\newcommand{\TriR} + {% + \CenterToBaseLine + {% + \setlength{\unitlength}{1pt}% + \begin{picture}(0,0)% + \put(0,0){\vector(1,0){0}}% + \end{picture}% + }% + }% +% +\newcommand{\TriD} + {% + \CenterToBaseLine + {% + \setlength{\unitlength}{1pt}% + \begin{picture}(0,0)% + \put(0,0){\vector(0,-1){0}}% + \end{picture}% + }% + }% +% +\newcommand{\TriL} + {% + \CenterToBaseLine + {% + \setlength{\unitlength}{1pt}% + \begin{picture}(0,0)% + \put(0,0){\vector(-1,0){0}}% + \end{picture}% + }% + }% +% +\newcommand{\Dots} + {% + \CenterToBaseLine + {% + ...% + }% + }% +% +\newcommand{\SynVar}[1]% + {% + \CenterToBaseLine% + {% + \fbox% + {% + \rule{0.1em}{0pt}% + \rule[-0.3ex]{0pt}{2ex}% + ##1% + \rule{0.1em}{0pt}% + }% + }% + }% +% +\newcommand{\TerSym}[1]% + {% + \CenterToBaseLine% + {% + \ovalbox% + {% + \rule{0.2em}{0pt}% + \rule[-0.2ex]{0pt}{1.8ex}% + ##1% + \rule{0.2em}{0pt}% + }% + }% + }% +% +%%%% Kombinierte Grafische Elemente +% +\newcommand{\Ellipse}% + {% + \Linie\ \Dots\ \Linie% + }% +% +\newcommand{\PfeilR}% + {% + \Linie\TriR% + }% +% +\newcommand{\PfeilL}% + {% + \TriL\Linie% + }% +% +\newcommand{\SynVarR}[1]% + {% + \PfeilR\SynVar{##1}\Linie% + }% +% +\newcommand{\SynVarL}[1]% + {% + \Linie\SynVar{##1}\PfeilL% + }% +% +\newcommand{\TerSymR}[1]% + {% + \PfeilR\TerSym{##1}\Linie% + }% +% +\newcommand{\TerSymL}[1]% + {% + \Linie\TerSym{##1}\PfeilL% + }% +% +%%%% Vertikale grafische Elemente +% +\newcommand{\LinieO}[1]% + {% + \CenterToBaseLine% + {% + \raisebox{0pt}[0pt][0pt]% + {% + \makebox[0mm][c]{\rule{\LineThikStan}{##1}}% + }% + }% + }% +% +\newcommand{\LinieU}[1]% + {% + \CenterToBaseLine% + {% + \raisebox{0pt}[0pt][0pt]% + {% + \makebox[0mm][c]{\rule[-##1]{\LineThikStan}{##1}}% + }% + }% + }% +% +\newcommand{\PfeilO}[1]% + {% + \CenterToBaseLine% + {% + \raisebox{0pt}[0pt][0pt]% + {% + \makebox[0mm][c]{\TriD}% + \makebox[0mm][c]{\rule{\LineThikStan}{##1}}% + }% + }% + }% +% +\newcommand{\PfeilU}[1]% + {% + \CenterToBaseLine% + {% + \raisebox{0pt}[0pt][0pt]% + {% + \makebox[0mm][c]{\Tri}% + \makebox[0mm][c]{\rule[-##1]{\LineThikStan}{##1}}% + }% + }% + }% +% +%%%% Strukturen +% +%%% Wiederholung +% +\newcommand{\Wiederholung}[2]% + {% + \sbox{\upperbox}{##1}% + \sbox{\lowerbox}{##2}% + \setlength{\VertLineLength}{\dp\upperbox}% + \addtolength{\VertLineLength}{\ht\lowerbox}% + \addtolength{\VertLineLength}{\VertSkipStan}% + \addtolength{\VertLineLength}{0.5\LineThikStan}% + \setlength{\VertSkip}{\VertSkipStan}% + \addtolength{\VertSkip}{\dp\upperbox}% +% + \Linie% + \PfeilU{\VertLineLength}% +% + \renewcommand{\arraystretch}{0}% + \begin{tabular}[t]% % Zwei Eintraege + {% + @{\hrulefill}% % Verbindungslinie 1 + c% % Eintraege Zentrieren + @{\hrulefill}% % Verbindungslinie 2 + }% + \PfeilR\usebox{\upperbox}\Linie\\[\VertSkip] % Dies wiederholen + \Linie\usebox{\lowerbox}\PfeilL% % Dies in Gegenrichtung + \end{tabular}% +% + \LinieU{\VertLineLength}% + \Linie% + }% +% +%%% Alternative +% +\newcommand{\Alternative}[2]% + {% + \sbox{\upperbox}{##1}% + \sbox{\lowerbox}{##2}% +% + \setlength{\upperVertLineLength}{\dp\upperbox}% + \addtolength{\upperVertLineLength}{0.5\VertSkipStan}% + \addtolength{\upperVertLineLength}{0.5\LineThikStan}% +% + \setlength{\lowerVertLineLength}{\ht\lowerbox}% + \addtolength{\lowerVertLineLength}{0.5\VertSkipStan}% + \addtolength{\lowerVertLineLength}{0.5\LineThikStan}% +% + \setlength{\VertSkip}{\VertSkipStan}% + \addtolength{\VertSkip}{\dp\upperbox}% +% + \Linie% + \LinieO{\upperVertLineLength}% + \LinieU{\lowerVertLineLength}% +% + \renewcommand{\arraystretch}{0}% + \addtolength{\upperVertLineLength}{-0.5\LineThikStan}% + \raisebox{\upperVertLineLength}% + {% + \begin{tabular}[t]% % Zwei Eintraege + {% + @{\hrulefill}% % Verbindungslinie 1 + c% % Eintraege Zentrieren + @{\hrulefill}% % Verbindungslinie 2 + }% + \PfeilR\usebox{\upperbox}\Linie\\[\VertSkip] % Weg1 + \PfeilR\usebox{\lowerbox}\Linie% % Weg2 + \end{tabular}% + }% + \renewcommand{\arraystretch}{1}% + \addtolength{\upperVertLineLength}{0.5\LineThikStan}% +% + \LinieO{\upperVertLineLength}% + \LinieU{\lowerVertLineLength}% + \Linie% + }% +% +%%% Stapel +% +\newcommand{\Stapel}[2]% + {% + \sbox{\upperbox}{##1}% + \sbox{\lowerbox}{##2}% +% + \setlength{\upperVertLineLength}{\dp\upperbox}% + \addtolength{\upperVertLineLength}{0.5\VertSkipStan}% + \addtolength{\upperVertLineLength}{0.5\LineThikStan}% +% + \setlength{\lowerVertLineLength}{\ht\lowerbox}% + \addtolength{\lowerVertLineLength}{0.5\VertSkipStan}% + \addtolength{\lowerVertLineLength}{0.5\LineThikStan}% +% + \setlength{\VertSkip}{0.5\VertSkipStan}% + \addtolength{\VertSkip}{\dp\upperbox}% + \addtolength{\VertSkip}{-1\LineThikStan}% +% + \Linie% + \LinieO{\upperVertLineLength}% + \addtolength{\lowerVertLineLength}{-0.5\LineThikStan}% + \raisebox{\upperVertLineLength}{\KurzeLinie}% + \addtolength{\lowerVertLineLength}{0.5\LineThikStan}% + \LinieU{\lowerVertLineLength}% +% + \renewcommand{\arraystretch}{0}% + \addtolength{\upperVertLineLength}{-0.5\LineThikStan}% + \raisebox{\upperVertLineLength}% + {% + \addtolength{\upperVertLineLength}{0.5\LineThikStan}% + \begin{tabular}[t]% % Zwei Eintraege + {% + @{\hrulefill}% % Verbindungslinie 1 + c% % Eintraege Zentrieren + @{\hrulefill}% % Verbindungslinie 2 + }% + \PfeilR\usebox{\upperbox}\Linie\\[\VertSkip] % oberer Eintrag + \PfeilL\\[0.5\VertSkipStan]% + \PfeilR\usebox{\lowerbox}\Linie% % unterer Eintrag + \end{tabular}% + }% + \renewcommand{\arraystretch}{1}% + \addtolength{\upperVertLineLength}{0.5\LineThikStan}% +% + \LinieO{\upperVertLineLength}% + \addtolength{\lowerVertLineLength}{-0.5\LineThikStan}% + \raisebox{-\lowerVertLineLength}{\KurzeLinie}% + \addtolength{\lowerVertLineLength}{0.5\LineThikStan}% + \LinieU{\lowerVertLineLength}% + \Linie% + }% +% +%%%% Die Alternativen-Umgebung +% +\newenvironment{Alternativen}[2]% + {% + \renewcommand{\arraystretch}{2}% + \setlength{\tabulcor}{9.3pt}% + \sbox{\upperbox}{##1}% + \sbox{\lowerbox}{##2}% +% + \begin{lrbox}{\togetherbox}% + \begin{tabular}[t]% % Zwei Eintraege + {% + @{\hrulefill}% % Verbindungslinie 1 + c% % Eintraege Zentrieren + @{\hrulefill}% % Verbindungslinie 2 + }% + \PfeilR\usebox{\upperbox}\Linie\\ % erster Weg + }% +% % weitere Wege + {% + \PfeilR\usebox{\lowerbox}\Linie% % letzter Weg + \end{tabular}% + \end{lrbox}% +% + \setlength{\upperVertLineLength}{0.5\dp\togetherbox}% + \addtolength{\upperVertLineLength}{0.5\ht\togetherbox}% + \addtolength{\upperVertLineLength}{-\ht\upperbox}% + \addtolength{\upperVertLineLength}{0.5\LineThikStan}% + \addtolength{\upperVertLineLength}{-\tabulcor}% +% + \setlength{\lowerVertLineLength}{0.5\dp\togetherbox}% + \addtolength{\lowerVertLineLength}{0.5\ht\togetherbox}% + \addtolength{\lowerVertLineLength}{-\dp\lowerbox}% +% + \Linie% + \LinieO{\upperVertLineLength}% + \LinieU{\lowerVertLineLength}% +% + \CenterToBaseLine{\usebox{\togetherbox}}% +% + \LinieO{\upperVertLineLength}% + \LinieU{\lowerVertLineLength}% + \Linie% + }% +% +%%%%% Ende Syntaxdiagramm Befehle und Umgebungen +% + \providecommand{\ContSym}{#1} + \renewcommand{\ContSym}{#1} + \begin{lrbox}{\Messbox}% + }% + {% + \end{lrbox}% + \setlength{\hoehe}{\ht\Messbox}% + \addtolength{\hoehe}{\VertSkipStan}% + \setlength{\tiefe}{\dp\Messbox}% + \addtolength{\tiefe}{\VertSkipStan}% + \raisebox{0pt}[\hoehe][\tiefe]% + {% + \Linie% + \usebox{\Messbox}% + \ContSym% + }% + }% +% +%%%%% --Und Schluss-- + |