From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jon Solberg Newsgroups: gmane.emacs.help Subject: Re: Help: execute scripts form emacs Date: Tue, 13 Oct 2009 22:49:24 +0000 (UTC) Organization: http://www.jonsolberg.se Message-ID: References: <25853628.post@talk.nabble.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1255477258 20946 80.91.229.12 (13 Oct 2009 23:40:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 Oct 2009 23:40:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 14 01:40:48 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mxqz1-0005xO-8q for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Oct 2009 01:40:47 +0200 Original-Received: from localhost ([127.0.0.1]:35453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mxqz0-0001xv-QW for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Oct 2009 19:40:46 -0400 Original-Path: news.stanford.edu!usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 96 Original-X-Trace: news.eternal-september.org U2FsdGVkX1/4aVSPHNlKUJxCsuzfinQ8E5cp9pJyVnao2dFYjLHA4AbZcY/i+ZA9X6n+l94lNdUAxjE6NB30iRMPGlgOClHeaaELH8fzj1QaEyGWoWEKqBXDKJ0fb9ecbuWtsvWIglPCwmYFoxUU9YCOzZ/sO7fx Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Tue, 13 Oct 2009 22:49:24 +0000 (UTC) X-Auth-Sender: U2FsdGVkX183yXy5l4hZBNsm/UxVpAfucNTS2oQfJ5RdA2BkW6xcHA== Cancel-Lock: sha1:G38oYN6A3WU3EQErelLzkKE4t7s= User-Agent: slrn/pre1.0.0-2 (Linux) Original-Xref: news.stanford.edu gnu.emacs.help:173851 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:68932 Archived-At: On 2009-10-13, Maurizio Vitale wrote: >>>>>> "wdysun" == wdysun 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).