General ⇒ merging LATEX files into one LATEX file (not a PDF or othe
merging LATEX files into one LATEX file (not a PDF or othe
I am submitting a new paper to the arXiv, and I have TWO LATEX files, while they require only ONE LATEX file. So I need to merge my files into one -- but it's got to be a LATEX file. So regular commands like "\include" or "\input" don't work for me for they would generate as an output only PDF of GS merged files. I failed to find an appropriate recipe; can anybody help me? I work with ubuntu LINUX, 13.1 I believe...
Thanks,
Alex
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
- Posts: 89
- Joined: Fri Jan 24, 2014 12:42 am
Re: merging LATEX files into one LATEX file (not a PDF or
merging LATEX files into one LATEX file (not a PDF or othe
Correct, they are of different classes; sorry for not mentioning it before.StarValkyrie wrote:Okay, let's just rule out the obvious first - presumably you can't just cut and paste, perhaps because the two are different document classes?
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
merging LATEX files into one LATEX file (not a PDF or othe
two documentclass? Now my question: Why? We might lead you to alternatives, but we have to know what is going on.
From the top of my head, i would suggest compiling one file and inputting the resulting pdf in the document. Not sure, if this would be ok with arXiv tough.
Another thing is always the
filecontents
-environment writing it's contents to a file at run time.merging LATEX files into one LATEX file (not a PDF or othe
Johannes, thanks.Johannes_B wrote:Hi and welcome,
two documentclass? Now my question: Why? We might lead you to alternatives, but we have to know what is going on.
From the top of my head, i would suggest compiling one file and inputting the resulting pdf in the document. Not sure, if this would be ok with arXiv tough.
Another thing is always thefilecontents
-environment writing it's contents to a file at run time.
> compiling one file and inputting the resulting pd
Well, of course I can simply produce two PDF files and then just merge them, by using any PDF-merging command, e. g. pdfunite. I've done that, and submitted to arXive. They wrathfully rejected it -- no PDF generated from LATEX is for them... I expect the same problem with Phys. Rev. Lett.
> the
filecontents
-environment writingWell, I am afraid you are talking over my head. It might be helpful if you were a bit more specific... Frankly, the entire LATEX thing is a bit foreign to me; I came from "troff" and UNIX -- you have a dinosaur here...
Once again -- I need a merged file to be again a full blown LATEX, whatever the procedure might be called.
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
merging LATEX files into one LATEX file (not a PDF or othe
pdflatex
-shell-escape
. It includes another document usingfilecontents, compiles this document and later includes it using
package pdfpages.
Code: Select all
\begin{filecontents}{\jobname-external.tex}
\documentclass{article}
\usepackage{showframe}
\begin{document}
\Huge I am the external document
\clearpage
I am on the next page.
\end{document}
\end{filecontents}
\documentclass{scrartcl}
\usepackage{pdfpages}
%The following line is just for demonstration and should in
%general not be done
\immediate\write18{pdflatex \jobname-external}
\begin{document}
I am an article using documentclass \texttt{scrartcl} and i can
include pdf files using package \texttt{pdfpages}.
\includepdf[pages=-]{\jobname-external.pdf}
This again is the \emph{mother} document. Did you notice the
different page sizes?
\end{document}
user, you should be familiar with reading documentation and
finding stuff

in place for 20 years. One might say this is a bit of history on
it's own.
Re: merging LATEX files into one LATEX file (not a PDF or
Will start working on it right away. The way I understand it at the moment, is that I
do the first file as a "regular" LATEX file, and as a next step include another one
-- this time a PDF-file. If this is true, I suspect I'll get kicked out by arXiv (they
hate PDF in any form or shape), but at least I'll learn a new trick

Thanks again.
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
merging LATEX files into one LATEX file (not a PDF or othe
Johannes_B wrote:two documentclass? Now my question: Why? We might lead you to alternatives, but we have to know what is going on.
Hi, you still haven't given us a simple clue on what the different files are. There might be a super simple solution to this.
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
merging LATEX files into one LATEX file (not a PDF or othe
filecontents
environment writes its content to a file specified in the argument, in this case \jobname-external.tex
(basenameOfYourMainFile-external.tex). You can write any text you want to a file, scientific data, bibliogrphies ...This file is later compiled by pdflatex through the line
immediate\write18{pdflatex \jobname-external}
.The generated pdf is included in the document using package pdfpages. You can include any pdf document.