[OS X TeX] Re: gnu fmt, or equivalent, for TeX?

Peter Dyballa Peter_Dyballa at Web.DE
Thu Apr 1 06:41:55 EDT 2010


Am 01.04.2010 um 10:48 schrieb Ramón Figueroa-Centeno:

> <http://de.narkive.com/2006/11/23/756149-iso-8859-1-q-pretty-printer-f-fcr-latex-code.html 
> >
>
> emacs -batch -Q -eval '(load "auctex.el" nil t t)' datei.tex -eval  
> '(progn
> (LaTeX-fill-buffer nil) (save-buffer))'

This line is from Ralf Angeli, one of the AUCTeX authors. Here GNU  
Emacs is launched into batch mode and loading of any init files is  
inhibited by -Q. So one needs to tell it to load AUCTeX (via the first  
-eval[uate] ELisp statement) and then two other ELisp statements are  
applied on the loaded TeX file, datei.tex. Obviously LaTeX-fill-buffer  
is a function which justifies LaTeX code – and it comes from the  
AUCTeX file latex.el. The "progn" in the second expression to be  
eval'ed is necessary that both "lines" are executed in sequence  
(evaluation would end when the first expression evals to t).

This works OK, so far, except vast use of options when loading a  
package produces a look which I don't tolerate. I've also seen it  
destroying meaningful comments, i.e., comments formatted in a way to  
make understanding of code things easier or providing alternatives of  
loading a package, re-newing or defining a command or macro in many  
ways. And actually some indentation in this TeX code is removed!

I'd use it only in real desperate cases of real desperate foreign  
files! (Manually formatting paragraphs looks like being more  
proficient.)


And another AUCTeX author, David Kastrup, contributed these line for  
vim (it saves its working copy and delegates to GNU Emacs and AUCTeX  
the job of justifying and then re-reads the file's new contents):

>
> :w
> :!emacs -batch -Q -eval '(load "auctex.el" nil t t)' % -eval '(progn
> (LaTeX-fill-buffer nil) (save-buffer))'
> :r

No reports are given on how and whether this function actually works  
in GNU Emacs.


>
> <http://newsgroups.derkeiler.com/Archive/De/de.comp.text.tex/2007-03/msg00283.html 
> >
>
> emacs -u [Nutzername] -batch -l tex-site [dateiname.tex] --eval
> '(indent-region (point-min) (point-max) nil)' --eval '(LaTeX-fill- 
> buffer
> nil)' --eval '(save-buffer)'


Here Stefan Lagotzki explains that "(indent-region (point-min) (point- 
max) nil)" won't work in GNU Emacs newer than version 21.4. The code '- 
l tex-site' also makes clear that the whole line is meant for old  
AUCTeX which was loaded via a tex-site.el file and had a separated  
preview.el. New AUCTeX versions also don't need the indent-region  
call. The code '-u [Nutzername]' is just '-u [user]' and allows to  
load this particular user's init file. So it's probably better to use  
Ralf Angeli's compact code.

--
Greetings

   Pete

Atheism is a non prophet organization.




More information about the MacOSX-TeX mailing list