Posts Tagged ‘ LaTex

Inkscape + Latex on Mac

I thought this was going to be trivial – it seemed so easy on Ubuntu.  But I getting Textex working with Inkscape on a Mac is a bit different.  I found these instructions on the mactex-wiki.  I’m not gonna lie.  It looks terrifying, and involves changing several lines of code in textext.py and textext.inx, and moving and deleting files from various folders in the inkscape package.

So before I embark on that journey, I’m going to try just blindly copying textext.py and textext.inx into the Inkscape extensions folder.  Oh hey, I got the textext item in the Extensions menu:

Next problem:  I click on the Textext option, and get this error:

Couldn’t find python-lxml in Fink, so I tried fink install lxml-py26…. and it didn’t work. :-(

It’s too late to be messing with this tonight. Maybe tomorrow. Or maybe Inkscape is not the answer – there’s got to be a better way!!

Maybe next time I’ll look into this blog post.

Diagrams in Mac

Here we go again… I was trying to draw a little diagram, and since I’m using a Mac, figured I’d look up OmniGraffle.  But OmniGraffle is now $100 for the basic package – and $200 for professional.  It wouldn’t be quite so painful except I got it for free back when I got my old Mac Powerbook back in 2006.

So it’s back to Inkscape.  I love open source!  It was an easy install – I decided to take a pass on compiling from source, and just grabbed the .dmg file from the downloads page. And of course, I already went through the whole Inkscape plus Latex thing a while ago.

And, for fun, here’s a screen shot of Inkscape in action:

… who needs OmniGraffle anyway… (sniffle)

Inkscape + LaTeX? (Textext)

Okay, I’m being really indecisive here… but I finally found one that I think I like (so far).  It’s not perfect, and it’s a bit quirky, but at least I managed to do what I need to do.  Here’s the main website:  http://www.elisanet.fi/ptvirtan/software/textext/. I also found this blog post to be helpful.

I tried making a really simple depiction of Snell’s law, basically showing the relationship between the angles of incidence and refraction and the refractive indices of two layers. In this case, it is sound waves travelling through homogeneous layers of water with different sound speeds. Easy peasy :-) The sketch only took me about 15 minutes to create.

All I had to do was go to Extensions –> textext, set the scale to 2.5, and enter the following text into the box:

\begin{minipage}{5cm}

$\frac{c_{i}}{\sin{\theta_{i}}} = \frac{c_{i+1}}{\sin{\theta_{i+1}}}$

\end{minipage}

Yes, it’s sort of annoying to have to add that \begin{minipage} stuff. I’d much rather have it more behind the scenes, but I suppose that does give you more control. The resulting image looked like this:

So, nothing too special, but it’ll work for now.  I’ll keep an eye out for other options, but I am getting to really like Inkscape, so maybe I’ll stick with it.  There might be other Latex plugins too that work better.  This one is convenient because you can re-edit an equation once it’s been entered.  If it’s a complicated equation, it can be a real pain to re-type the whole thing if there’s only one little mistake.

One more thing I ought to mention: I keep getting this error message. I’ve been basically ignoring it because I’m getting the correct output, but Inkscape is clearly not happy with something:

/home/michelle/.config/inkscape/extensions/textext.py:55: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import os, sys, tempfile, traceback, glob, re, md5, copy

PS: Why did I abandon SketchLatex so quickly, when it seemed so promising this morning? Simply because their website was down. Anyway, the Skencil GUI was a bit old-fashioned Unix-y anyway. That alone would not have stopped me from using it, but combined with other difficulties it becomes a problem. Hence going back to Inkscape
PPS: The only Inkscape drawing I’ve ever done was my little star website icon (see it up there? the purple star on the blue background?)

SketchLatex for equations in Skencil

I’m going to give the SketchLatex plugin a try for adding equations to my diagrams in Skencil. It seems like it’s pretty easy to install and use – the plugin consists of two .py files which just need to go into the Skencil plugin directory.  Once it’s installed, I should be able to go edit –> create –> LaTeX text, and a dialog will come up where I can input the TeX stye equations.

FFT Review

I haven’t done signal processing of any sort for a while now (that’s not to say I ever did very much of it) – but I occasionally find myself needing to do some filtering or frequency spectrum analysis. And as usual, I always need to look up how I did it before. I should really write myself a little cheat sheet. But since I don’t have time for that now, here’s a quick link: FFT Tutorial. It’s from someone in the EE department at the University of Rhode Island. I had a quick look and I like it because it provides some theory, and also a Matlab example (and it’s pretty clearly written using LaTeX – yeah!). And while I’m on the topic of signal processing, here’s a link to a tutorial by Richard Lyons: “Quadrature Signals, Complex but not Complicated“. I like this one because it has a movie trivia question on page 3. And I totally knew the answer without looking.

LaTeX-ing again

Here I am, sitting indoors during a snowstorm, blundering my way through my raytracing script.  Ah, Snell’s law and optics.  What fun!  Anyhow, I realized that it was the perfect opportunity to practice some LaTeX skills.  I’ll be able to describe the theory of what I’m doing in my script.  Not that it’s anything complicated, but it’s enough for me to be able to practice some TeX-style math notation.  Sweet.

Here’s what I’ve got so far, using Emacs.  Easy!  No math yet though.

\documentclass[12pt]{article}
\title{Raytrace script – how it works}
\author{M. Weirathmueller}
\date{1 January 2010}
\begin{document}
\maketitle

\section{Indroduction}
This document is meant to accompany the my raytrace.py script, in an attempt to describe the theory behind what it’s doing.

The main idea is to read two sound speed profiles, and to compare depths computed by a multibeam echosounder for these profiles.

\section{theory}

\end{document}

(incidentally – I just discovered that WordPress source code posting supports LaTeX – fun!)

It was also the first time I’d ever compiled a LaTeX file from the command line. I know, I know, it’s no big deal. But it was new for me!

Created my PDF like this:

pdflatex raytrace.tex

Then looked at it in my PDF viewer like this:

gnome-open raytrace.pdf

gnome-open just opens the file with the default program for that extension. Also – I added an alias to my .bashrc file so that just typing “g file.pdf” works like “gnome-open file.pdf”.

Learn LaTeX again?

On the drive home, I thought of other things.  Such as how much I missed writing up neat little documents in LaTeX.  They turn out so sharp and professional-looking, much better than I’d generally ever get out of Microsoft Word.  I did my thesis in LaTeX, which still left me quite far from expert status, although I like to think I know a bit more about this typesetting language than the average person on the street (by a tiny margin).

As I drove down the free-way, exhausted from a long day on the water, I actually contemplated writing up some of my longer test procedures in a LaTeX document.  It’s really so much cleaner-looking.  Creating tables, references, embedding scripts, and showing equations would be easy, and look great. When I got home, I dug out my old “LaTeX Companion” book – a 1090 page, dog-eared, coffee covered, cross-referenced LaTex reference bible.  I can’t quite see a truly good reason to actually write anything in LaTex. No one else at work uses it, so if I wrote a test document, no one but me could edit it.  Which is really quite short-sighted.  Still, I can’t help but want to do it.

The LaTex website recommends using Tex Live for Linux operating systems.  I can’t remember what I used for my thesis, it was a full GUI program in Windows (TeXnicCenter, maybe?).  I kind of remember one of my profs doing all of his LaTex stuff on the command line – that seems much more difficult.  But I think it’s always cooler to be able to lightning-type in the terminal to make things happen.  It makes it seem like magic (Arthur C. Clarke did say that “Any significantly advanced technology is indistinguishable from magic).