What is the best way to write a ebook that contains text, math formulas and also simple graphs (lots of them)? Markdown is great, I know I can include images in it but I was wondering if there was any software that allowed me to enter text, formulas AND GRAPHS into a single TEXT FILE from which the actual layout is rendered. E.g. when I'd want to include a graph of the sum of two waveforms, I'd enter something like this: [graph:begin]y=sin(t)+sin(t*1.1)[graph:end] directly into the MD file.
TeX/LaTeX is good for formulas but any image is just reference to eps file that will be rendered to final document.