Re: How to write a "proper" math document

*To*: mathgroup at smc.vnet.net*Subject*: [mg120050] Re: How to write a "proper" math document*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Thu, 7 Jul 2011 07:29:40 -0400 (EDT)*References*: <ius5j1$2e6$1@smc.vnet.net> <iuuktr$ers$1@smc.vnet.net>

On Jul 5, 4:18 am, AES <sieg... at stanford.edu> wrote: > In article <ius5j1$2e... at smc.vnet.net>, dr DanW <dmaxwar... at gmail.com> > wrote: > > > Pulling back from the meta-issue of literate engineering, this is the second > > time in as many months the topic of hiding cells for publishing documentation > > has come up in this forum. I think I will experiment a little with using > > cell tags to mark cells for hiding (closing) so switching between the > > development and publishing layout is just a button click. If I come up with > > something I am happy with, I'll post it under a new thread. > > > Daniel > > I would be delighted to see this, and think it would be a very useful > contribution. > > Let me add what I think would be an even more useful -- but I suppose > considerably more difficult -- Mathematica add-on. > > This add-on would comprise: > > 1) A way to capture an executed notebook, including all its output > cells (that is, everything you see on the screen as you scroll through a > notebook, once that notebook has been executed) -- in other words a > simple Save; > > 2) Then a way to run this captured notebook through a totally separate > post-processor program, written in whatever, that would convert this > notebook file into a "touch-up-able" TeX (or LaTex) source file; > > 3) And then, a few steps of hand touch up of this TeX source file, as > needed, followed by running it through TeX or LaTeX to create a polished > PDF document. > > A first, relatively trivially step toward this goal would be to simply > capture the ASCII text content of each cell in the executed document and > insert it as the content of a correspondingly named macro in the TeX > source file. > > That is, each Text cell would be embedded in a \text{---} macro, each > level of Header cell in a \headerlevelnn{---} macro, and so on. We > TeXperts (or even TeXNovices) could then define our own \text{} and > \header{} macros to get the fonts, styles, spacings, and so on that we > would want for our document. Just doing this could vastly improve page > breaks, text formatting, and so on. > > A second step would be to capture the content of each Output graphics > cell in the notebook as a graphics file in PDF, JPG, PNG, or whatever > format; stick this file in the same folder as the primary TeX source > file with a name like "graphictwo.pdf"; and insert a line in the primary > TeX source file saying something like > > \graphic{graphictwo.pdf} > > We TeXNovices could then define our own \graphic{} macro to \input this > graphic, float the graphic to the top of the page, or whatever we wanted > to do with it. (We could also hand-edit the graphic file itself in > Illustrator, should be want to.) > > A third step would be a series of tweaks in which the post-processor > program, in addition to doing steps one and two, would make more > sophisticated conversions of the "innards" of text and header cells, > converting Greek letters and the like from Mathematica notation to TeX > notation, and in general doing anything that could be automated to > convert Mathematica syntax to TeX syntax. > > This approach of course violates the basic Wolfram concept of do > everything -- and they really do mean *everything* -- with one tool. > I've never believed in this myself; use the right tool for the job is > more like my motto. And, the more experience I have with Mathematica > (and TeX) (and other software tools), the more I come to believe in > this. Some others agree; others don't. File > Save As > Files of type > LaTeX Document (*.tex) will do much of this. It saves graphics as extended PostScript (.eps), I think. One can certainly save them in other formats by hand, process further with other tools, etc. As for translation of various cell types to TeX, it can be a bit fiddly and require hand editing afterwards, but generally one gets a reasonable starting point by saving to TeX. This is of course a "Your mileage may vary" scenario. What I can say with certainty is it has worked tolerably well for my purposes. Daniel Lichtblau Wolfram Research (not same Daniel as above in this thread)