When asked to "Trash Aux Files” after typesetting a Beamer presentation, TeXShop does not remove .nav and .snm.
Is there a way to tell TeXShop to remove those files as well?
Is there a user-editable list of the aux files that TeXShop removes?
When asked to "Trash Aux Files” after typesetting a Beamer presentation, TeXShop does not remove .nav and .snm.
Is there a way to tell TeXShop to remove those files as well?
Is there a user-editable list of the aux files that TeXShop removes?
TeXShop has a hidden preference that allows you to add a limited range of new extensions to the list of trashed .aux files. The only restriction is that the preference assumes that the extension is a single string prefixed with a ., so e.g. you can add the extension .foo, but not the extension .foo.bar. Because of this restriction, I prefer to use an Applescript which allows me to add any kind of extension I like. I'll describe both method here.
To add an extension .foo to the list of trashed aux files, open a Terminal window and enter the following:
defaults write TeXShop OtherTrashExtensions -array-add "foo"
So in your particular example you can type:
defaults write TeXShop OtherTrashExtensions -array-add "nav"
defaults write TeXShop OtherTrashExtensions -array-add "snm"
As noted above, this will only work for extensions of the form .foo, not foo.bar.
A more general method is to use the following Applescript (first described in this answer:).
Open the Macro Editor in TeXShop and make a new Macro with the following Applescript: (this trashes the extension that I usually want trashed, including some latexmk and biblatex extensions. Adjust as needed.
--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", ".nav",
".snm"} 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
The list of extensions is modifiable in set L to ... line near the beginning of the script. Here, unlike the TeXShop defaults method, you specify the entire extension, including the . which allows extensions of the form .foo.bar to be specified as well.
trashAUXinTSDocument.m. – lhf Jan 15 '14 at 09:32.. – Alan Munn Jan 15 '14 at 16:48