I use plot to create some mathematical graphs that go into papers otherwise written in Latex. For the graph I used today, all I needed was subscripts and a bar over letters. In Latex, it would be $s_q$ and $\bar{e}_{x}$.
I ended up using pict to create custom text that can be used by #:label in plot. But it was incredibly tedious, see code an image at the end.
My questions are how to do the following in a seamless way with plot, maybe some latex->pict function? In increasing order of difficulty:
String with subscript/superscript (the most common case). My answer: if I could figure out how to copy-paste utf-8, that would probably do the job, but seems pretty finicky.
Adding extras such as $\bar{e}$
Integrate full-blown latex with plots
Here is the code and the image it generates, the $\bar{e}$ is not going to win beauty contests anytime soon...
Jens already gave you the answer you probably need, but a couple of microoptimizations for you:
(cons 'foo null) is the same as '(foo) or (list 'foo)
If I understand it correctly then (hc-append (text "D(") e-bar-text (text ")")))
is the same as (text (format "D(~a)" e-bar-text))
In general: (format "string (display): ~a. string (print): ~v. symbol (display): ~a. symbol (print): ~v" "bar" "bar" 'bar 'bar)
yields "string (display): bar. string (print): \"bar\". symbol (display): bar. symbol (print): 'bar". etc
I assume this is some kind of latex misconfiguration on my part? Or is there some setup that I am missing? I read the info on latex-pict, but didn't see anything that I should be doing.
@dstorrs : Yes, thanks for the micro-optimizations, it's still helpful. As for format, that doesn't work. When I do it, I get something like D(#<pict>) instead. I didn't think that format knew what to do with the pict objects, although there may be some way to do it if it is all unicode at least? Or I might be doing it wrong.
You probably meant pdflatex foo.tex, no? That throws an error that it can't find standalone.cls, so I installed it with tlmgr install standalone, after which it complains about not knowing preview.sty, so I tlmgr install preview and voila. It works. Reading the documentation for latex-pict, I now realize that I should have checked that both of those are installed, but it was not crystal clear to me that those were requirements. Maybe make it even more obvious by saying "Ensure that you have the following three packages installed ... You can check that your setup works by running pdflatex ... ....