3

I have this code and it is not compiling. What's wrong whit it?

%% AMS-LaTeX Created with the Wolfram Language : www.wolfram.com

\documentclass{article}
\usepackage{amsmath, amssymb, graphics, setspace}

\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}[1]{{}}

\newcounter{mathematicapage}
\begin{document}

<<\text{Units$\grave{ }$}\\
\text{ppgfttoPSI}=0.0519481;

Dado PI e PO, rint e rext, faz o c{\' a}lculo da tens{\~ a}o radial e tangencial

\text{ComputeRadialAndTangetialStress}[\text{r$\_$},\text{ri$\_$},\text{re$\_$},\text{PI$\_$},\text{PO$\_$}]\text{:=}\text{Block}[\{\text{sigr},\text{sigtheta}\},\\
\text{sigr}=(\text{PI} (r{}^{\wedge}2-\text{re}{}^{\wedge}2) \text{ri}{}^{\wedge}2+\text{PO} \text{re}{}^{\wedge}2 (-r{}^{\wedge}2+\text{ri}{}^{\wedge}2))/(r{}^{\wedge}2
(\text{re}{}^{\wedge}2-\text{ri}{}^{\wedge}2));\\
\text{sigtheta}=(\text{PI}(r{}^{\wedge}2+\text{re}{}^{\wedge}2) \text{ri}{}^{\wedge}2-\text{PO} \text{re}{}^{\wedge}2 (r{}^{\wedge}2+\text{ri}{}^{\wedge}2))/(r{}^{\wedge}2
(\text{re}{}^{\wedge}2-\text{ri}{}^{\wedge}2));\\
\{\text{sigr},\text{sigtheta}\}\text{//}N\\
];


\end{document}
9
  • 2
    That one line on its own is not a complete document so will give multiple errors if anyone tries it, please make a complete small document that generates the error that you are asking about. – David Carlisle Jan 28 '17 at 16:06
  • If you load amsmath and insert the expression inside $ $ for example, it should work. – Sigur Jan 28 '17 at 16:07
  • 3
    I guess that at Wolfram they aren't much interested in TeX output, seen what rubbish code their converters produce. It's hard to tell what's not wrong, because all is. – egreg Jan 28 '17 at 16:21
  • 3
    It'll be easier if you tell us what you're trying to write (a screenshot will do) and we tell you how. – Maurizio Jan 28 '17 at 16:37
  • 1
    I'm writing a report and i want to include the code in it. But i'will do it by hand. I appreciate all the help, but i give up of generating a tex code automatically with Mathematica. As said by @egreg the automatic generated code is terrible. – Diogo Jan 28 '17 at 16:51
6

It's hard to improve such horrible code without essentially rewriting it from scratch. Even adding $ at appropriate spots produces nothing really similar to typeset output, but just letters and symbols one next to each other without any clue for understanding the code.

$<<\text{Units$\grave{ }$}\\
\text{ppgfttoPSI}=0.0519481;$

Dado PI e PO, rint e rext, faz o c{\' a}lculo da tens{\~ a}o radial e tangencial

$\text{ComputeRadialAndTangetialStress}[\text{r$\_$},\text{ri$\_$},\text{re$\_$},\text{PI$\_$},\t$
\text{sigr}=(\text{PI} (r{}^{\wedge}2-\text{re}{}^{\wedge}2) \text{ri}{}^{\wedge}2+\text{PO} \tex$
(\text{re}{}^{\wedge}2-\text{ri}{}^{\wedge}2));\\
\text{sigtheta}=(\text{PI}(r{}^{\wedge}2+\text{re}{}^{\wedge}2) \text{ri}{}^{\wedge}2-\text{PO} \$
(\text{re}{}^{\wedge}2-\text{ri}{}^{\wedge}2));\\
\{\text{sigr},\text{sigtheta}\}\text{//}N\\
];$

enter image description here

Something like

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

\begin{document}

\begin{verbatim}
<<Units`
ppgfttoPSI=0.0519481;

Dado PI e PO, rint e rext, faz o cálculo
da tensão radial e tangencial

ComputeRadialAndTangetialStress}[r_,ri_,re_,PI_,PO_]:=
Block[{sigr,sigtheta},
  sigr=PI(r^2-re^2) ri^2+PO re^2 (-r^2+ri^2))/(r^2(re^2-ri^2));
  sigtheta=(PI(r^2+re^2) ri^2-PO re^2 (r^2+ri^2))/(r^2(re^2-ri^2));
  {sigr,sigtheta}//N
];
\end{verbatim}

\end{document}

might be better and even simpler to copy and paste.

enter image description here

6

This tex code is still pretty poor but runs without error and may be a start towards hand correcting the generated code.

enter image description here

\documentclass{article}
\usepackage{amsmath, amssymb, graphics, setspace}

\usepackage[T1]{fontenc}

\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}[1]{{}}

\newcounter{mathematicapage}
\begin{document}

<<\text{Units$\grave{ }$}\\
\text{ppgfttoPSI}=0.0519481;

Dado PI e PO, rint e rext, faz o c\'{a}lculo da tens\~{a}o radial e tangencial

\begin{multline}
\text{ComputeRadialAndTangetialStress}[\text{r$\_$},\text{ri$\_$},\text{re$\_$},\text{PI$\_$},\text{PO$\_$}]\text{:=}\\
\text{Block}[\{\text{sigr},\text{sigtheta}\},\\
\text{sigr}=(\text{PI} (r{}^{\wedge}2-\text{re}{}^{\wedge}2) \text{ri}{}^{\wedge}2+\text{PO} \text{re}{}^{\wedge}2 (-r{}^{\wedge}2+\text{ri}{}^{\wedge}2))/(r{}^{\wedge}2
(\text{re}{}^{\wedge}2-\text{ri}{}^{\wedge}2));\\
\text{sigtheta}=(\text{PI}(r{}^{\wedge}2+\text{re}{}^{\wedge}2) \text{ri}{}^{\wedge}2-\text{PO} \text{re}{}^{\wedge}2 (r{}^{\wedge}2+\text{ri}{}^{\wedge}2))/(r{}^{\wedge}2
(\text{re}{}^{\wedge}2-\text{ri}{}^{\wedge}2));\\
\{\text{sigr},\text{sigtheta}\}\text{//}N\\
];
\end{multline}


\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.