When I write a paper, I typically use a separate file with definitions and put figures into a separate directory. Moreover, I might have sources for the figures and other other extra files in the paper's directory. This works fine up to the point where I want to send the paper to a journal. Then I want to send only the files actually required for compilation. Moreover, many journals don't accept directories, so the directory structure has to be "flattened".
Is there a tool that can do this? The tool should work on Windows with MiKTeX and be able to:
- given the main source, file copy it to a given directory (let's call it TGDIR)
- copy all included source files to TGDIR, rewriting the include command if they were in another dir.
- copy all used figures to TGDIR, again rewriting the include command if needed
- make a .bib file including only the cited references and copy it to TGDIR
- it would be nice if the tool could find .bib files in the main TeX tree
- update the source so it uses the new .bib file
If there is no tool that can do all of the above, I would also be grateful for tips about things that can do only some of the steps - then it should be command-line tools, so I can use them in a script.
So far, I have found several tools for 4., but only bibfish worked for me on Windows without a need to compile things (I want something I can recommend to others as well). I know that Jabref can do it as well, but I got mixed results when using it from command line.
I have also found texdirflatten which claims to do 1.-3., but it did not handle figures - and it has not been updated in 6 years...
latexpandsolves 1. and 2. (in a way), but not the rest. It is distributed with MiKTeX as well. – Michal Kaut Nov 29 '23 at 10:02\bibliographyand simply\inputthe generated .bbl which will be in your local directory anyway. – David Carlisle Nov 29 '23 at 10:11