0

I am currently working on documentation where parts of the software are written in LabVIEW. To share code I am trying to use Snippets. Is there any way to embed the resulting png using luatex while maintaing the drag&drop functionality? (From the generated pdf into LabVIEW)

I think a LabVIEW Snippet consists of an png image with an aditional metadata chunk which encodes the blockdiagram.

Edit: A possible workflow would look like:

  1. Create a LabVIEW Snippet from Labview (The resulting png can also be drag&dropped into LabVIEW, recreating the saved blockdiagram.I am rather sure this is just an additional png chunk, and not realized steganographically.)
  2. Include the graphics into my latex document (generated via luatex).
  3. Ideally the resulting pdf allows to either drag and drop (probably highly viewer dependent) the image, or somehow save the embedded png including the previous metadata. For Adobe Reader and Sumatra PDF, Copy Image seems to copy the pure image data (Which may very well be the only thing remaining in the pdf)

After some further research, I suspect this may be entirely impossible due to the way pdf works, and there is no way to directly embed a png and its metadata.

1 Answer 1

0

There are several ways to read your question, so I will see if I can answer your question stepwise.

First, LuaTeX isn't a traditional wordprocessor, where you can drag&drop images and such onto a position within the document under construction. So the answer to that part is simply: No, you can't maintain drag&drop functionality.

Secondly, you are using software that embeds code information into an image. That is not done in plain mode in the metadata of that image. A program like XNView would be able to read the metadata and hence the code. Snippets uses a form of steganography to encrypt the code into the image. Hence that code can only be read by another Snippet user. That ensures two things for LABView users: (a) VI code can be shared within a community of users and (b) the code stays within the LABView community (is useless to others).

Thirdly, the drag&drop functionality is only available inside a LABView environment and sometimes the image has to be saved in a file before it can be transferred into a LABView environment, That is clearly explained in the support page you referred to.

So how to get the code and image into your document then?

Images can be imported using the graphicx package. Code can be typeset with the listings package for example. The manuals of these packages will guide you how to do that.

Embedding an image into a LuaTeX document would look like:

\includegraphics[height=2cm]{snippet_example.png}

Embedding a listing into your document would look like:

\begin{listing}
     lines of code
\end{listing}

An example of this can be found on the support pages of Overleaf: https://www.overleaf.com/learn/latex/Code_listing

Sorry to disappoint you with respect to your question. Still good luck creating an good manual for using LABView.

4
  • Thanks for your detailed answer! Unfortunately it kind of missed my question and i will edit it to make it more clear.
    – Ceron
    Jan 20, 2023 at 11:14
  • 1
    @Ceron Well, the second part of my answer certainly missed your question :-P. But the first part resembles the edit of your question. LABView is aware of the steganographic information inside the image / snippet. Other programs are not. A program like LibreOffice or Word would accept object orientated inclusions, but they too only display the image data, not the hidden information within that image, as you already pointed out.
    – alchemist
    Jan 20, 2023 at 12:01
  • 1
    @Ceron A possible workaround would be to use hyperlinks inside your LuaLaTeX generated PDF document. You could store the snippets of LABView on a webserver (should be accessible to the users of your document) and use hyperref or qrcode to link the snippets' URL to the image in the document. It has the advantage, that you can edit the snippets without having to edit the PDF document as long as the URL doesn't change.
    – alchemist
    Jan 20, 2023 at 12:05
  • This seems to be a resonable workaround, thanks. Hyperlinking to a local folder (via /.) instead of the actual snippet may lead to an acceptable workflow. LabVIEW Snippets definitly have a lot of design flaws imo, but I guess tex is the wrong place to correct them without unresonable effort.
    – Ceron
    Jan 21, 2023 at 15:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .