0

我正在尝试将在 pysub 环境中生成的 tikz 图片外部化(来自 pythontex 包)。

我在这里使用的不同编译步骤是:

  1. 卢拉泰克斯
  2. Pythontex
  3. 卢拉泰克斯

如果我不激活外部化,通过注释\tikzexternalize[]命令,一切正常。

当我将 tikz 图片外部化而没有放置在 pysub 环境中时,一切正常。

所以问题实际上是关于在 pysub 环境中使用的 tikzpicture 。“问题”在2016年就在这里提出来了。

我有点希望有人会在此期间找到解决方案。

% arara: lualatex: {shell: true}
% arara: pythontex
% arara: lualatex: {shell: true}

\documentclass[a4paper,10pt]{article}

\usepackage{pythontex}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
% \tikzexternalize[prefix=tikz/]
\tikzset{external/system call={lualatex \tikzexternalcheckshellescape -interaction=nonstopmode -jobname "\image" "\texsource"}}
%\tikzexternalize[]

\begin{document}

\begin{pycode}
from sympy import *
x=Symbol('x')
f1=2*x-2
xmin,xmax,ymin,ymax=-3.5,3.5,-3.5,3.5
\end{pycode}
%
\begin{pysub}
\begin{tikzpicture}[]
  \begin{axis}[scale=.8,
    xmin=!{xmin},xmax=!{xmax},
    ymin=!{ymin},ymax=!{ymax},
    domain=!{xmin}:!{xmax},
    restrict y to domain=!{ymin}:!{ymax},
  ]
    \addplot[] (x,{!{f1}});
  \end{axis} 
\end{tikzpicture}
\end{pysub}

\end{document}
4

0 回答 0