# Submitting a journal article as a single tex file

Although many academic journals readily accept submissions in some format of TeX, indeed some enlightened ones insist on it, it is rare that one can simply send exactly the same document that one has been working on as a submission. Most journals insist on authors using their "house class file", and some have specific style files that define "common macros". Some journals further make one or both of the following demands:

1. That the submission be a single file,
2. That all unnecessary macros be removed.

For example in BioMed Central TeX template files (the linked page seems to be an unofficial copy, but I could not find an official one online), Sections 2.2 and 2.3 say:

2.2: In order to submit a manuscript as a .tex file to BioMed Central, you must

• use the BioMed Central template
• format your references with BibTeX using the bmc_article.bst style file
• not rely on any non-standard macros, classes or files

2.3: Make sure that you only a single .tex document for the entire manuscript, as you will need to upload it as a single file (together with its associated formatted bibliography file). Do not use the \input command to include other .tex files.

Obviously, some journals adhere to these more strictly than others and the first thing to do is to determine whether these requests are enforced or not (and what, exactly, is considered "non-standard"). So let us suppose that this has been done and the answer is: yes, these are enforced. Then the question is: how does one do this?

In all likelihood, there is not a simple answer, in which case it will be extremely valuable to know what strategies and workflows others have employed. (But please do not name-and-shame journals who make these requests. It may not be the journal but the publisher, and I'm sure that the journals could provide equally horrific stories of the TeX-mangling that they've received.)

One thing to take note of is that the additional files may not just be style files or bibliography files but images as well. For example, in the BioMed instructions given above, the reason given for this request is that the upload is to be a single file (and let us, for the sake of argument, assume that archived files are not allowed).

Thus we can divide this in to various scenarios:

1. The journal asks that the submission contain only one TeX file. So image files and bibliography files are fine as extras. We assume also that it is possible to identify which extra files should be included, but they may be a combination of user-written style files and packages downloaded from CTAN. The task is to fold all of these in to a single file. How do we make these in to a single file, and what pitfalls are there to be aware of?

2. The journal asks that the submission contain only one file in total. Now we wish to embed non-standard type files into our TeX file. Is this possible? and if so, how, and what pitfalls are there to be wary of?

3. The journal asks that unnecessary macros/commands be removed. Are there any strategies for going through a document and identifying those commands which have been defined but never used?

-
at the bottom of the biomed central template page, there's a link to the main info page. at the bottom of that, there's a "contact us" link. why don't you ask what they consider to be "nonstandard" (or, probably simpler for them, what they consider to be "standard), and that they add it to the page where they request that nonstandard files not be used. –  barbara beeton Mar 3 '11 at 15:39
Good suggestion, thanks. Will do. –  Faheem Mitha Mar 3 '11 at 15:41
Whilst, of course, in any given instance it is probably the right thing to do to contact the journal and find out just how strict they are, it is the case that several journals (including maths journals) make this requirement and when trying to be nice to the journal (in the hope that they'll publish the article!), one is still faced with the issue of collapsing a document with several "non standard" style files in to one. Often they also say, "please remove all unnecessary commands", which is a bit of a nightmare in itself! So I think that the broader question here is worthwhile. –  Andrew Stacey Mar 3 '11 at 19:20
@Andrew, at the AMS we do say "please remove all unnecessary commands" (and sometimes authors don't and it's a real nightnmare), but we also find it to our benefit to say specifically which packages (at least the ones we know about) are not compatible with our production requirements. maybe other publishers don't do that, but they're being shortsighted if they don't. –  barbara beeton Mar 3 '11 at 21:00
@barbara: Well, BMC came back with a list of supported packages. I hope they add it to their template. Thanks again for the suggestion! –  Faheem Mitha Mar 17 '11 at 16:16

An alternative is arlatex. You have to specify the dependencies explicitly, I think, but it bundles them all up in one plain latex file which you can then upload and running latex on the resulting file will automatically extract the dependencies locally.

(See Martin Scharrer's answer to my question here.)

-
arlatex has one small disadvantage. its documentation points out that when unbundling, it will not write out any file that exists anywhere that latex can read it. if an author needs features of a very new ctan/tex live package, and includes that file in the bundle, a production site with an older version installed will be faced with an unexpected problem. since procedures are often automated, it may not be easy to figure out what the problem is. resolving such problems is time consuming and expensive. it's a balancing act. –  barbara beeton Aug 2 at 13:51
True. You could try to rename your very new ctan package foobar to foobarnew and include that in the arlatex bundle. (Given you manage to figure out that this is the problem) –  Turion Aug 2 at 21:03

Regarding

2. The journal asks that the submission contain[s] only one file in total.

the bundledoc package comes to mind:

The bundledoc package is a post-processor for the snapshot package that bundles together all the classes, packages and files needed to build a given LaTeX document.

-
Interesting. I'm not sure how open journals are to the idea of working with additional classes and packages, even if it bundled with the document files. They seem to freak out at the idea of the extra work. Additionally, sometimes they are using custom conversion programs for LaTeX, and "non-standard" programs break those. –  Faheem Mitha Sep 13 '11 at 2:02
1. If copying some style files in to ones preamble when using LaTeX, put \makeatletter beforehand and \makeatother afterwards (see What do \makeatletter and \makeatother do? for more details on these).
2. The cmdtrack package can be useful in figuring out which commands that have been defined have actually been used. It has some limitations (It can only check commands that have been defined using \newcommand, \newenvironment, and a few others, but not \def and its friends).