Seite 1 von 1

Fehler bei PDF-Ausgabe von tikz

Verfasst: Di 20. Feb 2018, 11:00
von Kaalundir
Hallo zusammen,

da ich nach einer Suche keine Lösung für mein Problem gefunden habe stelle dich das jetzt zur Diskussion. Es kann auch sein, dass ich den Wad vor lauter Bäumen nicht sehe.

Ich möchte für eine Arbeit ein paar Bilder mit LaTeX/tikz erstellen und als PDF zwischenspeichern.

Das Problem ist, dass das PDF mit allem Abbildungen erzeugt wird, allerdings wird eine der Abbildungen nicht als einzelnes PDF exportiert.

Die Kurzfassung der Datei sieht wie folgt aus:
\documentclass{standalone}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{standalone}
\usepackage{tikz}

%weitere Def

\usetikzlibrary{external} 
 \tikzexternalize

\begin{document}

%erstes Bild
\tikzsetnextfilename{erstes_Bild}
\begin{tikzpicture}
%Zeichnung
\end{tikzpicture}

%zweites Bild - wird nicht einzeln dargestellt
\tikzsetnextfilename{zweites_Bild}
\begin{tikzpicture}
%Zeichnung
\end{tikzpicture}

%drittes Bild
\tikzsetnextfilename{drittes_Bild}
\begin{tikzpicture}
%Zeichnung
\end{tikzpicture}

\end{document}



Die .tex-Datei und das Log sind in komplett Anhang.

Ich bin Dankbar für jede Hilfe.

Verfasst: Di 20. Feb 2018, 11:14
von Gast
erternalize benötigt -shell-escape: → Wie aktiviere ich -shell-escape in meinem Editor?

Achte auf Warnungen in der log-Datei!

Verfasst: Di 20. Feb 2018, 11:18
von Gast
Die }log-Datei passt übrigens nicht zum gezeigten Beispiel. Die Fehlermeldung tritt mit dem gezeigten Beispiel nicht auf. Was soll das?

Verfasst: Di 20. Feb 2018, 11:22
von Gast
Dein TeX Live ist extrem veraltet. Wir sind längst bei TeX Live 2017. In vier Wochen gibt es bereits den Freeze für TeX Live 2018 pretest.

Support für so dermaßen alten Kram ist immer etwas schwierig. Da solltest Du von uns nicht zu viel erwarten. Dein gezeigtes Beispiel funktioniert jedenfalls und erzeugt unter TeX Live 2017 drei PDF-Dateien mit (leere) Abbildungen.

Verfasst: Di 20. Feb 2018, 12:02
von Kaalundir
Das Beispiel, im Eintrag ist extrem gekürzt. Die Datei um der es bei mir geht, sieht folgendermaßen aus:
\documentclass{standalone}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%%%<
\usepackage{standalone}
\usepackage{tikz}
% All other packages required
\usepackage{verbatim}
\usetikzlibrary{quotes}
\usetikzlibrary{angles}
\usetikzlibrary{arrows}
\usetikzlibrary{babel}
\usetikzlibrary{intersections}
\usepackage{sansmath}
\usetikzlibrary{shadings,intersections}
\usetikzlibrary{calc,fadings,decorations.pathreplacing}
\usetikzlibrary{arrows.meta}

\usepackage{graphicx}
\usepackage{wrapfig}

