\usepackage{listings} FEHLERMELDUNG
Verfasst: Di 3. Jul 2012, 12:28
Hallo, ich möchte gerne einen Python-Code in mein Latex Dokument einfügen mittels dem
Packet "Listings".
Dies führt jedoch zu dieser Fehlermeldung (aus log-File kopiert):

Als nächstes, habe ich den Python-Code dann in meine eigentliche Arbeit eingefügt und es gibt Probleme!
Woran kann das liegen?
P.S. \usepackage &co stehen in einem anderen File und habe ich absichtlich nicht angegeben
Gruß
Packet "Listings".
Dies führt jedoch zu dieser Fehlermeldung (aus log-File kopiert):
Zu erst habe ich eine tex-Datei, nur mit dem Python-Code erstellt und kompiliert, hat funktioniert.! TeX capacity exceeded, sorry [input stack size=5000].
\lst@IfNextCharsArg #1->\def \lst@tofind
{#1}\lst@IfNextChars \lst@tofind
l.170 else:
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.
Here is how much of TeX's memory you used:
6140 strings out of 495062
80857 string characters out of 1182645
179693 words of memory out of 3000000
9194 multiletter control sequences out of 15000+50000
18227 words of font info for 67 fonts, out of 3000000 for 9000
28 hyphenation exceptions out of 8191
5000i,12n,2491p,548b,1626s stack positions out of 5000i,500n,10000p,200000b,50000s
Output written on fsi.dvi (6 pages, 10540 bytes).

Als nächstes, habe ich den Python-Code dann in meine eigentliche Arbeit eingefügt und es gibt Probleme!

Woran kann das liegen?
\lstset{ language=Python, tabsize=2, showspaces=false, showstringspaces=false, float=[htb], captionpos=b, basicstyle =\scriptsize\rmfamily, commentstyle=\itshape\color{Brown}, keywordstyle = \bfseries\color{blue}, stringstyle = \color{Fuchsia}, } \begin{lstlisting} def edit_sif_file(new_sif_file): global Elmer_master with open(Elmer_master,'r') as infile: with open(new_sif_file,'w') as outfile: data = infile.readlines() for eintrag in data: #ändern Output File if "{RESULT_FILE}" in eintrag: change_output(outfile) #ändern FSI Boundary mit x-Parametrisierung elif "{FSI-BOUNDARY-X}" in eintrag: fsi_bc_number = get_Target_BC(data,eintrag) fsi_bc_paramter_x(fsi_bc_number,outfile) #ändern FSI Boundary mit x-Parametrisierung elif "{FSI-BOUNDARY-Y}" in eintrag: fsi_bc_number = get_Target_BC(data,eintrag) fsi_bc_paramter_y(fsi_bc_number,outfile) #fügt Restart Solver hinzu elif "{RESTART_FILE}" in eintrag: change_restart(outfile) #NEUE: Plot_File für jede Iteration elif "{FLUID_PLOT}" in eintrag: change_plot(outfile) elif "{OUTPUT_FILE}" in eintrag: change_boundary_values_file(outfile) elif "{OUTPUT_SHEAR}" in eintrag: change_shear_stress(outfile) else: outfile.write(eintrag) return outfile \end{lstlisting}
Gruß