« healty from*nix to MacOSX | Main | new! »

Thursday, April 19, 2007

IPE 6.0 preview 28 EPS-Export Fix *well, sort of… ;)*

gentle persons,

there is a apparently a problem using EPS-graphics exported from IPE6.0pre28 with other Applications, particularly when using LaTeX/TeX or ghostscript. The problem is related to the way how IPE is creating a font dictionary programmed in PostScript to identy the fonts used and its encoding within the EPS files. IPE uses the /F(x) to mark the LaTeX font used by number and uses this information when parsing a pdf/eps/xml file when opening - bad sadly the way it is done brakes the stack processing by any PostScript engine I tried. One way to cope with this issue is not to save EPS but PDF files from within IPE. So:

1.) you do your drawings and save them as pdf from within IPE.

2.) you have GhostScript 8.x installed on your system (presumably you have if you go "dvips" - if not use the i-installer to get and install the latest package easily)

3.) in a terminal you use the following command to convert a IPE created PDFs to "nice" EPS:

gs -dBATCH -dNOPAUSE -dNOPROMPT -sDEVICE=epswrite -sOutputFile=NameOFTheNewEPS.eps IPEWrittenPDF.pdf

done. The created EPS files can be included to LaTeX documents without any problem.

IPE 6.0 preview 28 EPS-Export Problem

leider lassen sich mit IPE 6.0pre28 erstellte EPS-Grafiken nicht problemlos in anderen Anwendungen, inbesondere LaTeX/TeX oder Ghostscript benutzen. Die Art und Weise, wie IPEpre28 innerhalb der EPS-Datei die verwendeten LaTeX-Schriften mit einem Dictionary ablegt, ist hier so zu sagen "der Stein des Anstosses". Die aktuelle Implementierung führt zu einem Fehler bei der Bearbeitung im PostScriptinterpreter *zumindest in denen, die ich ausprobiert habe*. Eine Möglichkeit, das Problem zu umgehen, besteht darin zunächst die Abbildung aus IPE heraus im PDF-Format zu sichern und diese dann anschliessend mittels Ghostscript 8.x (installierbar via z.B.:i-Installer) via Terminal in korrektes PostScript/EPS zu konvertieren:

gs -dBATCH -dNOPAUSE -dNOPROMPT -sDEVICE=epswrite -sOutputFile=NameOFTheNewEPS.eps IPEWrittenPDF.pdf

Die so erstellten EPS-Dateien lassen sich problemlos in anderen Anwendungen nutzen.

Posted by Markus at 10:33 PM
Edited on: Thursday, April 19, 2007 10:33 PM
Categories: bugfix!, MacOSX - the daily life

Friday, January 26, 2007

XDrawChem & working EPS-export

As a side effect of the solution for Ipe 6 to use LaTEX without the need to start the program from the shell - this solution immediately solves the similiar EPS-export problem of XDrawChem under MacOSX. If you already did the described procedure to work more comfortable with Ipe 6, you can stop reading here.

If you don´t use Ipe & LateX, but like to export to EPS from XDrawChem - read further:

To allow XDrawChem to export to EPS, the PATH-entry in the file ~/.MacOSX/environment.plist should look similiar to the following (the ~ (tilde) represents the home directory of the user, you):

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>PATH</key>

<string>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/sbin</string>

</dict>

</plist>

I´m sorry for the small font size - it´s because I wanted to show the content without line breaks. If ~/.MacOSX/environment.plist already exists, extend the PATH key with reference to the Apple supplied ghoscript-installation on your system. If ~/.MacOSX/environment.plist do not exist, copy the lines shown before (everything which is set in 6 pt using Courier) into your favorite Texteditor, and save it into ~/.MacOSX/environment.plist (ASCII-format). If somebody knows how to create a script which checks wether ~/.MacOSX/environment.plist and/or the correct PATH key already exists, AND knows how to extend an installer package so it uses this script, PLEASE share your knowledge and let me know. The changes will take only effect, when you relogin as a user (or better just restart your computer once).

One more thing: while the export in XDrawChem says that you save to EPS, MacOSX directly converts the file to PDF. As a result you should use the extension ".pdf" in the EPS-export dialogue of XDrawChem (otherwise Preview gets confused and tries to convert the file to PDF while opening it).

XDrawChem & komfortabler EPS-Export

Als Nebeneffekt des komfortableren Nutzen von LateX in Ipe6 unter MacOSX, hat sich auch das EPS-Export-Problem aus XDrawChem heraus, erledigt. *Hah!* Falls Sie die im vorherigen Eintrag dieses Blogs beschriebene Prozedur zur Nutzung von Ipe6 und LateX schon durchgeführt haben, lohnt es sich nicht hier weiter zu lesen. Nutzen sie Ipe6 NICHT, wollen allerdings "mac-typisch" Zeichnungen, die Sie in XDrawChem erstellt haben, auch im EPS-Format exportieren (und mussten dazu bisher XDrawChem aus einer Shell heraus starten), lesen sie hier weiter:

