0

I have found the pseudo-latex in the Macos version of OneNote frustrating---I can't get the formulas to look right. What is the simplest method to use LaTeX or pdflatex to make an image of a mathematics formula that I can insert into OneNote as a picture?

My formulas will normally occupy only part of a single line of output, for example $x+y = z$. It would be ideal if Latex were to compute the size of the typeset formula, and then produce a pdf of exactly that size (or slightly bigger). If possible, I would like to avoid my usual time-consuming manual labour of repeatedly cropping and scaling the pdf, so as to get everything looking right. I found a previous discussion at LaTeX math as an image of a specific size but the solution given there involves using additional programs, whereas it seems to me that LaTeX should be able to do a job like this unaided and very well. I also found Pixel-perfect vertical alignment of image-rendered TeX snippets? but that seems to involve a lot of meticulous labour and anyway the product is html, which I don't think is relevant to my problem.

I'm not worried about alignment problems---I will almost certainly have to move the images a little manually in OneNote, no matter what method I use to produce the images.

2 Answers2

1

You might use \documentclass{standalone} for this. Then, set the equation in display mode with \[. You could put other kinds of content inside a \begin{minipage} of the set width.

This should give you a small PDF suitable for embedding in another document, or converting to SVG.

Davislor
  • 44,045
  • After spending some time investigating LaTeXiT, I'm certainly pleased to know about it, and I'm sure I will be using it. Subsequently I looked at standalone and found that this met my needs much better than LaTeXiT, because all the manipulation can be done programmatically. LaTeXiT is designed for interactive use. – David Epstein Oct 17 '20 at 21:08
1

I highly recommend a free macOS program called LaTeXiT, which is supplied with Mac TeX distributions (or available here: https://www.chachatelier.fr/latexit/index.php ). It lets you create a library of equations and expressions that can be sized and drag-and-dropped into other applications. You can also have multiple customized preambles for different situations.

  • This looks as though it is exactly what I need. (But I haven't yet tried it.) – David Epstein Oct 15 '20 at 15:34
  • Yes, it's good. Often my latex input is generated by a python program. Is there a way to get python to write directly to a LaTeXiT screen or file that can be processed by LaTexIT? – David Epstein Oct 15 '20 at 16:11
  • @DavidEpstein The developer is very helpful and responsive and I would suggest contacting him. He would surely know if there's a way to do that. – LaTeXereXeTaL Oct 15 '20 at 23:29