[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help: execute scripts form emacs
From: |
Jon Solberg |
Subject: |
Re: Help: execute scripts form emacs |
Date: |
Tue, 13 Oct 2009 22:49:24 +0000 (UTC) |
User-agent: |
slrn/pre1.0.0-2 (Linux) |
On 2009-10-13, Maurizio Vitale
<mav@cuma.i-did-not-set--mail-host-address--so-tickle-me> wrote:
>>>>>> "wdysun" == wdysun <grammophonia@gmail.com> writes:
>
> wdysun> Hello dears,
>
> wdysun> suppose I have a script in /bin, let us assume it is called
> wdysun> mytex. Suppose I am editing a file called filename.tex.
>
> wdysun> If I run the following command from the console:
>
> wdysun> $ mytex filename
>
> wdysun> this will do several things (tex the filename with several
> wdysun> options, then convert the dvi to pdf and it deletes all aux
> wdysun> files I don't need).
>
> wdysun> There is a way to launch the script from emacs or even to
> wdysun> build a function so that I can run the command just with M -
> wdysun> something?
>
> You can do two things:
>
> - in a buffer local variable set the compile command to mytex
> filename and then use M-x compile
>
> - but if your script is only for running latex as much as needed,
> then bibtex, then latex again (and maybe switch between the dvi
> and pdf path), do yourself a favour and use AUCTeX
> (http://www.gnu.org/software/auctex/). You won't look back.
Agreed.
AUCTeX (and RefTeX for that matter) are indeed very useful tools for
compiling *TeX files and I wouldn't want to be without them.
However, sometimes using a command line script can be quite convenient
(especially if you have many source files or need to create different
types of output on the fly). A couple of years back when I wrote my
thesis I used the following Makefile to be able to easier comqpile
versions for print, review and keeping my directories clean. This
enabled me to create a final pdf with "make final" remove temporary
files from my working directory with "make clear" et c.
Nothing mind blowing I admit, but the general idea should be easy to
use for similar jobs. I'll post it here and hopes it can help the OP:
THESIS_FILES=thesis.tex introduction.tex summary.tex appendix.tex
REFERENCES=biblio.bib LATEX=latex
all: thesis
# You are supposed to make a readers digest of your thesis before your
# presentation:
condensate:
latex condensate
dvips -Pcmz -Pamz -o condensate.ps condensate
rm -f condensate.pdf
# pdfmake -4 condensate.ps
ps2pdf condensate.ps
final: thesis references postscript pdf
clear:
rm -f *.aux *.dvi *.lot *.bbl *.lof *.ps *.toc *.blg *.log
*.ilg
rm -f *.thm *.tmp *.info *.idx
rm -f *~
thesis: $(THESIS_FILES)
$(LATEX) thesis
references: $(REFERENCES)
bibtex thesis
$(LATEX) thesis
$(LATEX) thesis
postscript: thesis
dvips -Pcmz -Pamz thesis -o thesis.ps
booklet: postscript
rm -f thesis-booklet.ps
./booklet thesis.ps thesis-booklet.ps
pdf: thesis
rm -f thesis.pdf
# pdfmake -4 thesis.ps
ps2pdf thesis.ps
gv thesis.pdf
# Put your index settings in thesis.ist
index: thesis
makeindex -s thesis.ist thesis.idx
$(LATEX) thesis.tex
--
Jon Solberg (remove "nospam." from email address).