Damit XDrawChem ohne Start aus einer Shell heraus, Zeichnungen im EPS-Format sichert, muß die Pfad-Variable (PATH) in der Datei ~/.MacOSX/environment.plist im einfachsten Falle folgendermaßen zugewiesen werden:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>PATH</key>

<string>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/sbin</string>

</dict>

</plist>

Man verzeihe mir bitte die kleine Schriftgröße, aber anders war eine korrekte Darstellung der Gesamtzeilen nicht möglich. Falls environment.plist im eigenen Benutzerverzeichnis (die Tilde ~ repräsentiert dieses Verzeichnis) noch nicht existiert, kann man die obigen Zeilen einfach in den Texteditor der Wahl kopieren, und in einer ASCII-Datei unter ~/.MacOSX/environment.plist speichern. Existiert ~/.MacOSX/environment.plist schon, braucht man die Pfad-Zuweisung nur bezüglich der eigenen TeX-Installation, wie dargestellt, erweitern. Falls jemand weiß, wie man eine entsprechendes Skript, das den Inhalt von ~/.MacOSX/environment.plist überprüft, und gegebenenfalls erweitert, und vor allem: wie man das dann in ein Installationspaket einbettet - es wäre grandios, wenn ich an diesem Wissen teilhaben dürfte.

Noch eine Anmerkung: Während man im Dialog von XDrawChem "EPS" als Ausgabeformat auswählt, konvertiert MacOSX 10.3 die Ausgabedatei direkt in das PDF-Format. Es bietet sich daher an, direkt die Dateiendung ".pdf" in XDrawChem beim Sichern zu Verwenden - andernfalls versucht beispielsweise Apple's Vorschau beim Öffnen der Datei, diese ins PDF-Format zu konvertieren (was zum berühmt-berüchtigten "spinning beachball" führt).

Posted by Markus at 6:23 PM
Edited on: Friday, January 26, 2007 7:01 PM
Categories: MacOSX - the daily life

Terminal: Formatting an external hard disk for usage with Mac & PC

The easiest solution is of course to format an external harddrive in FAT32 - MacOSX supports this filesystem upto 128 GByte (!). Disadvantage: write speed and resource fork handling gives one or the other "headache".

To format e.g. a 60Gb external harddrive with 2 partitions (30Gb FAT32, 30Gb HFS+) for cross-platform use via the command line:

diskutil partitionDisk NameOFYourExternalHardDisk 2 MBRFormat MS-DOS PC-DriveNameYouWant 30G HFS+ Mac-DriveNameyouWant 30G

to get the name of your external hard drive type once BEFORE you connect the drive to your Mac:

ls -al /dev/rdisk?

repeat the comand after the external hard drive is connected. The new line in the output for the second call of the command gives you the external hard disk name.

Terminal: Formatieren einer externen Festplatte zur Nutzung mit PC und Mac

Die einfachste Möglichkeit besteht darin, die externe Festplatte im FAT32-Filesystem zu formatieren - MacOSX unterstützt in diesem Falle Plattengrößen bis 128 GByte (!). Eventuelle Nachteile: Schreibgeschwindigkeit unter MacOSX und mögliche Probleme mit der Resourcefork von Dateien.

Um beispielsweise eine externe 60GByte-Festplatte zwecks plattformübergreifender Nutzung in 2 Partionen (30Gb FAT32, 30Gb HFS+) einzuteilen, läßt sich folgende Befehlssequenz im Terminal *Apple's Bezeichner für eine Shell* benutzen:

diskutil partitionDisk NameDerExternenFestplatte 2 MBRFormat MS-DOS GewünschterPC-FestplattenName 30G HFS+ GewünschterMac-FestplattenName 30G

Um den benötigten, vom MacOSX vergebenen Bezeichner NameDerExternenFestplatte zu ermitteln, gibt man VOR und NACH dem Anstecken der externen Platte via USB oder FireWire

ls -al /dev/rdisk?

im Terminal ein. Die beim zweiten Aufruf in der Ausgabe im Shellfenster hinzugekommene Zeile enthält die Informationen über das externe Laufwerk.

Posted by Markus at 5:59 PM
Edited on: Friday, January 26, 2007 7:03 PM
Categories: MacOSX - the daily life

Error handling: "help! the program does not start…" OR "the program starts up, but immediately quits…"

When clicking a program icon under MacOSX, the icon appears shortly in the dock, but the program quits *more or less* immediately. Other scenario: a running program quits suddenly without any notification.

While there is no general solution to this, the first check should be to open the console application (in /Applications/Utilities). Here you have access to the different log files which are tracked by the MacOSX (click on the Logs-symbol in the title bar). In ~/Library/Logs you find for example CrashReporter which reports in its logs the problems related to specific applications which crashed *under whatever condition: startup, etc.* A more or less common problem with applications which have a *nix origin, is that sometimes accidently some required libraries might be missing, installed in the wrong path, etc. In case of a missing library the CrashReport-log of a specific application show some entry like:

