[OS X TeX] small trick on the command line

Thomas A.Schmitz thomas.schmitz at uni-bonn.de
Tue Feb 8 09:04:42 EST 2005

This is just a very small trick I wanted to share: I have been mucking 
with lots of encodings and font descriptions lately, and I constantly 
needed to find and open files in the different texmf.something trees. 
Typing those long paths in the Terminal or navigating to these files in 
the Finder proved pretty irritating after a while. So I began to type

open -a emacs `kpsewhich texnansi.enc`

Which means: let kpsewhich look for the file in question; it will spit 
out the complete path, then the "open -a emacs" command will take this 
path as an argument (the two ` around the kpsewhich are "backticks," 
that's important). Of course, replace "emacs" with another application 
of your choice, or use "edit" to open the file in Textwrangler etc. If 
you want to speed up things, you could define an alias (if you're using 
tcsh) or function (bash or zsh) like so:

texopen () { open -a emacs `kpsewhich $@`; }

If you put this line into your .bashrc or .zshrc (and run "source 
.bashrc"), you'll have a command "texopen" that will take one or more 
filenames as an argument, locate them with kpsewhich and open them in 



--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list