Syntax Highlighting

Antwort erstellen


Diese Frage dient dazu, das automatisierte Versenden von Formularen durch Spam-Bots zu verhindern.
Smilies
:D :) :( :o :shock: :? 8) :lol: :-x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode ist eingeschaltet
[img] ist eingeschaltet
[flash] ist ausgeschaltet
[url] ist eingeschaltet
Smilies sind eingeschaltet

Die letzten Beiträge des Themas

Ich habe die Datenschutzerklärung gelesen und bin damit einverstanden.

   

Wenn du eine Datei oder mehrere Dateien anhängen möchtest, gib die Details unten ein.

Ansicht erweitern Die letzten Beiträge des Themas: Syntax Highlighting

Syntax Highlighting

von Gast » Mi 8. Sep 2010, 15:37

Hallo an alle,

ich stehe vor einem Problem beim Syntax-Highlighting in Latex.
Und zwar möchte ich REXX-Programmcode einfärben. Das ist mir auch mit Hilfe eines Tools gelungen: http://www.andre-simon.de
Der generierte Latex-Code hat folgende gestalt:
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.2,0,0.4}{#1}}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.2,0.73,0.02}{#1}}
\newcommand{\hlesc}[1]{\textcolor[rgb]{0.65,0.09,0.38}{#1}}
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.09,0.38,0.65}{#1}}
\newcommand{\hlpps}[1]{\textcolor[rgb]{0.4,0.2,0}{#1}}
\newcommand{\hlslc}[1]{\textcolor[rgb]{0,0.4,0.2}{#1}}
\newcommand{\hlcom}[1]{\textcolor[rgb]{0,0.4,0.2}{#1}}
\newcommand{\hlppc}[1]{\textcolor[rgb]{0.33,0.45,0.69}{#1}}
\newcommand{\hlopt}[1]{\textcolor[rgb]{0.33,0.33,0.33}{#1}}
\newcommand{\hllin}[1]{\textcolor[rgb]{0.6,0.6,0.6}{#1}}
\newcommand{\hlkwa}[1]{\textcolor[rgb]{1,0.19,0.19}{#1}}
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.96,0.55,0.14}{#1}}
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0,0,1}{#1}}
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.82,0.11,0.93}{#1}}
\definecolor{bgcolor}{rgb}{1,1,1}

\pagecolor{bgcolor}
\newsavebox{\hlboxopenbrace}
\newsavebox{\hlboxclosebrace}
\newsavebox{\hlboxlessthan}
\newsavebox{\hlboxgreaterthan}
\newsavebox{\hlboxdollar}
\newsavebox{\hlboxunderscore}
\newsavebox{\hlboxand}
\newsavebox{\hlboxhash}
\newsavebox{\hlboxat}
\newsavebox{\hlboxbackslash}
\newsavebox{\hlboxpercent}
\newsavebox{\hlboxhat}
\setbox\hlboxopenbrace=\hbox{\verb.{.}
\setbox\hlboxclosebrace=\hbox{\verb.}.}
\setbox\hlboxlessthan=\hbox{\verb.<.}
\setbox\hlboxgreaterthan=\hbox{\verb.>.}
\setbox\hlboxdollar=\hbox{\verb.$.}
\setbox\hlboxunderscore=\hbox{\verb._.}
\setbox\hlboxand=\hbox{\verb.&.}
\setbox\hlboxhash=\hbox{\verb.#.}
\setbox\hlboxat=\hbox{\verb.@.}
\setbox\hlboxbackslash=\hbox{\verb.\.}
\setbox\hlboxpercent=\hbox{\verb.\%.}
\setbox\hlboxhat=\hbox{\verb.^.}
\def\urltilda{\kern -.15em\lower .7ex\hbox{\~{}}\kern .04em}
\noindent
\ttfamily
\shorthandoff{"}
\hlstd{}\hlstr{\dq{}EXECIO\ {*}\ DISKR\ IN1(STEM\ INH1.\ FINIS\dq{}}\hlstd{\hspace*{\fill}\\
volcnt\ }\hlopt{=\ }\hlstd{}\hlkwa{ARG}\hlstd{}\hlopt{(}\hlstd{1}\hlopt{)\ }\hlstd{}\hlcom{/{*}\ Anzahl\ umzuhaengende\ Volumes\ {*}/}\hlstd{}\hspace*{\fill}\\
\hlkwa{DO\ }\hlstd{i}\hlopt{=}\hlstd{1\ }\hlkwa{TO\ }\hlstd{INH1}\hlopt{.}\hlstd{0\hspace*{\fill}\\
}\hlstd{\ \ }\hlstd{}\hlkwa{PARSE\ }\hlstd{}\hlkwb{VAR\ }\hlstd{INH1}\hlopt{.}\hlstd{i\ 5\ type\ 6\ }\hlopt{.}\hspace*{\fill}\\
\hlstd{}\hlstd{\ \ }\hlstd{}\hlkwa{IF\ }\hlstd{type}\hlopt{=}\hlstd{}\hlstr{\dq{}V\dq{}}\hlstd{\ }\hlkwa{THEN}\hspace*{\fill}\\
\hlstd{}\hlstd{\ \ \ \ }\hlstd{}\hlkwa{DO}\hspace*{\fill}\\
\hlstd{}\hlstd{\ \ \ \ \ }\hlstd{srcz\ }\hlopt{=\ }\hlstd{srcz\ }\hlopt{+\ }\hlstd{1\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{volser}\hlopt{=}\hlstd{}\hlkwb{SUBSTR}\hlstd{}\hlopt{(}\hlstd{INH1}\hlopt{.}\hlstd{i}\hlopt{,}\hlstd{}\hlnum{25}\hlstd{}\hlopt{,}\hlstd{6}\hlopt{)\ }\hlstd{}\hlcom{/{*}\ AUSLESEN\ DER\ VOLSER\ {*}/}\hlstd{\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{devnum}\hlopt{=}\hlstd{}\hlkwb{SUBSTR}\hlstd{}\hlopt{(}\hlstd{}\hlkwb{C2X}\hlstd{}\hlopt{(}\hlstd{INH1}\hlopt{.}\hlstd{i}\hlopt{),}\hlstd{}\hlnum{153}\hlstd{}\hlopt{,}\hlstd{4}\hlopt{)\ }\hlstd{}\hlcom{/{*}AUSWERTEN\ DER\ DEVICE\ NUMMER\ {*}/}\hlstd{\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{storgrp\ }\hlopt{=\ }\hlstd{}\hlkwb{STRIP}\hlstd{}\hlopt{(}\hlstd{}\hlkwb{SUBSTR}\hlstd{}\hlopt{(}\hlstd{INH1}\hlopt{.}\hlstd{i}\hlopt{,}\hlstd{}\hlnum{83}\hlstd{}\hlopt{,}\hlstd{8}\hlopt{))\ }\hlstd{}\hlcom{/{*}\ STORAGE\ GROUP\ {*}/}\hlstd{\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{inh1x}\hlopt{=}\hlstd{}\hlkwb{C2X}\hlstd{}\hlopt{(}\hlstd{INH1}\hlopt{.}\hlstd{i}\hlopt{)}\hspace*{\fill}\\
\hlstd{}\hlstd{\ \ \ \ \ }\hlstd{totcap1x}\hlopt{=}\hlstd{}\hlkwb{SUBSTR}\hlstd{}\hlopt{(}\hlstd{inh1x}\hlopt{,}\hlstd{}\hlnum{89}\hlstd{}\hlopt{,}\hlstd{8}\hlopt{)\ }\hlstd{}\hlcom{/{*}\ AUSLESEN\ TOTAL\ CAPACITY\ IN\ KB}\hlstd{\ \ }\hlcom{{*}/}\hlstd{\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{DColl\textunderscore Vol\textunderscore Cap}\hlopt{.}\hlstd{DColl\textunderscore Line\ }\hlopt{=\ }\hlstd{}\hlkwb{X2D}\hlstd{}\hlopt{(}\hlstd{totcap1x}\hlopt{)}\hspace*{\fill}\\
\hlstd{}\hlstd{\ \ \ \ \ }\hlstd{}\hlkwa{if\ }\hlstd{DColl\textunderscore Vol\textunderscore Cap}\hlopt{.}\hlstd{DColl\textunderscore Line\ }\hlopt{=}\hlstd{\ \ }\hlopt{}\hlstd{}\hlnum{923833}\hlstd{\ \ \ }\hlnum{}\hlstd{}\hlkwa{then\ }\hlstd{Vol\textunderscore Cap\textunderscore M1\ }\hlopt{=\ }\hlstd{3\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{}\hlkwa{if\ }\hlstd{DColl\textunderscore Vol\textunderscore Cap}\hlopt{.}\hlstd{DColl\textunderscore Line\ }\hlopt{=}\hlstd{\ \ }\hlopt{}\hlstd{}\hlnum{8314501}\hlstd{\ \ }\hlnum{}\hlstd{}\hlkwa{then\ }\hlstd{Vol\textunderscore Cap\textunderscore M1\ }\hlopt{=\ }\hlstd{9\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{}\hlkwa{if\ }\hlstd{DColl\textunderscore Vol\textunderscore Cap}\hlopt{.}\hlstd{DColl\textunderscore Line\ }\hlopt{\usebox{\hlboxgreaterthan}=\ }\hlstd{}\hlnum{24943503\ }\hlstd{}\hlkwa{then\ }\hlstd{Vol\textunderscore Cap\textunderscore M1\ }\hlopt{=\ }\hlstd{}\hlnum{27}\hspace*{\fill}\\
\hlstd{}\hlstd{\ \ \ \ \ }\hlstd{totcap1d}\hlopt{=}\hlstd{totcap1d}\hlopt{+}\hlstd{Vol\textunderscore Cap\textunderscore M1\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{outdats}\hlopt{.}\hlstd{sidx}\hlopt{=}\hlstd{volser\ devnum\ storgrp\hspace*{\fill}\\
}\hlstd{\ \ \ \ \ }\hlstd{sidx}\hlopt{=}\hlstd{sidx}\hlopt{+}\hlstd{1\hspace*{\fill}\\
}\hlstd{\ \ }\hlstd{}\hlkwa{END\ }\hlstd{}\hlcom{/{*}\ IF\ {*}/}\hlstd{}\hspace*{\fill}\\
\hlkwa{END\ }\hlstd{}\hlcom{/{*}\ DO\ SCHLEIFE\ {*}/}\hlstd{\ }\hspace*{\fill}\\
\mbox{}
\normalfont
\normalsize
\shorthandon{"}
(* LaTeX generated by highlight 3.1, http://www.andre-simon.de/ *)
Das Stylesheet kann auch "ausgebettet" werden.
In meinem Latex-Dokument verwende ich bisher das Listing-Paket:

\begin{lstlisting}[frame=tlrb, label=bla, caption=blubb]
code, code, code...
\end{lstlisting}

Ich habe versucht den generierten Latex-Code mit \input{code.tex} einzubinden, allerdings wird dieser dann als Latex-Code ausgegeben und nicht als formatierter REXX-Code. Nachdem ich die Package Hilfe durchgestöbert habe, fand ich bisher keine Lösung.

Kann mir jemand sagen wie man das macht? Ich würde das Listing-Package gerne weiterverwenden weil ich damit meine anderen Listings erstellt habe und diese auch so im Inhaltsverzeichnis automatisch eingebunden werden.

Vielen Dank!

Nach oben