Re: Linebreaks and style when saving as TeX

• To: mathgroup at smc.vnet.net
• Subject: [mg32842] Re: Linebreaks and style when saving as TeX
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Fri, 15 Feb 2002 02:49:40 -0500 (EST)
• Organization: Universitaet Leipzig
• References: <a4fmea$j04$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

Hi,

your first problem is an internal problem of the FrontEnd.
Because the FrontEnd use in may cases expressions that are
broken into manual placed boxes it must force TeX to do the
same. But TeX don't like such placements with explicit
horizontal and vertical skips. I don't believe that
a TeX output that is readable *and* look almost perfect in
the dvi-file is possible with the FrontEnd. The best solution
to avoid the explicit placements is to typeset the input
in an alltt-environment and switch to the math-mode when a non-space
charackter begins. But that needs a complete rewritten TeXSave[]
command.

Your second problems is simple. TeXSave[] generate \frac's when
it finds a FractionBox[] and
FractionBox[a,b]  is transformed into \frac{a}{b}
while a/b is left unchanged.

I have written a TeX-FrontEnd that read a (allmost)
TeX file it looks for
special Mathematica input-environemtns. The contents of this
input-environments
send to the Mathematica kernel and the TeXForm of the result
is inserted into the output file. If you like the idea
I can send you the program, the style files and all the other
stuff. It's perfect for processing books, manuals with Manthematica
input.

Regards
Jens

Johan Simon Seland wrote:
>
> I am trying to include a rather small ~50 line notebook in a LaTeX
> document. I use "Save as special"->TeX and save the notebook.
>
> When I run latex on the notebook the result is not good.
> The main problem is that it is to aggressive inserting linebreaks in the
> .tex source file. An expression like
>
> [1] = m[T_,t_] := Position[T,_?(# > t &),1,1][[1]][[1]] - 1
>
> is broken into three lines. Like this.
>
> \dispSFinmath{
> \MathBegin{MathArray}{l}
> \mu [\Mvariable{\ScriptCapitalT \_},\Mvariable{t\_}]:=  \\
> \noalign{\vspace{0.555556ex}}
> \hspace{1.em} \Mfunction{Position}[\ScriptCapitalT ,\_?(\#>t\&),  \\
> \noalign{\vspace{0.555556ex}}
> \hspace{5.em} 1,1][[1]][[1]]-1\\
> \MathEnd{MathArray}
> }
>
> I also have some fractions in my notebook. I would like them to be saved
> as \frac{foo}{bar} and not (foo)/(bar) in the tex file. Both foo and bar
> are a little complicated, so with the ugly linebreaks it becomes
> unreadable. I have managed to do this before.Then it happened
> automatically.
>
> One third question as well. When I have inserted a line break manually
> in the frontend, it is saved as \IndentingNewLine in the tex file. This
> macro is undefined, just removing it from the sourcefile solves the
> problem.
>
> I am using Mathematica for Students, 4.1 for Linux and I have downloaded