%%%>
% syntax\Angle{<name linie1>}{<scheitelpunkt>}{<name linie2>}{<radius>}{<optionen für pic>}
\tikzset{ myangle/.style={draw,angle radius=#1,}, myangle/.initial=.5cm,}

\newcommand\Angle[5]{
  \path[overlay, name path=c](#2)circle[radius=#4];
  \path[name intersections={of=#1 and c,by={HS1}}];
  \path[name intersections={of=#3 and c,by={HS3}}];
  \pic[myangle=#4,#5]{angle=HS1--#2--HS3};
}

\newcommand\pgfmathsinandcos[3]{%
  \pgfmathsetmacro#1{sin(#3)}%
  \pgfmathsetmacro#2{cos(#3)}%
}
\newcommand\LongitudePlane[3][current plane]{%
  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
  \pgfmathsinandcos\sint\cost{#3} % azimuth
  \tikzset{#1/.style={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{%
  \pgfmathsinandcos\sinEl\cosEl{#2} % elevation
  \pgfmathsinandcos\sint\cost{#3} % latitude
  \pgfmathsetmacro\yshift{\cosEl*\sint}
  \tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
}
\newcommand\DrawLongitudeCircle[2][1]{
  \LongitudePlane{\angEl}{#2}
  \tikzset{current plane/.prefix style={scale=#1}}
   % angle of "visibility"
  \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
  \draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
  \draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}
\newcommand\DrawLatitudeCircle[2][1]{
  \LatitudePlane{\angEl}{#2}
  \tikzset{current plane/.prefix style={scale=#1}}
  \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
  % angle of "visibility"
  \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
  \draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
  \draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
}
\usepackage{subfig}
\usepackage{graphicx}

\usepackage{wrapfig}

%% document-wide tikz options and styles

\tikzset{%
  >=latex, % option for nice arrows
  inner sep=0pt,%
  outer sep=2pt,%
  mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
    fill=black,circle}%
}


\usetikzlibrary{external} 
 \tikzexternalize
 

\begin{document}

%-----------------------------------------------------------
\tikzsetnextfilename{PoincareKugel}
\begin{tikzpicture}[>={Triangle[length=0pt 9,width=0pt 3]}]

\def\R{2.5} % Radius
\def\angEl{35} % Winkel
\filldraw[ball color=white] (0,0) circle (\R);
\foreach \t in {-45,0,45} { \DrawLatitudeCircle[\R]{\t} }
\foreach \t in {0,45,...,135} { \DrawLongitudeCircle[\R]{\t} }

\coordinate (O) at (0,0);
\draw [thick,->] (O) -- (0,1) node[left] {$\mathbf{S_3}$};
\draw [thick,->] (O) -- (0.8660,-0.5) node[above right] {$\mathbf{S_2}$};
\draw [thick,->] (O) -- (-0.8660,-0.5) node[above left] {$\mathbf{S_1}$};

\end{tikzpicture}


%_________________________________________________________________
%Verzögerungsplatte Strahlteiler (polarisiert)
\tikzsetnextfilename{VerzStrahl}
\begin{tikzpicture}[scale=5, axis/.style={very thick, ->, >=stealth'}, important line/.style={thick}, dashed line/.style={dashed, thin}, pile/.style={thick, ->, >=stealth', shorten <=2pt, shorten >=2pt}, every node/.style={color=black},scale=0.5]
  
	% define coordinates
    \coordinate (A) at (0,0) ;
    \coordinate (B) at (2,-1) ;
    
    %grade
    \coordinate (C1) at (0.1396,-0.8603) ;
    \coordinate (C2) at (1.1937,0.1937) ;
    
    \coordinate (D1) at (0.8062,-1.1937) ;
    \coordinate (D2) at (1.8603,-0.1396) ;
 
	&gerade   
    \coordinate (E1) at (1.1404,-1.3866) ;
    \coordinate (E2) at (1.5262,0.0532) ;
	
    \coordinate (F1) at (0.4737,-1.0532) ;
    \coordinate (F2) at (0.8595,0.3866) ;   
    
	\coordinate (a) at(0.6666,-0.3333);
    \coordinate (b) at(1.333,-0.6666);
    
    %ray
    \draw [pile] (A)  -- (B) node[right] {Sensor}; 
    \node (A) [left] {Laser};

    \draw [pile] (F1) -- (F2) node[right] {Verzögerungsplatte};
    \draw [thick] (C1) -- (C2)  node[right] {E\textsubscript{0,x}};
    
    \draw [pile] (E1) -- (E2)  node[right] {Strahlteiler};
    \draw [thick] (D1) -- (D2)  node[right] {E\textsubscript{0,x}};
    
	\pic["$\Theta_v$", draw=black, thick=3, ->, angle eccentricity=1.2, angle radius=1cm] {angle=C2--a--F2};
	\pic["$\Theta_p$", draw=black, thick=3, ->, angle eccentricity=1.2, angle radius=1cm] {angle=D2--b--E2};
\end{tikzpicture}

%----------------------------------------------------------
\tikzsetnextfilename{Pol_Anal}
\begin{tikzpicture}[scale=5, axis/.style={very thick, ->, >=stealth'}, important line/.style={thick}, dashed line/.style={dashed, thin}, pile/.style={thick, ->, >=stealth', shorten <=2pt, shorten >=2pt}, every node/.style={color=black},scale=0.5]
  
	% define coordinates
    \coordinate (A) at (0,0) ;
    \coordinate (B) at (2,-1) ;
    
    \coordinate (C1) at (0.1396,-0.8603) ;
    \coordinate (C2) at (1.1937,0.1937) ;
    
    \coordinate (D1) at (0.8062,-1.1937) ;
    \coordinate (D2) at (1.8603,-0.1396) ;
    
    \coordinate (E1) at (1.1404,-1.3866) ;
    \coordinate (E2) at (1.5262,0.0532) ;

    \coordinate (F1) at (0.4737,-1.0532) ;
    \coordinate (F2) at (0.8595,0.3866) ;   
    
	\coordinate (a) at(0.6666,-0.3333);
    \coordinate (b) at(1.333,-0.6666);
    
    %ray
    \draw [pile] (A)  -- (B) node[right] {Sensor}; 
    \node (A) [left] {Laser};

    \draw [pile] (F1) -- (F2) node[right] {Polarisator};
    \draw [thick] (C1) -- (C2)  node[right] {E\textsubscript{0,x}};
    \draw [pile] (D1) -- (D2)  node[right] {Analysator};
    
	\pic["$\Theta_p$", draw=black, thick=3, ->, angle eccentricity=1.2, angle radius=1cm] {angle=C2--a--F2};
\end{tikzpicture}


\end{document}
Das mit -shell-escape habe ich schon drin, sonst würde ich die andern beiden Bilder ja nicht bekommen.

Mit der Version, mein System ist 32 bit System mit Ubuntu 16.04. Wenn jemand einen Tipp hat, für ein aktuelleres TeX Live, dann gern. Ich benutze momentan den alten Texmaker, die aktuelleren Versionen laufen allerdings, soweit ich weis, nur auf 64 bit.

Verfasst: Di 20. Feb 2018, 12:13
von Gast
Solange Du Fehler im Code hast, solltest Du entweder nicht externalize verwenden oder die log-Dateien der externen pdflatex-Aufrufe ebenfalls beachten:
VerzStrahl.log hat geschrieben:
! Misplaced alignment tab character &.
l.122    &
          gerade 
Ändere den Tippfehler (& statt %), dann dürftest Du auch drei PDFs bekommen. Bei meinem aktuellen TeX Live 2017 funktioniert das jedenfalls.

Vanilla TeX Live gibt es übrigens hier: http://www.tug.org/texlive

Es ist übrigens generell durchaus empfehlenswert ein stark gekürztes Beispiel zu zeigen. Das sollte aber natürlich auch noch den Fehler zeigen und eine gezeigte log-Datei sollte auch davon stammen. Alles andere ist Helferverarsche. Siehe auch: Minimalbeispiel

Verfasst: Di 20. Feb 2018, 12:15
von Kaalundir
Danke für die Hilfe, hat bei mit jetzt problemlos die Dateien ausgegeben.