[comp.text.tex] sccs, tex makefiles, xfig, hints

wyle@inf.ethz.ch (Mitchell Wyle) (03/15/91)

Like many of you, I use fig to draw figues, then fig2dev -L latex
to transform the figures to latex.

In the main document, I'll have entries such as:

% ------------------------------- figure 1 -------------------------------
\begin{figure}[h]\label{overview}
\input f1.tex
\caption{System Overview}
\end{figure}
% ------------------------------- figure 1 -------------------------------


and of course fig2dev -L latex converts f1.fig to f1.tex.

I recently discovered the wonderful world of implicit rules in makefiles.
The makefile for the current paper I am working on is:


.SUFFIXES:	.fig .tex

.fig.tex:
	fig2dev -L latex $*.fig > $*.tex

.tex.dvi:
	latex $*.tex

all:	wan2.dvi

wan2.dvi:	f1.tex f2.tex wan2.tex f1.fig f2.fig f3.tex
	latex wan2.tex



The neato thing about make is that it knows how to generate the .tex
figures from the .fig figures; I just have to tell it that the main
paper depends on the .tex versions of the figures; if the .fig version
changes, make knows to re-run the fig2dev!


* * *

I also use sccs to control versions of the figures and tex documents.  My
documents all have something like:

% sccs version control:   %Z%%M%    %I%   %E% %U%

as the first line.  I hacked xfig to add the line:

# %Z%%M%    %I%   %E% %U%

after the version number line at the top.  Then I can sccs deledit to
checkpoint versions of the paper as it evolves.  I can also go back to an
earlier version when I accidentially delete too much text.  I also hacked
fig2dev to set the line-thickness on boxes, horizontal, and vertical lines.
The restriction to \thinlines or thicklines is unecessary; read page 199 of
the Latex book.

I suppose I should send diffs to the fig2dev authors....

Of course the nice thing about using xfig and fig2dev -L latex is that the
final document is 100% in latex so I can preview it, send it electronically,
use emtex at home on dos ozTex on the macs, etc. without worrying about
having a postscript(tm) printer, a dvi2xxx which will do the \special
inclusion right, previewers which understand \special and all the other
hassles.

* * *

If the maintainer of the comp.text.tex FAQ is reading this, I would
appreciate your adding these hints if you think they are appropriate, i.e.

How can I maintain version control of my tex documents?

sccs is available on most Unix systems; a comment at the top of your
document such as:

% sccs version control:   %Z%%M%    %I%   %E% %U%

jjsf@gmv.es (Julio Sanchez) (03/21/91)

In article <27530@neptune.inf.ethz.ch> wyle@inf.ethz.ch (Mitchell Wyle) writes:
>Like many of you, I use fig to draw figues, then fig2dev -L latex
>to transform the figures to latex.
>
>In the main document, I'll have entries such as:
>
>
>I recently discovered the wonderful world of implicit rules in makefiles.
>The makefile for the current paper I am working on is:
>
Probably other people are doing this. I have my own basic Makefile
that does other things along that line (it defines some 7 suffixes).
But, has anyone found a practical, no-mess way to determine how
many times to process a file in LaTeX so that crossreferences get
right. Usually it is either 1, 2 or 3. Any hints. Up to now, I
*touch* the file and make again. This is *ugly*.

Any hints?

Julio

-- 
Julio Sanchez, GMV SA, Isaac Newton s/n, PTM Tres Cantos, E-28760 Madrid, Spain
Ph. +34 1 807 21 85 | jsanchez@gmv.es                 | Traveller, there is no
Fax +34 1 807 21 99 | jsanchez%gmv.es@Spain.EU.net    | path; paths are made by
Telex  48487 GMEV E | Julio_Sanchez_GMV@EuroKom.ie    | walking (A. Machado)

Dan_Jacobson@ATT.COM (03/22/91)

>>>>> On 21 Mar 91 09:28:14 GMT, jjsf@gmv.es (Julio Sanchez) said:

Julio> But, has anyone found a practical, no-mess way to determine how
Julio> many times to process a file in LaTeX so that crossreferences get
Julio> right.

I think this is what I was using:

RERUN_DETERMINER=fgrep 'Rerun to get cross-references right' >&-
TEX_COMMAND=latex
.SUFFIXES: .dvi .tex

.tex.dvi:
	$(TEX_COMMAND) $< < /dev/null
#if LaTeX is to be run twice to get references right (can't depend on
#.toc's, aux's... I think.  They are all dated the same.):
	-@$(RERUN_DETERMINER) $*.log && $(TEX_COMMAND) $< < /dev/null
-- 
Dan_Jacobson@ATT.COM  Naperville IL USA  +1 708 979 6364

des@frogland.inmos.co.uk (David Shepherd) (03/27/91)

In article <2358@eonwe.gmv.es>, jjsf@gmv.es (Julio Sanchez) writes:
|> But, has anyone found a practical, no-mess way to determine how
|> many times to process a file in LaTeX so that crossreferences get
|> right. Usually it is either 1, 2 or 3. Any hints. Up to now, I
|> *touch* the file and make again. This is *ugly*.

one way is just to assume worst case and put 3 latex'es in the implicit
rule. Perhaps a more imaginative method would be to catch the output from
LaTeX, look for the string Rerun, and if so loop back.

Is it possible to affect the return value of TeX from inside LaTeX, if
so you could stick a special value in and trap that.

Over all, assuming you've got a reasonably fast machine and don't have
mega documents, then just doing it 3 times may be the simplest!

-- 
--------------------------------------------------------------------------
david shepherd: des@inmos.co.uk or des@inmos.com    tel: 0454-616616 x 529
                inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq
                Leland says,   you're going back to Missoula  ...  MONTANA