Around six weeks ago I enquired about making the document-wide \jobname
available to preview insets. This is difficult, presumably because
previews are needed /before/ LyX invokes latex for whole-document
compilation. At present in a preview inset \jobname gives the name of
the preview, which is of little interest or use. Enrico offered a way
around this by using info-insets, but it meant manually including the
info-inset in each preview inset, rather than something that worked 'out
of the box'.
Some further experimenting provides a step forward. If a one-line text
file containing the job name is created with a fixed name, like
jobname.txt, and placed either in the document directory or the
temporary directory for that LyX document, then it is perfectly possible
to write tex code so that each preview inset that needs the job name can
read this file and thus learn of (the document-wide) \jobname. Data
generated by the preview can then be saved to a file using this name as
a basis.
Placing jobname.txt in the document directory becomes a problem if there
is more than one LyX file in that directory. Hence placing it in the
temporary directory for the document seems the better suggestion. How
difficult would it be when the temporary buffer for a new or newly
opened document is created for LyX to also insert into it the one-line
file jobname.txt containing the document name (preferably without file
extension)?
I realise there would be some further housekeeping involved on the
initial save of a new file, or use of "Save as", but this doesn't seem
burdensome. Making the job name available in a document's temporary
directory like this would fill a hole that currently exists in the
preview mechanism. Once preview is used for more onerous tasks than
simply displaying characters on screen, the ability to save data from a
preview inset becomes a natural consideration and the use of the
document-wide job name desirable.
Andrew
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus