Molten Syntax Projects

When I have time, I type up notes from school in LaTeX, so that they will be archived and legible for the future. This works ok, but I use many quick illustrations and diagrams, which are a pain to add to a LaTeX document (or at least are in any editor I've used). Also, even when the picture is saved, and in the right format, you can't really control positioning. By design, LaTeX has its own ideas about where it thinks your figure should go. This is good for actual "figures" as you would find in a paper, but I want my little diagrams to be inline with the text and not on the next page. In Word, by contrast, I can select an image and Ctrl C, Ctrl V it right into the document, but LaTeX's formatting of formulas is so much better.

As it turns out, I can have a combination of the two. There is a good open source project, LatexInWord which I recently discovered. Now I can keep the formulas I was using but have more control over layout of pictures. The interface is good - all one needs to do is press Alt-L to insert Latex. Also, I can have this open side-by-side with Lyx in view source mode, or another editor, and copy and paste. (There appear to be similar macros for OpenOffice, like this.)

Of course, I'll still write my actual papers in standard LaTeX, but for my personal notes, this should work well.

Tonight I wrote a quick macro to be used with LatexInWord. It prints out the LaTeX source for all of the formulas in the document. I thought this would be useful to have for archival purposes (in the future I might not have LatexInWord or Word so a plain text copy is good). This is basically my first Word vba script, but it worked when I tested it.
Sub ExportLatexAsText()
    Dim strRes As String
    Dim i As Integer
    Dim newline As String
    newline = Chr(13) & Chr(10)
    i = 1
    For Each currentShape In ActiveDocument.InlineShapes
        If currentShape.AlternativeText <> "" Then
            strRes = strRes & newline & newline & "Formula " & i & newline
            strRes = strRes & currentShape.AlternativeText
            i = i + 1
        End If
    Selection.Text = strRes

End Sub

You can add this to the document under Macros. Just start editing an existing macro, and when you're looking at the source, put this subroutine in.