[OS X TeX] Re: MacOSX-TeX Digest, Vol 47, Issue 18

Herbert Schulz herbs at wideopenwest.com
Mon Sep 26 19:35:50 EDT 2011


On Sep 26, 2011, at 5:45 PM, Alan Munn wrote:

> On Sep 26, 2011, at 4:52 PM, Herbert Schulz wrote:
> 
>> 
>> On Sep 26, 2011, at 3:40 PM, Murray Eisenberg wrote:
>> 
>>> Using that creates a large number of auxiliary files other than the usual ones for an ordinary LaTeX run. How does one change the TeXShop configuration so that clicking the "Trash Aux Files" button on the console deletes those, too?
>>> 
>>> On 9/26/11 3:00 PM, macosx-tex-request at email.esm.psu.edu wrote
>>>> 
>>>> From: Herbert Schulz<herbs at wideopenwest.com>
>>>> Subject: Re: [OS X TeX] Asymptote
>>>> To: TeX on Mac OS X Mailing List<macosx-tex at email.esm.psu.edu>
>>>> 
>>>> 
>>>> On Sep 26, 2011, at 1:18 AM, Ararat Andrasian wrote:
>>>> 
>>>>> Hello,
>>>>> How can I configure texshop so it could use the asymptote in texlive 2011....
>>>>> 
>>>> 
>>>> 
>>>> Assuming you've installed asy already (that's another procedure) and you are using TeXShop it's pretty easy. You need only activate the ``latexmk engines'' by moving them from ~/Library/TeXShop/Engines/Inactive/Latexmk/ two folders up, to ~/Library/TeXShop/Engines/ (note: ~/Library/ is the Library folder in your HOME folder --- if you are using Lion you can get to it by pressing the Option Key and Clicking on Finder's Go menu) and resstarting TeXShop. To tell TeXShop that a .tex file should use the asymptotemk engine place the line
>>>> 
>>>> % !TEX TS-program = asymptotemk
>>>> 
>>>> at the top of the file. From then on simply Typeset->Typeset (Cmd-T) will automatically compile only those asymptote figures that have changed since the last compile as well as take care of multiple runs of pdflatex and biblatex and/or makeindex.
>>>> 
>>>> There is another Asymptote specific engine found in ~/Library/TeXShop/Engines/Inactive/Asymptote/ but try the asymptotemk engine first and see if you like it....
>> 
>> 
>> Look for `clean aux files' in TeXShop Help and part of what you get is:
>> 
>> "
>> When documents are typeset, auxiliary files are created with extensions .aux, .log, .bbl, etc. Occasionally these files can become corrupt and lead to unexplained typesetting errors. TeXShop has a menu command "Trash AUX Files" which will remove all such files so typesetting can proceed. There is a similarly named button on the Console window. If either of these items is activated, TeXShop will move to the trash all files in the current source directory with the same name as the source file and extension aux, blg, brf, ccs, ent, fff, glo, idx, idv, ilg, ind, ioa, lg, log, lot, mte, mlf, out, pdfsync, toc, ttt, wrm, bcf, run.xml, synctex, synctex.gz, xref, 4ct, 4tc, or fdb_latexmk.
>> 
>> Additional extensions can be added to this list. To add "dvi" to the list, activate the Terminal and type
>> 
>> defaults write TeXShop OtherTrashExtensions -array-add "dvi"
>> To remove all additions and return to the original default list, tppe
>> 
>> defaults write TeXShop OtherTrashExtensions -array
>> "
>> 
>> I think that may be part of the answer. In general though that will only deal with files that have the same base name as the source file and many of the additional files created don't have that kind of file name. As long as you are editing it is wise to keep those files around because latexmk will then be able to tell if a particular asymptote figure has been changed and only compile the ones that have changed since the last compile. No really good way to get rid of all of them that I know of.
>> 
> 
> I asked a similar question a while ago, and Claus Gerhardt kindly offered the following Applescript, which I use, and am very happy with.
> 
> I've added the files that are created by biblatex (which are problematic for the approach that Herb mentions above, since they involve suffixes like -blx.bib).
> 
> Save this script as a Macro.  To add to the list, add any extra file extensions to the line 
> 
> set L to { ...  }
> 
> Crucially, the leading "." of the extension must be specified, (i.e. ".out" not just "out".)
> 
> Alan
> 
> 
> --AppleScript
> -- Apply only to an already saved file
> -- Claus Gerhardt, September 2006
> (*This script gets the path of the frontmost (tex) document in TeXShop and removes the corresponding auxilary files the suffixes of which are listed in the list L. Beware of the quotation marks. The list L may contain suffixes to which no corresponding files exist.*)
> 
> my remove_auxiliaries()
> on remove_auxiliaries()
> 	set L to {".aux", ".synctex.gz", ".fdb_latexmk", ".out", ".toc", ".bbl", ".blg", ".ind", ".sind", ".run.xml","-blx.bib",".log", ".end", ".1"} as list
> 	
> 	tell application "TeXShop"
> 		get path of document of window 1
> 		set fileName to result
> 	end tell
> 	
> 	set {baseName, texName, pdfName, namePath, dirName, dirNameunquoted, logName, logPath, rtfName, docName} to my setnamebbedit_rootn(fileName)
> 	
> 	
> 	(*
> 
> tell application "TeXShop"
> 	close document docName
> end tell
> *)
> 	
> 	repeat with x in L
> 		try
> 			set shellScript to "cd " & dirName & ";"
> 			set shellScript to shellScript & "rm -f  " & baseName &  x
> 			do shell script shellScript
> 		end try
> 	end repeat
> 	
> end remove_auxiliaries
> 
> on setnamebbedit_rootn(x)
> 	set n to (number of characters of contents of x)
> 	set fileNamequoted to quoted form of x
> 	set windowName to do shell script "basename " & fileNamequoted
> 	set m to (number of characters of contents of windowName)
> 	set dirName to quoted form of (characters 1 thru (n - m - 1) of x as string)
> 	set dirNameunquoted to (characters 1 thru (n - m - 1) of x as string)
> 	set theText to contents of windowName as string
> 	
> 	set n to (number of characters of contents of theText)
> 	set i to n as number
> 	
> 	repeat while i > 0
> 		if character i of theText is equal to "." then
> 			set m to i
> 			exit repeat
> 		else
> 			set i to (i - 1)
> 		end if
> 	end repeat
> 	
> 	set baseName to (characters 1 thru (m - 1) of theText as string)
> 	set texName to baseName & ".tex"
> 	set namePath to dirNameunquoted & "/" & baseName as string
> 	set pdfName to namePath & ".pdf" as string
> 	set rtfName to namePath & ".rtf" as string
> 	set logPath to namePath & ".log" as string
> 	set logName to baseName & ".log" as string
> 	
> 	set theFile to POSIX file x as string
> 	tell application "Finder"
> 		get displayed name of the file theFile
> 	end tell
> 	set docName to result
> 	
> 	
> 	return {baseName, texName, pdfName, namePath, dirName, dirNameunquoted, logName, logPath, rtfName, docName} as list
> end setnamebbedit_rootn
> 

Howdy,

Thanks Alan. I've used another version but it can't deal with things like -blx.bib files since the `.' is hard coded. I'll take a look at this one. Still wonder if it can be used to clean out the asy files produced by the asymptote package which have names like basefilename-N.asy and basefilename-N.pdf wwith N=1,...,n with n asy figures in the document basefilename.tex. One might be able to extend the script to deal with things like that but... certainly not me since Applescript just isn't my game.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the MacOSX-TeX mailing list