Autor Beitrag
schickmaster
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Mi 04.08.10 12:17 
hey
ich suche ein listing packege bzw. listingset für latex, dass mir die lsitings wie in MSVS2008 darstellt.
hat sowas jemand vll schonmal verwendet und weiss, wo man es finden kann?

(hoffe das geht in ordnung für den Sonstiges thread, sonst einfach löschen)

gruss alex


Moderiert von user profile iconChristian S.: Topic aus Sonstiges (.NET) verschoben am Mi 04.08.2010 um 12:51
gfoidl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 157
Erhaltene Danke: 19

Win XP
C#, Fortran 95 - Visual Studio
BeitragVerfasst: Mi 04.08.10 14:31 
Hallo,

1:1 wie im VS hab ich noch nichts gefunden.
Listings mit Syntaxhighlight findest du sonst bei Google genügend.

Nur so als Idee:
Du könntest den C#-Code nehmen und mit den HTML-Prettifiern (heißen die so?) wie zB C# Code Format in VS-ähnliches HTML bringen und dieses dann mit Html to LaTeX ins Zielformat bringen.
Würde sich auch automatisieren lassen.
Gleiche Überlegung könnte auch mit RTF statt HTML angestellt werden. Das deshalb das es (zumindest für VS 2010) eine VS-Extension gibt (die PowerTools) mit der der Code mit Copy&Copy unter der Erhaltung des VS-Highlighting zB nach Word kopiert werden kann. Word als RTF -> LaTeX.


mfG Gü

_________________
Alle sagten, das geht nicht! Dann kam einer, der wusste das nicht - und hat's gemacht!
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Mi 04.08.10 16:51 
Also das habe ich mich auch schonmal gefragt und habe nichts gefunden. Das lief dann darauf hinaus, dass ich den C-Highlighter des lstlistings-Package als Basis genommen habe und dem ein paar Keywords hinzugefügt habe.

Mögliche Lösung: Du könntest SynEdit nehmen und dessen TeX-Exporter nutzen. Das hat ja glaube ich einen C#-Highlighter.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 04.08.10 21:12 
Ich hab für das Listings-Package mal eine etwas erweiterte Sprachdefinition für Delphi zusammengehackt, die auch Symbole hervorgehoben hat ( , . : ; .. und Klammern ). Hat auch soweit funktioniert, war aber wirklich nur gehackt. Sowas ähnliches dürfte man auch für C# tun können. Oder brauchst Du noch mehr?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Mi 04.08.10 21:26 
VS -> Word (funktioniert auch ohne Extension) ist sicher eine gute Idee, ansonsten hätte hier auch noch eine kleine Definition für Listings, die auf dem SharpDevelop-Highlighting beruht.
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
\usepackage{courier, color, listings}

\definecolor{Green}{rgb}{0, 0.3, 0}
\definecolor{DarkCyan}{rgb}{0, 0.545, 0.545}
\definecolor{Navy}{rgb}{0, 0, 0.5}
\definecolor{Teal}{rgb}{0, 0.5, 0.5}
\definecolor{DarkGray}{gray}{0.66}
\definecolor{Olive}{rgb}{0.5, 0.5, 0}
\definecolor{Pink}{rgb}{1.0, 0.75, 0.8}
\definecolor{DeepPink}{rgb}{1, 0.08, 0.58}
\definecolor{Brown}{rgb}{0.65, 0.165, 0.165}
\definecolor{DarkViolet}{rgb}{0.58, 0, 0.83}
\definecolor{SaddleBrown}{rgb}{0.55, 0.27, 0.07}
\lstdefinelanguage{CSharp}
{
 morecomment = [l]{//}, 
 morecomment = [l]{///},
 morecomment = [s]{/*}{*/},
 morestring=[b]", 
 morestring=[b]',
 basicstyle=\footnotesize\ttfamily,
 commentstyle=\color{Green}\textit,
 stringstyle=\color{blue},
 sensitive = true,
  morekeywords=[1]{this, base},
  keywordstyle=[1]\bfseries,
  morekeywords=[2]{as, is, new, sizeof, typeof, true, false, stackalloc},
  keywordstyle=[2]\color{DarkCyan}\bfseries,
  morekeywords=[3]{else, if, switch, case, default,
  do, for, foreach, while, in},
  keywordstyle=[3]\color{blue}\bfseries ,
  morekeywords=[4]{break, continue, goto, return,
  yield, partial, global, where},
  keywordstyle=[4]\color{Navy},
  morekeywords=[5]{try, throw, catch, finally},
  keywordstyle=[5]\color{Teal}\bfseries,
  morekeywords=[6]{checked, unchecked},
  keywordstyle=[6]\color{DarkGray}\bfseries,
  morekeywords=[7]{fixed, unsafe},

  keywordstyle=[7]\color{Olive},
  morekeywords=[8]{bool, byte, sbyte, char, short, ushort, int, uint, long, ulong, float,
  double, decimal, enum, struct},
  keywordstyle=[8]\bfseries\color{red},
  morekeywords=[9]{class, interface, delegate, object, string,
  void},
  keywordstyle=[9]\color{red},
  morekeywords=[10]{explicit, implicit, operator},
  keywordstyle=[10]\color{Pink}\bfseries,
  morekeywords=[11]{params, ref, out},
  keywordstyle=[11]\bfseries\color{DeepPink},
  morekeywords=[12]{private, protected, internal, public},
  keywordstyle=[12]\bfseries\color{blue},
  morekeywords=[13]{abstract, const, event, var, override, virtual, volatile, extern, readonly, sealed, static},
  keywordstyle=[13]\color{Brown},
  morekeywords=[14]{namespace, using},
  keywordstyle=[14]\bfseries\color{Green},
  morekeywords=[15]{lock},
  keywordstyle=[15]\color{DarkViolet},
  morekeywords=[16]{get, set, add, remove},
  keywordstyle=[16]\color{SaddleBrown},
  morekeywords=[17]{null, value},
  keywordstyle=[17]\bfseries,
}
\lstset{tabsize=4,showstringspaces=false, numberstyle=\tiny, stepnumber=2, numbersep=5pt}


/edit: Älter als 3.0, wie man sieht ;) .

_________________
>λ=

Für diesen Beitrag haben gedankt: gfoidl