gnuplot .tex-Dateien in Latex-Dokument einbinden

Tabellen und Grafiken erstellen und anordnen


hossaping
Forum-Newbie
Forum-Newbie
Beiträge: 1
Registriert: Do 3. Nov 2016, 16:54

gnuplot .tex-Dateien in Latex-Dokument einbinden

Beitrag von hossaping »

Hallo,
ich brauche Hilfe dabei, ein Latex-Dokument mit Grafiken zu erzeugen, die ich in gnuplot erzeugt habe. Das Kompilieren funktioniert nicht.

Ich verwende MikTex 2.9 mit TeXworks auf Windows 7.

Hier der Latex-Code:
\documentclass[a4paper,11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{graphics}

\author{Robert Worm}
\date{\today}

\begin{document}

\begin{figure}
   \input{2124_10_16/oldt.tex}
\end{figure}

\begin{figure}
    \input{2124_10_16/oldl01.tex}
    \input{2124_10_16/oldl34.tex}
\end{figure}

\begin{figure}
  \input{2124_10_16/transmission.tex}
\end{figure}

\begin{figure}
  \input{2124_10_16/linear01.tex}
  \input{2124_10_16/linear34.tex}
\end{figure}


\end{document}
Wie gesagt habe ich alle sechs .tex Dateien in gnuplot mit dem Terminal cairolatex pdf input erzeugt. Nach dem die Dateien erzeugt wurden, habe ich das Terminal wieder auf wxt gesetzt.

Erst habe ich nur die drei unteren Grafiken transmission, linear01, linear34, eingebunden. Komisch war, dass in der mit dem gnuplot-Skript zuletzt erzeugten Datei "transmission.tex" ein Absatz fehlte. Das habe gemerkt, als ich diese Datei im Latex-Code auskommentierte und dann erfolglreich kompilieren konnte. Als ich diesen Absatz manuell von einer der anderen Dateien in transmission.tex kopierte, konnte ich mit den drei Dateien kompilieren. Es handelt sich um
\gplbacktext
    \put(0,0){\includegraphics{transmission}}%
    \gplfronttext
  \end{picture}%
\endgroup
Hier habe ich natürlich den Dateinamen von Hand angepasst. Nun habe ich den Latex-Code um die Dateien oldt, oldl01 und oldl34 erweitert. Wieder trat das Problem mit dem fehlenden Absatz in der Datei auf, die von gnuplot als letztes erzeugt wird. Als ich dies behoben hatte, trat ein neuer Fehler auf:
! LaTeX Error: File `oldlt' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.140 \put(0,0){\includegraphics{oldlt}}
%
?
? H
I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2,.eps
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
?
Die Datei, die nicht gefunden wird, ist vorhanden und lässt sich mit dem pdf-Betrachter öffnen. Komischerweise tritt der Fehler nur bei den Dateien oldt, oldl01 und oldl34 auf. Ich erkenne nicht, was an diesen Dateien anders ist als an transmission, linear01, linear34, die ich auf die selbe Weise erzeugt habe. Anbei noch mein gnuplot-Skript:
set fit logfile "uma.log"

set term cairolatex pdf input

set ylabel 'Transmission / a.u.'
set angles degrees

#Plot der Transmissions-Daten für den Polfilter als letztes Element vor der Probe

#plot "uma_transmission.dat" u 1:4 t "ohne Probe" ps 2, "uma_transmission.dat" u 1:5:6 with yerrorbars t "mit Probe" ps 2

#Darstellung und linearer Fit von Transmission vs. sin^2(theta)

set xlabel '$\sin^2(\theta)$'
set xtics 0.001
set mxtics 2
set pointsize 2
set grid

g1(x) = A1*x+B1
g2(x) = A2*x+B2
g3(x) = A3*x+B3
g4(x) = A4*x+B4

#fit g1(x) "uma_transmission.dat" i 0 u ((sin(90-$1))**2):($5/$4):((1/$4+$5/($4*$4))*2*$6) yerror via A1,B1
#fit g2(x) "uma_transmission.dat" i 1 u ((sin(90-$1))**2):($5/$4):((1/$4+$5/($4*$4))*2*$6) yerror via A2,B2
#fit g3(x) "uma_transmission.dat" i 3 u ((sin(90-$1))**2):($5/$4):((1/$4+$5/($4*$4))*2*$6) yerror via A3,B3
#fit g4(x) "uma_transmission.dat" i 4 u ((sin(90-$1))**2):($5/$4):((1/$4+$5/($4*$4))*2*$6) yerror via A4,B4

#set output "linear01.tex"
#plot "uma_transmission.dat" i 0:1 u ((sin(90-$1))**2):($5/$4):((1/$4+$5/($4*$4))*2*$6):(column(-2)) with yerrorbars linecolor variable t "rel. Transmission", #g1(x), g2(x)

#set output "linear34.tex"
#plot "uma_transmission.dat" i 3:4 u ((sin(90-$1))**2):($5/$4):((1/$4+$5/($4*$4))*2*$6):(column(-2)) with yerrorbars linecolor variable t "rel. Transmission", #g3(x), g4(x)

#Für den Polfilter in Standard-Position

h1(x) = C1*x+D1
h2(x) = C2*x+D2
h3(x) = C3*x+D3
h4(x) = C4*x+D4

fit h1(x) "uma_transmission.dat" i 0 u ((sin(90-$1))**2):($3/$2):((1/$2+$3/($2*$2))*2*$6) yerror via C1,D1
fit h2(x) "uma_transmission.dat" i 1 u ((sin(90-$1))**2):($3/$2):((1/$2+$3/($2*$2))*2*$6) yerror via C2,D2
fit h3(x) "uma_transmission.dat" i 3 u ((sin(90-$1))**2):($3/$2):((1/$2+$3/($2*$2))*2*$6) yerror via C3,D3
fit h4(x) "uma_transmission.dat" i 4 u ((sin(90-$1))**2):($3/$2):((1/$2+$3/($2*$2))*2*$6) yerror via C4,D4

set output "oldl01.tex"
plot "uma_transmission.dat" i 0:1 u ((sin(90-$1))**2):($3/$2):((1/$2+$3/($2*$2))*2*$6):(column(-2)) with yerrorbars linecolor variable t "rel. Transmission", h1(x), h2(x)

set output "oldl34.tex"
plot "uma_transmission.dat" i 3:4 u ((sin(90-$1))**2):($3/$2):((1/$2+$3/($2*$2))*2*$6):(column(-2)) with yerrorbars linecolor variable t "rel. Transmission", h3(x), h4(x)


#Fit nach dem Malus-Gesetz

set xlabel '$\varphi$'
set xtics 10
set mxtics 5

#f2(x) = B2*(cos(x+v2))**2 + A2
#B2=1
#A2=0.001
#v2=0.001
#fit [-5:5] f2(x) "uma_transmission.dat" u 1:($5/$4):((1/$4+$5/($4*$4))*2*$6) yerror via B2,A2,v2 

#f3(x) = B3*(cos(x+v3))**2 + A3
#B3=1
#A3=0.001
#v3=0.001
#fit [85:95] f3(x) "uma_transmission.dat" u 1:($5/$4):((1/$4+$5/($4*$4))*2*$6) yerror via B3,A3,v3

#Polfilter als letztes Element vor der Probe

#set output "transmission.tex"
#plot "uma_transmission.dat" u  1:($5/$4):((1/$4+$5/($4*$4))*2*$6):(column(-2)) with yerrorbars linecolor variable t "rel. Transmission"

set output "oldt.tex"
plot "uma_transmission.dat" u  1:($3/$2):((1/$2+$3/($2*$2))*2*$6):(column(-2)) with yerrorbars linecolor variable t "rel. Transmission"

#, f3(x), "uma_transmission.dat" u 1:($3/$2) t "rel. Transmission alt" ps 2

set term wxt
Dateianhänge
dateien.jpg
dateien.jpg (178.35 KiB) 1188 mal betrachtet