From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12913 invoked from network); 8 Dec 2023 18:52:09 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 8 Dec 2023 18:52:09 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id DCE1F483C1E for ; Fri, 8 Dec 2023 19:51:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WjfaKD4qRLr1 for ; Fri, 8 Dec 2023 19:51:47 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 6796E483AA5 for ; Fri, 8 Dec 2023 19:51:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 87C56483A23 for ; Fri, 8 Dec 2023 19:51:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GWWN45heJlnA for ; Fri, 8 Dec 2023 19:51:16 +0100 (CET) X-Greylist: delayed 11539 seconds by postgrey-1.36 at cgl.ntg.nl; Fri, 08 Dec 2023 19:51:16 CET Received: from seout4.web-dns1.com (seout4.web-dns1.com [67.215.8.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id D02F0483A21 for ; Fri, 8 Dec 2023 19:51:16 +0100 (CET) Received: from mailpro1.whc.ca ([51.79.16.13]) by se1.web-dns1.com with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rBfwP-009Ijd-Ec; Fri, 08 Dec 2023 13:51:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=jdvb.ca; s=default; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JcyA6QgWRkwnmv2SXqoaKHqZ7acfjygAcyQNbOjPdNU=; b=NQ5l7z+42t8KTK2GoQjOH4ffdF PkE+wjBgNgiJiyT18eGCPvHHSm6u7LjUMBob2fFEkT4nC1MmSNoDZqnbNTvKy8EU/X9j3Sal7g0cy vl+NPt90OytKjC30VWscV5KyRdx9d/HAYNTzeWSTujn2ITkAuM8uZCqUTrskJdHkpq3ozpL88fLZn a+KSku8yKFFZ9ZOgkbZgd/X274F2ufSmJXAF4GuYz3p+sQ3xVr8LlE5lbzxqOUprs0WEmycKbUQWr sOAQb7DmyeTTdBkp/piK0XEofqC4mL7tQmAN+7Vuv8zp5itpBmV2Byp+oQSdoJyrFKh/7S6JCipvq u3SkNIEw==; Received: from [47.55.144.2] (port=59336 helo=x360) by mailpro1.whc.ca with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rBfwG-0037e9-2Z; Fri, 08 Dec 2023 13:51:12 -0500 Received: by x360 (Postfix, from userid 1000) id 53D111E0AD3; Fri, 8 Dec 2023 14:51:04 -0400 (AST) Date: Fri, 8 Dec 2023 14:51:04 -0400 From: Jim To: mailing list for ConTeXt users Message-ID: References: <913fa7c5-a9fc-4edf-909f-f7805e97aaa3@freedom.nl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Microslop: Just say no X-Originating-IP: 51.79.16.13 X-SpamExperts-Domain: out.mailpro1.whc.ca X-SpamExperts-Username: 51.79.16.13 Authentication-Results: web-dns1.com; auth=pass smtp.auth=51.79.16.13@out.mailpro1.whc.ca X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.28) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT/uBE9W0Ry/yloCznj1QGjKPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5z3gEaB/JQYfKjMzozahqyU4ce7f6g2YMTdgxcKzV6/0h7z FWO5bvjJtfgbtmOHPiM+6ZTz1zw5rFxYuanvKekSENOG9RdqjfU98hYYSF4B3NqwTTJhLChIm0ME lNcQXjgoDPIpDsKwoyTIui+AiRJLkkQ/7TAGGbWXGjUIL/DYyq+c576nKJPMMcZr9UY7ef8KCdpv IV8AYn3QDLK3yN8eyIDzeA/IX9UMWkk1u8XI17DY27xZiOmTUqT1Bu490izs/sb16ESDOWr/ATs5 NT2bPEg+PVRTiaxPY52n0Pp/8/afKMC1CfM9pITDVvMyZT+1eZ2E8T8HmMZ1rYkweA8erWo7uxL9 8w60598EoPbTWC0DPmATCrs8c4mbof5p79GLb5mum9xAXSaS3KKPtTZXWZip9+GhedmPokL8D3vh vVtGeuE5PWdy78KchNensgLp0sJdOkKqdD9x6uqeC1JiFH069urP+T0mXHxFNmQkKyk4xAm9D8KT eKJT7gNACPfrpX5tbW2x+DbE8DYItjA3VKykPleqV+WwxIlzrEfKJ9P5pROqw+/zlUP6TeTsOgUT Q+8NaYYcEfMm30de5QKrkExnbnqBalLpff1lZCCO8mGGW6zEtBDxtBJRScabKQUxCnbRrsNzTdgu XXkJRfGnT1x3J3x9C/JvCw0OsaaS7pBpMv6XivSqOVF9dOkUQ6u45yZIVeO0dDU5Wq59q7QshU8I ZHVsjnT8QMsQxy3Tz4g0s62FkZ/vBkf2pUtrn3lvA3QEKTMFvUWB5kl7tpOKC5WxiWGubx+Y+UVt /SqZUuuO5TcDeKjrEmYPn2IVWRuZugsMmckvsCm2uLlbyBQeeA3W5s5CQMWewsivofMgUVuzlEXU F5Xku3OEdnsQ1QSoTtVfe5+13BWNcC5km3of7HdsJQ9VgfAYiaG2zv4s6PoumsD+E65k6PweojVG 7oHJJ8slNEAaYitUH/s60iid X-Report-Abuse-To: spam@se1.web-dns1.com Message-ID-Hash: WCNYOHB2243BQ3MW4HHAYSZPEDQMDRXM X-Message-ID-Hash: WCNYOHB2243BQ3MW4HHAYSZPEDQMDRXM X-MailFrom: zlists+context@jdvb.ca X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: mtx-synctex.lua question List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Hans (and anyone else interested in synctex), On Fri, Dec 8, 2023 at 11:38 (-0400), Jim wrote: > Hi Hans, > On Fri, Dec 8, 2023 at 15:03 (+0100), Hans Hagen wrote: >> On 12/7/2023 7:23 PM, Jim wrote: >>> Hi, >>> In mtx-synctex.lua, inside >>> local function findlocation(filename,page,xpos,ypos,tolerance) >>> there is the following code: >>> for s=1,tolerance,max(tolerance//10,1) do >>> locate( s, 0) if fi ~= 0 then tl = s ; goto done end >>> locate(-s, 0) if fi ~= 0 then tl = s ; goto done end >>> locate( s, s) if fi ~= 0 then tl = s ; goto done end >>> locate( s,-s) if fi ~= 0 then tl = s ; goto done end >>> locate(-s, s) if fi ~= 0 then tl = s ; goto done end >>> locate(-s,-s) if fi ~= 0 then tl = s ; goto done end >>> end >>> Is the omission of the >>> locate(0, s) ... >>> and >>> locate(0, -s) ... >>> cases intentional, or is that an oversight? >>> If intentional, can someone explain the rationale to me? >> it's too long ago to remember the reason ... did you test with and without? > I did not. Yet. > But on your suggestion, I will give it a try and get back to you. I modified mtx-synctex.lua as follows: % diff /usr/local/context/tex/texmf-context/scripts/context/lua/mtx-synctex.lua mtx-synctex-jd.lua 279a280 > -- JD added (0, +/-s) cases for testing 282a284,285 > locate( 0, s) if fi ~= 0 then tl = s ; goto done end > locate( 0,-s) if fi ~= 0 then tl = s ; goto done end and then wrote the following quick and dirty shell script to create log files for comparison: --------------------------------------------------------------------- #! /bin/zsh # File: compare-my-synctex-version # Author: Jim Diamond # Created: 2023/12/08 13:27:23 # # Purpose: Run some tests to compare ConTeXt's mtx-synctex-lua to # my own version, vis-a-vis the backward-search # functionality. # # Notes: Assumes $1 is a valid ConTeXt synctex file, # $2 is a valid page within that file, and # $3, if present, is a valid DEFAULT_TOLERANCE=300 if [[ $# < 2 || $# > 3 || ! -r $1 ]] then echo >&2 "Usage: $0 [tolerance]" echo >&2 " tolerance default is $DEFAULT_TOLERANCE." exit 1 fi st_file=$1 page=$2 if [[ $3 != "" ]] then tolerance=$3 else tolerance=$DEFAULT_TOLERANCE fi x_vals=`seq 100 50 550` y_vals=`seq 100 50 700` old_results=${st_file}_page_${page}_tol_${tolerance}_using_current.out new_results=${st_file}_page_${page}_tol_${tolerance}_using_new.out if [[ -e $old_results || -e $new_results ]] then printf >&2 "$0: at least one of\n\t%s\nor\n\t%s\nexists; quitting.\n" \ $old_results $new_results exit 1 fi # Get rid of the extra newline from mtxrun as done below. for x in $=x_vals do for y in $=y_vals do printf "%3d, %3d: " $x $y out=`mtxrun --script synctex --goto --direct \ --page=$page --x=$x --y=$y --tolerance=$tolerance $st_file` echo $out done done | tee $old_results echo for x in $=x_vals do for y in $=y_vals do printf "%3d, %3d: " $x $y out=`mtxrun --script mtx-synctex-jd.lua --goto --direct \ --page=$page --x=$x --y=$y --tolerance=$tolerance $st_file` echo $out done done | tee $new_results --------------------------------------------------------------------- and ran it on one page of one synctex file for a few different values of tolerance (300, 200, 100 and 50). To briefly summarize, the modified script found a small number of matches that the original script didn't, occasionally the line number was different (almost always by 1, but a few times more), and the tolerance returned by this test version was also <= the tolerance returned by the current version. Admittedly, with the other two directions added in, a more extensive test (a total of a bit under 14 minutes CPU time on a Ryzen 4700U) showed the new version is about 0.5% slower, so there is a very minor downside. (I'd happily spend the extra matches for the minuscule amount of CPU time, but others may not.) Cheers. Jim ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________