Custom text in figures with Latex
Building on my last post, I am still talking about writing up engineering calculations with LaTeX. Since then, I have discovered XFig. It is like a mini CAD program that allows you insert LaTeX text into your figures which is then processed when the document is compiled. The basic procedure is explained on XFig's site. I use xfig to generate diagrams with custom LaTeX macros instead of numbers. This way, if the value changes, the changes are written out automatically by the spreadsheet and the figure is updated when the document is recompiled. Lovely. As an example, I have created the following figure below: Notice the LaTeX code in math mode in the figure. The macros are defined in the .tex file on the second and third lines. They begin with \newcommand: You can see the resulting values have been inserted into the figure in the final PDF document.