jkuczm / mmacells

Mathematica cells in TeX
61 stars 18 forks source link

Compilation hangs #31

Open jondoesntgit opened 7 years ago

jondoesntgit commented 7 years ago

Hello,

When I use pdflatex on the following code, compilation never completes.

\begin{mmaCell}{Output}
    \mmaFrac{1}{4} \
  (-\mmaFrac{\mmaSup{e}{-\mmaFrac{\mmaSup{(-I0+ID)}{2}}{2 \
  \mmaSup{s0}{2}}} \
  \mmaSqrt{\mmaFrac{2}{\(\pi\)}}}{s0}+\mmaFrac{\mmaSup{e}{-\mmaFrac{\m\
maSup{(I1-ID)}{2}}{2 \mmaSup{s1}{2}}} \mmaSqrt{\mmaFrac{2}{\(\pi\)}}}{s1})
\end{mmaCell}

Any idea why it hangs?

jkuczm commented 7 years ago

You have newlines in places where they shouldn't be. Especially \mmaSup command is split between 5th and 6th line:

...\m\
maSup{...

Also due to some peculiarities of listings - fancyvrb interface, newlines can't be used inside formatting commands like \mmaFrac, and too many formatting commands can't be used in single line.

There are two main cases when listings in mmacells is useful: automatic styling of identifiers, and replacements of infix operators, none seems to be applicable here, so you can switch off listings by using uselistings=false option:

\documentclass[12pt]{article}

\usepackage{mmacells}

\begin{document}

\begin{mmaCell}[uselistings=false]{Output}
\mmaFrac{1}{4}(-\mmaFrac{\mmaSup{e}{-\mmaFrac{\mmaSup{(-I0+ID)}{2}}{2 \mmaSup{s0}{2}}} \mmaSqrt{\mmaFrac{2}{\(\pi\)}}}{s0}\
+ \mmaFrac{\mmaSup{e}{-\mmaFrac{\mmaSup{(I1-ID)}{2}}{2 \mmaSup{s1}{2}}} \mmaSqrt{\mmaFrac{2}{\(\pi\)}}}{s1})
\end{mmaCell}

\end{document}

Those excessive newlines are usually added by Mathematica. Depending on how you transfer string with TeX code from Mathematica to outside world, there are different ways to avoid them.

Related to jkuczm/MathematicaCellsToTeX#20.

jondoesntgit commented 7 years ago

Is there any way to get around "Dimension too large"

On 30 Nov 2016, at 4:07, Jakub Kuczmarski wrote:

You have newlines in places where they shouldn't be. Especially \mmaSup command is split between 5th and 6th line:

...\m\
maSup{...

Also due to some peculiarities of listings - fancyvrb interface, newlines can't be used inside formatting commands like \mmaFrac, and too many formatting commands can't be used in single line.

There are two main cases when listings in mmacells is useful: automatic styling of identifiers, and replacements of infix operators, none seems to be applicable here, so you can switch off listings by using uselistings=false option:

\documentclass[12pt]{article}

\usepackage{mmacells}

\begin{document}

\begin{mmaCell}[uselistings=false]{Output}
\mmaFrac{1}{4}(-\mmaFrac{\mmaSup{e}{-\mmaFrac{\mmaSup{(-I0+ID)}{2}}{2 
\mmaSup{s0}{2}}} \mmaSqrt{\mmaFrac{2}{\(\pi\)}}}{s0}\
+ \mmaFrac{\mmaSup{e}{-\mmaFrac{\mmaSup{(I1-ID)}{2}}{2 
\mmaSup{s1}{2}}} \mmaSqrt{\mmaFrac{2}{\(\pi\)}}}{s1})
\end{mmaCell}

\end{document}

Those excessive newlines are usually added by Mathematica. Depending on how you transfer string with TeX code from Mathematica to outside world, there may be ways to avoid them.

Related to jkuczm/MathematicaCellsToTeX#20.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/jkuczm/mmacells/issues/31#issuecomment-263858232

Jonathan Wheeler jamwheeler.com fb.com/jondoesntpost twitter.com/jondoesnttweet

jkuczm commented 7 years ago

Again this error most probably originates in listings - fancyvrb interface, try uselistings=false, but without code that gives this error it's hard to say.

jkuczm commented 7 years ago

Or did you mean that code that I posted above gives you this error?

jondoesntgit commented 7 years ago

Hey Jakub,

Above code gives the error

jkuczm commented 7 years ago

Could you post full .log file produced by compilation?