On 12 Aug 2008, at 6:24 PM, Maxwell, Adam R wrote:

> On 08/12/08 09:16, "Christiaan Hofman" <[EMAIL PROTECTED]> wrote:
>>
>> On 12 Aug 2008, at 5:22 PM, Maxwell, Adam R wrote:
>>
>>> On 08/12/08 01:55, "Christiaan Hofman" <[EMAIL PROTECTED]> wrote:
>>>
>>>> Could someone test synctex in both directions with the current
>>>> source?
>>>
>>> TextMate->Skim works, although lines might be off-by-one.
>>
>> This may be due to the offset of the line number (0-based or 1- 
>> based).
>> Though Skim is making the same assumptions as every other pdfsync
>> implementation I have seen (TeXniscope, PDFView, iTeXMac, iTeXMac2,
>> TeXShop, auctex).
>
> Quite possible.  TextMate's line numbers in the gutter start from 1,  
> so
> presumably that's what gets passed to Skim.
>
>> About the abstract, what is the source file supposed to be? Is it
>> a .tex file?
>
> Yes.  The entire manuscript is actually in a single .tex file to  
> meet AGU
> requirements.  I'll see if I can reproduce it with a simpler case,  
> since
> posting this isn't an option.
>
> -- 
> Adam

Then it's really strange, as Skim and iteXMac2 are now doing  
essentially the same thing:

- (BOOL)synctexFindFileLine:(int *)line file:(NSString **)file  
forLocation:(NSPoint)point inRect:(NSRect)rect pageBounds: 
(NSRect)bounds atPageIndex:(unsigned int)pageIndex {
     BOOL rv = NO;
     if (synctex_edit_query(scanner, (int)pageIndex + 1, point.x,  
NSMaxY(bounds) - point.y) > 0) {
         synctex_node_t node = synctex_next_result(scanner);
         if (node) {
             *line = synctex_node_line(node) - 1;
             *file = SKTeXSourceFile([(NSString  
*)CFStringCreateWithFileSystemRepresentation(NULL,  
synctex_scanner_get_name(scanner, synctex_node_tag(node)))  
autorelease], [[self syncFileName] stringByDeletingLastPathComponent]);
             rv = YES;
         }
     }
     return rv;
}

- (BOOL)getLine:(unsigned int *)linePtr column:(unsigned int  
*)columnPtr length:(unsigned int *)lengthPtr source:(NSString  
**)sourcePtr forLocation:(NSPoint)point withHint:(NSDictionary *)hint  
inPageAtIndex:(unsigned int)pageIndex;
{
        NSValue * V = [hint objectForKey:@"page bounds"];
        if(!V)
        {
                return NO;
        }
        NSRect bounds = [V rectValue];
        point.y = NSMaxY(bounds)-point.y;
        if(synctex_edit_query(scanner,pageIndex+1,point.x,point.y)>0) {
                synctex_node_t node;
                if(node = synctex_next_result(scanner)) {
                        if(linePtr) *linePtr = synctex_node_line(node)-1;
                        if(columnPtr) *columnPtr = synctex_node_column(node);
                        if(lengthPtr) *lengthPtr = 0;
                        
                        if(sourcePtr) {
                                const char * rep =  
synctex_scanner_get_name(scanner,synctex_node_tag(node));                       
        
                                *sourcePtr = [DFM 
stringWithFileSystemRepresentation:rep  
length:strlen(rep)];
                                if(![*sourcePtr isAbsolutePath])
                                {
                                        rep = 
synctex_scanner_get_synctex(scanner);
                                        NSString * dir = [DFM 
stringWithFileSystemRepresentation:rep  
length:strlen(rep)];
                                        dir = [dir 
stringByDeletingLastPathComponent];
                                        [DFM pushDirectory:dir];
                                        NSURL * url = [NSURL 
fileURLWithPath:*sourcePtr];
                                        [DFM popDirectory];
                                        *sourcePtr = [url path];
                                }
                                
                        }
                        return YES;
                }
        }
        return NO;
}

And SKTeXSourceFile only completes a relative path, may add a  
missing .tex, and standardizes the path.

Christiaan



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users

Reply via email to