# Need to export LyX doc as single file; figure files local, bib inline, and *tested*

The final submission process for a paper I've composed in LyX requires submission of a single `.tex` file. I've had some success toward that goal but I still have some major gaps towards getting that all ironed out.

There are a couple of related questions on this site, which makes me wonder whether I should submit an "Export as Flat" feature request to the LyX folks, but this journal's requirements may be unusual; I don't really know. They can be found at 1.

So, I dug into the `.tmp` files that LyX creates (and I'm on Mac, so that's a little tricky to start with) and found some of what I wanted: a `.tex` file with all of the file names for figures collapsed to remove all directories, all of the actual figure files, and a `.bbl` file.

However, my first problem is that it's been so long since I've tried to use LaTeX directly, I'm at a loss of how to finish it all off.

One complication being that the TeX utils don't even seem to be on my path at the command prompt. I thought that I'd be able to at least find the path to the LaTeX executable thingy in "Preferences", where it has the path for things like `dvips`, but alas I'm still stuck.

I'm sure that the `.bbl` file gets turned into `.tex` and some point, but I haven't been able to find such a thing among the `.tmp` files produced by LyX, or figure out/remember how that part of it works.

And I feel like to need to be able to do the `tex2dvi` thing on the files once I've got them ready for submission, so that I can make sure it all still works like it did in LyX to produce the PDF.

And I thought that I would see the commands used in the `.log` file. But in there I could only see the output from those commands, and not the actual commands used (maybe that should be a LyX feature request, too).

Anyway, any insight that a LyX veteran could provide would be greatly appreciated.

-

From within LyX File->Export->as LaTeX. It makes sense to export it into the current directory of the LyX file. Then run the file from the terminal window:

``````pdflatex <file>
bibtex <file>
pdflatex <file>
pdflatex <file>
``````

This is what LyX does for you if running the LyX doc. That should create the files .pdf and also .bbl

-
If I understand the OP correctly, the compilation isn't even necessary as he or she needs to submit a .tex file (which is a bit odd). In case there are other files needed to be included (e.g. a bibliography), the filecontents package might be of help. –  doncherry Oct 26 '11 at 14:57
@doncherry: The tex-file is already there, but not the bbl, if you are not in the temporary directory of LyX. And that bbl is created with my sequence –  Herbert Oct 26 '11 at 15:05
The reason why I didn't use the File->Export->LaTeX is that it retains a full path to the figure files, whereas the .tex file that I found in the tmp directory had not only copied all of the necessary figures into that same directory but also updated the filename for the figures in the same way. –  user8819 Oct 27 '11 at 13:31

I found that if I just replaced the lines that read ```\bibliographystyle{...} \bibliography{...}``` with the contents of the `.bbl` file, then that satisfied the requirement that the bibliography be contained within the tex file (no separate `.bib` files were allowed).

-