我正在尝试在 TeXShop 中使用 Pythontex,但我的引擎不工作,这是我的 pythontex 引擎
#!/bin/zsh
# For anaconda distribution of Python, use
#PATH=~/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/Library/TeX/texbin:/Users/enzob/anaconda3/bin
#PATH=/Users/enzob/anaconda3
#PATH=/usr/local/bin
# For system distribution of Python, use
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/Library/TeX/texbin
filename=$1
pdflatex --file-line-error --synctex=1 $1
/usr/local/texlive/2023/textmf-dist/scripts/pythontex/pythontex3.py $1
pdflatex --file-line-error --synctex=1 $1
您在那里看到的每个 PATH 都不起作用。
我正在使用名为的这个 latex 文档测试我的引擎1-A.tex
:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pgf,interval}
\usepackage{pythontex}
%%Ensemble des programmes python
%\input{/Users/jlebovits/Dropbox/5-Latex_et_tous_logiciels_de_math_et_terminal/1-Latex/2-Fichiers_Tex_a_inclure/Inputgene/Prog_Python.tex}
\begin{document}
\begin{pycode}
from sympy import *
x, y = symbols('x y')
\end{pycode}
\section{Développements, factorisations...}
Une expression : $x(x + 2y)$
\begin{pycode}
exp = x*(x + 2*y)
dev_exp = expand(exp)
print('diff is diff')
\end{pycode}
La dérivée de la fonction définie par $\cos(x)$ est : $\py{latex(diff(cos(x), x))}$
Le développement de $x(x + 2y)$ est $\py{latex(dev_exp)}$
\begin{sympycode}
A = Matrix([[1, 2], [3, 7]])
\end{sympycode}
%
\begin{equation}
A
=
\sympy{A}
\end{equation}
%
%
\begin{equation*}
A^2
=
\sympy{A**2}
\end{equation*}
eofieofijoij
\end{document}
这是我遇到的一些错误:因为PATH=/usr/local/bin
我遇到了错误/Users/enzob/Library/TeXShop/Engines/pythontex.engine:13: command not found: pdflatex
因为PATH=~/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/Library/TeX/texbin:/Users/enzob/anaconda3/bin
我已经
restricted \write18 enabled.
entering extended mode
(./1-A.tex
LaTeX2e <2023-06-01>
L3 programming layer <2023-06-16>
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/inputenc.sty)
(/usr/local/texlive/2023/texmf-dist/tex/generic/babel/babel.sty
(/usr/local/texlive/2023/texmf-dist/tex/generic/babel/txtbabel.def)
(/usr/local/texlive/2023/texmf-dist/tex/generic/babel-french/french.ldf))
(/usr/local/texlive/2023/texmf-dist/tex/generic/babel/locale/fr/babel-french.te
x) (/usr/local/texlive/2023/texmf-dist/tex/latex/carlisle/scalefnt.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/mathtools/mathtools.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/tools/calc.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/mathtools/mhsetup.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsopn.sty))) (./1-A.tex
./1-A.tex:1: LaTeX Error: Two \documentclass or \documentstyle commands.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1 \documentclass[12pt,a4paper]{
article}
这是我犯的两个错误。
如果我理解正确的话,PATH
我的 python exe 在哪里?我已将它们放置在 中/usr/local/bin
。
我也有 anaconda3 /Users/enzob/opt/anaconda3
。
/usr/local/texlive/2023/textmf-dist/scripts/pythontex/pythontex3.py
是 pythontex3.py 所在的位置。
我的文档1-A.tex
可以工作,因为当我使用以下命令从终端窗口手动编译它时,我得到了我想要的东西:
pdflatex 1-A.tex
pythontex 1-A
pdflatex 1-A.tex
有什么帮助或建议吗?