I am the author of a commercial product called EnableTeX, which I've just released. The question in the title is what I asked myself several years ago while struggling to publish research that used a lot of Mathematica computation. That Qn eventually led to here.
To answer the question in the title, I created a new cell style. The new cell style was similar to TextText
, in that text could be edited within the new cell. However, the new style specified a CellEvaluationFunction
for the cell. Let's call it f
. This means that when the cell is evaluated, it returns the value f[_str_]f[str]
, where _str_str
is the string contents of the cell.
I knew then that the definitive answer to my question is YES! My reasoning was as follows: If f[_str_]f[str]
returns Null
then the new cell will not only look like a TextText
cell, it will also print no OutputOutput
cell in the notebook (also like a TextText
cell). Instead of printing output, f[_str_]f[str]
could write _str_str
to a file, have it processed by pdflatexpdflatex
, and then the resulting PDF file could be displayed by an auto-reloading PDF viewer.
Here is a complete working code for the One-Cell-Editor. The style definition needs to be saved in a stylsheetstylesheet and the definition for the function OneCellEditor OneCellEditor
(which is called ff
in the above) needs to be evaluated in the notebook:
To get it going, insert a One-Cell-EditorOne-Cell-Editor
cell into the notebook (it will be at the top of the cell style menu because of the MenuSortingValue
that has been used), and open an auto-reloading PDF viewer for demo.pdfdemo.pdf
. Whenever the cell is evaluated, the LaTeX document it contains will be displayed. Note: Open notebooks have to be re-opened before a changed style file will take effect.
Of course, Mathematica allows for a few improvements to the One-Cell-Editor. A multi-cell version of the editor can offer built-in notebook features such as notebook headings and collapsible sections that surpass those of many LaTeX editors. If one also factors in the potential for interleaved Mathematica calculations, and the possibility of having selected results automatically translated to LaTeX and written to file, then the possibilities become quite awesome...
...now, several years later, I'm happy The ideas that I've found useful to announceimplement and the way that EnableTeX has been released :)
The I use Mathematica to generate LaTeX documents are described in the EnableTeX user guide for EnableTeX is available for, which can be download here: EnableTeX-UserGuide.pdf.
Licenses for EnableTeXEnableTeX are not free and the code may not be distributed. Nevertheless, licensees have access to the source code, and are allowed to modify their copies of the code if they want to.