[OS X TeX] Typesetting music by abcm2ps?

Peter Dyballa Peter_Dyballa at Web.DE
Wed Mar 30 17:32:26 CEST 2005


Am 30.03.2005 um 14:10 schrieb Friedrich Vosberg:

> 1.) How can I achieve that TeXShop either diplays the new file 
> music.ps or
> converts that file into music.pdf to diplay it? Is it possible to make 
> a
> shell script, that converts the music.tex via a music.ps into a 
> music.pdf
> by one click -- probably by using ps2pdf directly after running 
> abcm2ps?

Just use two 'engines': one for PS output (if you need) and another 
script that either invokes Apple's pstopdf (needs Mac OS X 
10.3/Panther) or ps2pdf (any or specific PDF version [default is PDF 
1.2], needs Ghostscript installed). If you have installed Ghostscript 
with an i-Package or DarwinPorts then the path does not need to be 
augmented by another component, if it has been installed with Fink 
/sw/bin needs to be added to it. Apple's pstopdf is in /usr/bin so it's 
probably found without changes to the search path. A clever approach 
(not invoking another convertor if tex'ing/creating of PS failed) would 
be:

	set Datei = `basename "$1" .tex`
	abcm2ps "$Datei" && pstopdf "${Datei}.ps" -l
	
or
	
	set Datei = `basename "$1" .tex`
	abcm2ps "$Datei" && ps2pdf "${Datei}.ps"
	
	
In case abcm2ps can output to a pipe, not leaving a PS file on disk, 
these scripts would work too (but you need to check how and give that 
option to abcm2ps):
	
	set Datei = `basename "$1" .tex`
	abcm2ps "$Datei" | pstopdf -o "${Datei}.ps" -l
	
or
	
	set Datei = `basename "$1" .tex`
	abcm2ps "$Datei" | ps2pdf - "${Datei}.pdf"




>
> 2.) TeXShop seems to typeset files only with the extension .tex. 
> Regularly
> music-files written in ABCPlus should have .abc for extension. But if I
> change the extension of my music-files into .abc the typeset-menue and 
> the
> LaTeX-button in TeXShop are hidden. Only if the file has the extension
> .tex I can typeset it. Can I change this behaviour?
>

I don't know too, but the shell knows! Just start with a file.tex and 
add this line between the other two:

	cp "${Datei}.tex" "${Datei}.abc"

This will create a copy. If don't want a copy, since you might have a 
template or you like to write the header and the footer all the time 
yourself, substitute 'cp' with 'mv' and the original .tex file would be 
renamed into a .abc file. The script itself would be then for example:

	set Datei = `basename "$1" .tex`				# get the file's name
	cp "${Datei}.tex" "${Datei}.abc"				# create the file's name.abc file
	abcm2ps "$Datei" && pstopdf "${Datei}.ps" -l	# upon success convert to 
some PDF

The option -l to Apple's pstopdf creates a log file "${Datei}.pdf.log" 
-- can be valuable. It can be removed automatically when conversion to 
PDF was successful:

	if ($status == 0) rm "${Datei}.pdf.log" > /dev/null

This could become the last line in your "engine." Or in that case you 
prefer a PDF output:

	rm "${Datei}.ps" > /dev/null


ps2pdf probably writes any messages to stderr which can be caught and 
re-directed into a file. But then I would re-write it in Bourne shell.

--
Mit friedvollen Grüßen

   Pete

In a world without walls and fences, who needs gates and windows?

--------------------- 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 macostex-archives mailing list