How to include draw.io diagrams into LyX documents

  1. In draw.io in the browser, go to the File menu, Export submenu, export as PDF. (I did not succeed in getting SVG output to work with LyX.) Select "crop" in the PDF export dialog. Export the PDF to the same directory where your LyX document is.

  2. In LyX, go to the Insert menu, choose Float, choose Figure. (A "float" creates the style that the diagram is at the top or bottom of the page, as opposed to inline.)

  3. In the new "figure", type in the name (e.g. "Database Diagram"), this will appear in the figure's caption.

  4. With the cursor in the caption, use the Insert menu, choose Label. (You can't add cross-references to figures unless you add a "Label" which will be the thing referenced by the cross-reference.)

  5. In the figure, above the caption, place the cursor. Use the Insert menu, Graphics. Choose the PDF file. Set the width to be 100% of the column width, meaning the graphic is full-width. The graphic will not show up in the LyX preview, but does show up in the output.

  6. In your text, write text such as "see figure" and then use the Insert menu, Cross-Reference, select the "Label" you created earlier. Use either the format "<reference>" (just inserts the figure number e.g. "1.2") or "<reference> on page <page>".

P.S. I recently created a nerdy privacy-respecting tool called When Will I Run Out Of Money? It's available for free if you want to check it out.

This article is © Adrian Smith.
It was originally published on 6 Feb 2017
More on: Documentation