我使用第一个非常简单的示例从 Wolfram Mathematica 输出了一个 Latex 文件,如下所示https://reference.wolfram.com/language/ref/format/TeX.html 然后我尝试在 Macbook 版本 10.9.4 (Mavericks) 上使用 TexMaker 4.5 对其进行编译。我无法获取 pdf,因为出现错误:
"pdflatex" -synctex=1 -interaction=nonstopmode %.tex
有人知道为什么吗?全文如下:
%% AMS-LaTeX Created with the Wolfram Language for Students - Personal Use
Only : www.wolfram.com
\documentclass{article}
\usepackage{amsmath, amssymb, graphics, setspace}
\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}[1]{{}}
\newcounter{mathematicapage}
\begin{document}
\begin{doublespace}
\noindent\(\pmb{\text{ExportString}[\text{Nest}
[1+1/\#\&,x,5],\text{{``}TeX{''}}]}\)
\end{doublespace}
\begin{doublespace}
\noindent\(\text{$\%\%$ AMS-LaTeX Created with the Wolfram Language for
Students - Personal Use Only : www.wolfram.com$\backslash $n$\backslash
$n$\backslash
\backslash $documentclass$\{$article$\}\backslash $n$\backslash \backslash
$usepackage$\{$amsmath, amssymb, graphics, setspace$\}\backslash $n$\backslash
$n$\backslash \backslash $newcommand$\{\backslash \backslash $mathsym$\}$[1]$\
{\{\}\}\backslash $n$\backslash \backslash $newcommand$\{\backslash
\backslash $unicode$\}$[1]$\{\{\}\}\backslash $n$\backslash $n$\backslash
\backslash $newcounter$\{$mathematicapage$\}\backslash $n$\backslash
\backslash
$begin$\{$document$\}\backslash $n$\backslash $n$\backslash \backslash
$[1+$\backslash \backslash $frac$\{$1$\}\{$1+$\backslash \backslash $frac$\
{$1$\}\{$1+$\backslash
\backslash $frac$\{$1$\}\{$1+$\backslash \backslash $frac$\{$1$\}\
{$1+$\backslash \backslash $frac$\{$1$\}\{$x$\}\}\}\}\}\backslash \backslash
$]$\backslash
$n$\backslash $n$\backslash \backslash $end$\{$document$\}\backslash $n}\)
\end{doublespace}
\end{document}
答案1
嗯,你的代码存在一些问题:
- 您必须注释掉第二行(
% Only :
)。 - 后面有很多换行符
\
。这导致括号 ({
) 无法转义。 - 风格非常糟糕。所有文本都占一行,这确实滥用了数学模式。最好的办法是:查看源代码,丢弃该代码并从头开始重写内容。
我对 Mathematica 不够了解,无法判断它的 LaTeX 功能,但这绝对是一个不好的迹象。
代码:
%% AMS-LaTeX Created with the Wolfram Language for Students - Personal Use
% Only : www.wolfram.com
\documentclass{article}
\usepackage{amsmath, amssymb, graphics, setspace}
\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}[1]{{}}
\newcounter{mathematicapage}
\begin{document}
\begin{doublespace}
\noindent\(\pmb{\text{ExportString}[\text{Nest}
[1+1/\#\&,x,5],\text{{``}TeX{''}}]}\)
\end{doublespace}
\begin{doublespace}
\noindent\(\text{$\%\%$ AMS-LaTeX Created with the Wolfram Language for Students - Personal Use Only : www.wolfram.com$\backslash $n$\backslash
$n$\backslash \backslash $documentclass$\{$article$\}\backslash $n$\backslash \backslash $usepackage$\{$amsmath, amssymb, graphics, setspace$\}\backslash $n$\backslash $n$\backslash \backslash $newcommand$\{\backslash \backslash $mathsym$\}$[1]$
\{\{\}\}\backslash $n$\backslash \backslash $newcommand$\{\backslash
\backslash $unicode$\}$[1]$\{\{\}\}\backslash $n$\backslash $n$\backslash
\backslash $newcounter$\{$mathematicapage$\}\backslash $n$\backslash
\backslash
$begin$\{$document$\}\backslash $n$\backslash $n$\backslash \backslash
$[1+$\backslash \backslash $frac$\{$1$\}\{$1+$\backslash \backslash $frac$
\{$1$\}\{$1+$\backslash
\backslash $frac$\{$1$\}\{$1+$\backslash \backslash $frac$\{$1$\}
\{$1+$\backslash \backslash $frac$\{$1$\}\{$x$\}\}\}\}\}\backslash \backslash
$]$\backslash $n$\backslash $n$\backslash \backslash $end$\{$document$\}\backslash $n}\)
\end{doublespace}
\end{document}