Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %& -jobname=output
- documentclass{book}
- usepackage{tikz,pgfplots}
- usetikzlibrary{external}
- tikzset{external/only named=true}
- pgfplotsset{compat=newest}
- tikzexternalize
- begin{document}
- begin{figure}[h]
- tikzsetnextfilename{sample_tikz}
- begin{tikzpicture}[scale=1.50]
- begin{axis}addplot {x^3};end{axis}
- end{tikzpicture}
- caption{Sample tikz picture.}
- end{figure}
- end{document}
- ===== 'mode=convert with system call': Invoking 'pdflatex -shell-escape -halt-o
- n-error -interaction=batchmode -jobname "sample_tikz" "deftikzexternalrealjob
- {output}input{output}"' ========
- ! Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-e
- rror -interaction=batchmode -jobname "sample_tikz" "deftikzexternalrealjob{ou
- tput}input{output}"' did NOT result in a usable output file 'sample_tikz' (exp
- ected one of .pdf:.jpg:.jpeg:.png:).
- pdflatex tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "image" "texsource"
- stringdefstringtikzexternalrealjob{tikzexternal@realjob}stringinput{tikzexternal@realjob}
- deftikzexternalrealjob{output}input{output}
- deftikzexternalrealjob{output}input{main}
- %& -jobname=output -recorder
- documentclass{book}
- usepackage{tikz,pgfplots}
- usetikzlibrary{external}
- tikzset{external/only named=true}
- pgfplotsset{compat=newest}
- input{externalize-hack.tex} % <---- THIS WAS ADDED
- tikzexternalize
- begin{document}
- begin{figure}[h]
- tikzsetnextfilename{sample_tikz}
- begin{tikzpicture}[scale=1.50]
- begin{axis}addplot {x^3};end{axis}
- end{tikzpicture}
- caption{Sample tikz picture.}
- end{figure}
- end{document}
- usepackage{currfile-abspath}
- getmainfile
- usepackage{xpatch}
- makeatletter
- AtEndDocument{%
- newwritemaindeffile%
- immediateopenoutmaindeffile=jobname.maindef%
- immediatewritemaindeffile{%
- noexpandifcsname mymainfilenoexpandendcsnamenoexpandelse%
- noexpandgdefnoexpandmymainfile{mymainfile}%
- noexpandfi%
- }%
- immediatecloseoutmaindeffile%
- }
- @input{jobname.maindef}
- ifcsname mymainfileendcsname%
- ifxmymainfile@empty%
- % Make a second attempt at extracting the real file name
- % (necessary because currfile needs two runs on MiKTeX..)
- filename@parse{themainfile}%
- letmymainfilefilename@base%
- ifxmymainfile@empty%
- % If still empty, fallback to default behavior
- defmymainfile{tikzexternal@realjob}%
- fi%
- fi%
- else%
- % First attempt at extracting real file name
- filename@parse{themainfile}%
- letmymainfilefilename@base%
- fi%
- xpatchcmd{tikzexternal@assemble@systemcall}%
- {%
- edeftexsource{%
- stringdefstringtikzexternalrealjob{tikzexternal@realjob}%
- stringinput{tikzexternal@realjob}%
- }%
- }%
- {%
- edeftexsource{%
- stringdefstringtikzexternalrealjob{tikzexternal@realjob}%
- stringdefstringmymainfile{mymainfile}%
- stringinput{mymainfile}%
- }%
- }%
- {}
- {}
- letold@tikzexternalize@opt@withnametikzexternalize@opt@withname%
- deftikzexternalize@opt@withname[#1]#2{%
- % Suppress externalization as long as mymainfile is empty
- % (This will only be the case the one or two first compilation runs!)
- ifxmymainfile@emptyelse%
- old@tikzexternalize@opt@withname[#1]{#2}%
- fi%
- }
- makeatother
Add Comment
Please, Sign In to add comment