Link (dyld) error:

dyld: /Volumes/hydrogen/hydrogen.app/Contents/MacOS/hydrogen can't open library: /usr/local/lib/libjack.0.dylib (No such file or directory, errno = 2)

In this example the application hydrogen does not find the required library libjack.dylib in the expected folder /usr/local/lib. Starting from here it might be relatively easy to fullfill the requirements, by installing the missing lib or extending the library path in which the system is looking for dynamically linked/loaded libraries.

Fehlersuche: "Hilfe! Das Programm startet nicht…" ODER "das Programm startet, beendet sich aber sofort wieder…"

Mitunter passiert es, daß ein Programm sich, nachdem man es durch Anklicken des Programmesymboles gestartet hat, mehr oder minder sofort beendet. Ein anderes Szenario: das Programm, in dem man just arbeitet, beendet sich plötzlich.

Leider hat es in solchen oder ähnlichen Fällen keine allgemeine Lösung. Einen hilfreichen, ersten Anlaufpunkt beim Aufspüren der Ursache bietet Apple's Console-Programm (/Programme/Dienstprogramme/Console). Es ermöglicht das Lesen der verschiedensten Log-Dateien, die von MacOSX aufgezeichnet werden. Ein Klick auf das Logs-Symbol in der Titelleiste öffnet eine Listenansicht, in der die verschiedenen Dateien angezeigt werden. Unter ~/Library/Logs findet sich der Eintrag CrashReporter, in dem Vorgänge rund um Programme, die vom aktuell angemeldeneten Benutzer gestartet oder genutzt wurden, und die sich unerwartet beendeten, aufgezeichnet werden. Ein häufiges Problem bei Programmen, die ursprünglich für ein *nix-System entwickelt wurden, ist, daß beim Zusammenstellen eines Installationspaketes, vom Programm zwingend benötigte Funktionsbibliotheken vergessen wurden, im "falschen" Verzeichnis installiert werden, etc. . Im CrashReporter-Log für das jeweilige Programm, findet sich dann ein ähnlicher Eintrag, wie der Folgende:

Link (dyld) error:

dyld: /Volumes/hydrogen/hydrogen.app/Contents/MacOS/hydrogen can't open library: /usr/local/lib/libjack.0.dylib (No such file or directory, errno = 2)

In diesem Beispiel findet das Programm hydrogen die Bibliothek libjack.dylib nicht im Verzeichnis /usr/local/lib. Mit dieser Information ist es eventuell recht einfach, die benötigten Abhängigkeiten des hier als Beispiel verwendeten Programmes hydrogen zu erfüllen, in dem man die fehlende Bibliothek nachinstalliert, oder aber, falls sich die Bibliothek nur in einem anderem Verzeichnis befindet, den Pfad, in dem das MacOSX nach Bibliotheken sucht, entsprechend erweitert .

Posted by Markus at 5:57 PM
Edited on: Friday, January 26, 2007 7:04 PM
Categories: MacOSX - the daily life

Terminal: Creating disk images under MacOSX, which can be burned on CD/DVD under Windows

Due to the different options for creating a diskimage (compression, cryption, file system), the easiest solution is to convert an existing disk image under MacOSX to ISO-format. Using the terminal comand

hdituil convert input.dmg -format UDTO -o output.iso

the disk image input.dmg (which was created with whatever options under MacOSX) is converted into the ISO-image output.iso.cdr, which can be burned to CD/DVD under Windows. If you like to mount and use this diskimage under Windows - for disk images with the filesystem HFS you need a special tool like MacDisk.

Terminal: Das Erzeugen von Disk-Images unter MacOSX, die unter Windows auf CD oder DVD gebrannt werden sollen

Aufgrund der unterschiedlichen Einstellungen (bezüglich Kompression, Verschlüsselung, Dateisystem) mit denen Disk-Images unter MacOSX erstellt werden können, bietet sich eine Konvertierung in ein ISO-Image an. Die Eingabe von

hdituil convert VorhandenesMacOSXDiskImage.dmg -format UDTO -o UnterWindowsNutzbaresDiskImage.iso

im Terminal, konvertiert ein beliebiges unter MacOSX erstelltes Disk-Image VorhandenesMacOSXDiskImage.dmg in die Datei UnterWindowsNutzbaresDiskImage.iso.cdr. Diese Datei läßt sich unter Windows wie jedes ISO-Image benutzen und auf CD oder DVD brennen. Falls Sie ein solches Image unter Windows mounten und nutzen wollen: wird auf dem Image das Dateisystem HFS benutzt, wird zum Lesen ein weiteres Programm wie beispielsweise MacDisk benötigt.

Posted by Markus at 5:53 PM
Edited on: Friday, January 26, 2007 7:03 PM
Categories: MacOSX - the daily life