I want to do the opposite. I'd like to take a
bunch of separate files that Latex uses and put them all into my
*.tex file, deleteing all the supplementary files. The reason is so
that I won't have to keep track of lots
of different files when I'm transferring files from one computer to
another.
Here's one example. Currently, I include the commands
\usepackage{garamond} and \garamond in my *.,tex file. For
them to work, I need to have the file garamond.sty in the same
directory. I'd rather just insert the ten or so lines of garamond.sty
into my *.tex file. If I do that, however, I need some way for
Latex to know to search for those lines in *.tex instead of in a
separate file.
Any ideas on how to do that? It comes up in lots of other
contexts too-- this is just one example.
> I know that Latex has the \input{filename here} command to
> allow you to keep your *.tex file in lots of separate files for
> convenient filing.
>
> I want to do the opposite. I'd like to take a
> bunch of separate files that Latex uses and put them all into my
> *.tex file, deleteing all the supplementary files. The reason is so
> that I won't have to keep track of lots
> of different files when I'm transferring files from one computer to
> another.
See mkjobtexmf. With it's help you can collect the input files.
Then you put the result in a .zip archive or similar and transfer this
single file.
Yours sincerely
Heiko <ober...@uni-freiburg.de>
Thanks. That's one solution, but I don't want to have to specially
process the file for transfer, zipping it up and then unzipping it. (I
might want, for example, to transfer it back and forth from work to
home every day without having to run an unzip program.) If I do that,
I might was well just put it in a directory and copy the entire
directory. Is there any way to keep the file as plain ascii, one
file?
> On Aug 3, 1:56�pm, Heiko Oberdiek <oberd...@uni-freiburg.de> wrote:
> > EricRasmusen <erasm...@Indiana.edu> wrote:
> > > � I know that Latex has the \input{filename here} command to
> > > allow you to keep your *.tex file in lots of separate files for
> > > convenient filing.
> >
> > > � �I want to do the opposite. I'd like to take a
> > > bunch of separate files that Latex uses and put them all into my
> > > *.tex file, deleteing all the supplementary files. The reason is so
> > > that I won't have to keep track of lots
> > > of different files when I'm transferring files from one computer to
> > > another.
> >
> > See mkjobtexmf. With it's help you can collect the input files.
> > Then you put the result in a .zip archive or similar and transfer this
> > single file.
> Thanks. That's one solution, but I don't want to have to specially
> process the file for transfer, zipping it up and then unzipping it. (I
> might want, for example, to transfer it back and forth from work to
> home every day without having to run an unzip program.) If I do that,
> I might was well just put it in a directory and copy the entire
> directory. Is there any way to keep the file as plain ascii, one
> file?
You could use package filecontents and put each file in an
"filecontents*" environment.
But I don't think, it's much fun working with a huge file.
Another idea: a revision control system (subversion, cvs, ...)
with the repository on a server somewhere. If both computers
can reach the server, you have the benefits of a version
control system including the possibility to update and commit
changes from both computers.
Yours sincerely
Heiko <ober...@uni-freiburg.de>
would this be much better than using something like rsync to keep
track of everything?
cheers,
jon.
Perhaps the filecontents package does what you want:
http://www.ctan.org/tex-archive/macros/latex/contrib/filecontents/
Erik
Take a look at the bundledoc package and its auxiliary script, arlatex.
-- Scott
Thanks. Arlatex looks just like what I was thinking of. It's built
from Filecontents, apparently.
http://carroll.aset.psu.edu/pub/CTAN/support/bundledoc/arla
tex.pdf
I've gotten more ambitious now, though, so I have a new question. Now
I want to type my auxiliary files into the middle of my document,
where obscure things like appendices are most conveniently hidden
away. Maybe I should start a new thread, but people commenting here
seem very knowledgeable, and the ultimate goal is the same, so I'll
stay here.
I need to use conditional logic, something like what is below in
capital letters, but what I need to know is the appropriate Latex or
Tex commands. I would run the following *.tex document through latex
twice-- the first time to create the auxiliary file latexstuff.txt,
the second time to actually use the commands in latexstuff.txt.
The file below uses batchmode because the first run-through of such a
document, lacking all the packages and macros, might have a million
error messages. It needs the conditional statement because if the
error is a missing input file, Latex just crashes, even in batchmode,
so if the auxiliary file doesn't yet exist, I need to create it--- it
can even be empty, so long as it exists--- but if it HAS been created,
I don't want to overwrite it. Note that in real use the
latexstuff.txt file might be many pages long, and include pdf or
postscript files as well as macros and packages.
\documentclass[12pt]{article}
\batchmode
\usepackage{filecontents}
IF THE FILE LATEXSTUFF.TXT DOES NOT YET EXIST, DO THE COMMANDS DOWN TO
"END OF SUBROUTINE"
\begin{filecontents}{latexstuff.txt}
%This is just a filler file, to be overwritten.
\end{filecontents}
END OF SUBROUTINE
\input{latexstuff.txt}
\begin{document}
Here is where my main document will go.
\begin{comment}
This is just a comment. It will cause an error unless this tex file
has usepackage-verbatim inserted before begin-document. That's why I
used the batchmode command earlier-- to tell latex to ignore the error
and go on to the end. But the second time I run latex on this file,
I want latex to insert the real latexstuff.txt file so it will insert
usepackage-verbatim.
\end{comment}
Here is where I will create my true auxiliary file, latexstuff.txt,
right in the middle of the tex file.
\begin{filecontents}{latexstuff.txt}
\usepackage{verbatim}
\end{filecontents}
Here is where my journal references list will go-- at the end, where
I can zip down and edit it easily.
\end{document}
I don't understand the problem. (1) What's wrong with overwriting the
auxiliary file each time? (2) If you \input the auxiliary file right
away, then why are you getting a million error messages from latex
that you don't get on subsequent runs?
-- Scott
The problem is that if I overwrite the auxiliary file with a blank
file, then it doesn't have the \usepackage{verbatim} and other
necessary info in it anymore, and so it just keeps giving error
messages. I need to first create a blank auxiliary file, to avoid a
crash due to a missing \input file, and then make sure that no new
blank file gets created the second time I run latex.
This is only a problem the first time I run the *.tex file on a
particular computer, since the second, third, etc. times the true
auxiliary file will exist. I could avoid it by always making sure I
copied the auxiliary file along with my *.tex file--- but remember
that my entire goal is to have everything in one *.tex file when I
start the process.
> but remember that my entire goal is to have everything in one
> *.tex file when I start the process.
You could also look at docstrip, eg. at the dtx-file Heiko Oberdiek
use for the documentation/packing of his packages. They unpack the
sty etc when compiled with tex and print the documentation when run
with (pdf)latex.
--
Ulrike Fischer
or, in the last analysis, have the whole lot contained in the pdf
file, and only distribute that. (in principle, all of those packages
of heiko's could be distributed as pdf alone ... provided that the
recipients have appropriate pdf readers.)
--
Robin Fairbairns, Cambridge
If you write
\begin{filecontents}{auxfile}
\usepackage{...}
\usepackage{...}
\newcommand{...}
.
.
.
\end{filecontents}
\input{auxfile}
then auxfile will never be empty or nonexistent, even on the first
run. Is the whole point of this exercise just to move the
filecontents environment towards the end of the document where it's
out of way, but actually use its contents earlier? If so, then maybe
you can do something like this:
\documentclass[12pt]{article}
\usepackage{filecontents}
\newif\ifauxfileexists
\IfFileExists{auxfile}{\global\auxfileexiststrue}{\global\auxfileexistsfalse}
\ifauxfileexists
\else
\begin{filecontents}{auxfile}
\usepackage{mathptmx}
\end{filecontents}
\fi
\input{auxfile}
\begin{document}
\huge Hello, world!
\begin{filecontents}{auxfile}
\usepackage{mathpazo}
\end{filecontents}
\end{document}
The preceding example uses filecontents to write "Hello, world!" in
Times Roman on the first run but Palatino on subsequent runs.
-- Scott
\documentclass[12pt]{article}
\batchmode
% Thus no error messages--see the *.log file for them.
\usepackage{filecontents}
\newif\ifauxfileexists \IfFileExists{temptex.txt}{\global
\auxfileexiststrue}{\global\auxfileexistsfalse}
\ifauxfileexists %Do nothing if ifauxfileexists=TRUE.
\else \begin{filecontents}{temptex.txt}
%% %%%%%
%% This is just filler.
%% %%%%%
\end{filecontents} \fi %The end of the ELSE instructions.
\input{temptex.txt}
%The real temptex.txt. created later, has all the auxiliary files in
it.
%Run this *.tex file through latex twice or thrice to fix the
style.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\huge \url{http://Rasmusen.org}
\begin{filecontents}{temptex.txt}
\usepackage{hyperref}
\hypersetup{colorlinks= true, urlcolor=blue}
\end{filecontents}
\end{document}