--- EqEditor.ORIG/TeXHelper.m Thu May 1 12:39:48 2003 +++ EqEditor/TeXHelper.m Tue May 6 17:46:41 2003 @@ -238,9 +238,13 @@ NSString *command = [NSString stringWithFormat: @"cd \"%@/\" && %@ \\\\scrollmode\\\\input{equation.tex} && %@ -E -Ppdf -x %@ equation.dvi -o equation.eps", workingDirectory, latex_bin, dvips_bin, [self magnificationAsString]]; - + +#if 0 if (system( [command lossyCString] ) != 0) { //[command cString] ) != 0) { - NSBeginAlertSheet( +#else + if (system( [command UTF8String] ) != 0) { //[command cString] ) != 0) { +#endif + NSBeginAlertSheet( @"An error occurred during processing the equation. Do you want to view an error log?", // sheet message @"View error log", // default button label @@ -565,9 +569,13 @@ [NSString stringWithFormat: @"\nobj <<\n/Subject (ESannot%@ESannotend)\n/Type (EEtype%@EEtypeend)\n/Magnification (EEmag%@EEmagend)\n>> endobj", source, type, [magnification stringValue]]; - NSString *outputPDFFilePath = [NSString stringWithFormat: @"%@equation.pdf", [self workingDirectory]]; + NSString *outputPDFFilePath = [NSString stringWithFormat: @"%@equation.pdf", [self workingDirectory]]; +#if 0 NSString *pdfContents = [NSString stringWithContentsOfFile: outputPDFFilePath]; - +#else + NSString *pdfContents = [[NSString alloc] initWithData: [NSData dataWithContentsOfFile: [NSString stringWithFormat: @"%@equation.pdf", [self workingDirectory]]] encoding: NSASCIIStringEncoding]; +#endif + NSRange r1 = [pdfContents rangeOfString: @"\nxref" options: NSBackwardsSearch]; NSRange r2 = [pdfContents lineRangeForRange: [pdfContents rangeOfString: @"startxref" options: NSBackwardsSearch]]; @@ -575,7 +583,7 @@ NSString *tail_of_tail = [pdfContents substringFromIndex: r2.location]; NSArray *tailarray = [tail_of_tail componentsSeparatedByString: @"\n"]; - int byte_count = atoi( [[tailarray objectAtIndex: 1] cString] ); + int byte_count = atoi( [[tailarray objectAtIndex: 1] cString] ) - 1; byte_count = [annotation cStringLength] + byte_count; NSRange r3;