texlive[43989] Build/source/texk/web2c/synctexdir: Adding SyncTeX

commits+jlaurens at tug.org commits+jlaurens at tug.org
Sun Apr 23 12:46:52 CEST 2017


Revision: 43989
          http://tug.org/svn/texlive?view=revision&revision=43989
Author:   jlaurens
Date:     2017-04-23 12:46:51 +0200 (Sun, 23 Apr 2017)
Log Message:
-----------
Adding SyncTeX support to \pdfxform. For pdftex only but EVERY TeX engine is concerned. OK on OSX, untested on windows and other platforms. The synctex command line tool will be updated soon.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/synctexdir/ChangeLog
    trunk/Build/source/texk/web2c/synctexdir/man1/synctex.1
    trunk/Build/source/texk/web2c/synctexdir/man5/synctex.5
    trunk/Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch2
    trunk/Build/source/texk/web2c/synctexdir/synctex-pdftex.h
    trunk/Build/source/texk/web2c/synctexdir/synctex.c
    trunk/Build/source/texk/web2c/synctexdir/synctex.defines
    trunk/Build/source/texk/web2c/synctexdir/synctex.h

Modified: trunk/Build/source/texk/web2c/synctexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/ChangeLog	2017-04-23 10:06:27 UTC (rev 43988)
+++ trunk/Build/source/texk/web2c/synctexdir/ChangeLog	2017-04-23 10:46:51 UTC (rev 43989)
@@ -1,3 +1,8 @@
+2017-04-22 Jerome Laurens
+    <jerome.laurens at u-bourgogne.fr>
+
+    * man5/synctex.1, man5/synctex.5, synctex-pdf-rec.ch2, synctex-pdftex.h, synctex-rec.ch0, synctex.c, synctex.defines, synctex.h: add support for \pdfxform
+
 2016-03-04  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* synctex-ep-mem.ch1, synctex-p-mem.ch1: Adapt to changes in

Modified: trunk/Build/source/texk/web2c/synctexdir/man1/synctex.1
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/man1/synctex.1	2017-04-23 10:06:27 UTC (rev 43988)
+++ trunk/Build/source/texk/web2c/synctexdir/man1/synctex.1	2017-04-23 10:46:51 UTC (rev 43989)
@@ -1,4 +1,4 @@
-.Dd 06/26/2013     \" DATE 
+.Dd 04/23/2017     \" DATE
 .Dt synctex 1      \" Program name and manual section number 
 .Sh NAME
 .Nm synctex
@@ -13,10 +13,27 @@
 and vice versa.
 .Pp
 Run `synctex help' to access the built-in tool documentation.
-.Sh SEE ALSO 
+.Sh TEX ENGINE OPTION -synctex=NUMBER
+.It
+.Li If NUMBER=0 or no option is given, no synctex file is created.
+.It
+.Li If NUMBER<0, synctex files are text files.
+.It
+.Li If NUMBER>0, synctex files are compressed with gz.
+.It
+.Li If NUMBER&2, no .gz extension is used.
+.It
+.Li If NUMBER&4, activate form support, useful for pdftex.
+.It
+.Li If NUMBER&8, better file compression.
+.Pp
+Use for example `pdftex -synctex=15 foo.tex' to activate all the options.
+.Pp
+Notice that LuaTeX option is `--synctex=NUMBER' with two dashes.
+.Sh SEE ALSO
 .\" List links in ascending order by section, alphabetically within a section.
 .\" Please do not reference files that do not exist without filing a bug report
-.Xr synctex 5 
+.Xr synctex 5
 .Xr tex 1
 .Sh AUTHOR
 The Synchronize TeXnology is essentially due to Jerome Laurens,
@@ -23,7 +40,7 @@
 with useful suggestions by some well known actors of the TeX world.
 .\" .Sh BUGS              \" Document known, unremedied bugs 
 .Sh HISTORY           \" Document history if command behaves in a unique manner
-This document has never been updated.
+Revised on Sun Apr 23 09:54:20 UTC 2017.
 .\" nroff -man synctex.1 | less
 .\"groff -man -Tascii synctex.1 | less
 .\"To convert a man page to plain pre-formatted text (e.g for spell checking) use:

Modified: trunk/Build/source/texk/web2c/synctexdir/man5/synctex.5
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/man5/synctex.5	2017-04-23 10:06:27 UTC (rev 43988)
+++ trunk/Build/source/texk/web2c/synctexdir/man5/synctex.5	2017-04-23 10:46:51 UTC (rev 43989)
@@ -1,4 +1,4 @@
-.Dd Mar 13, 2012
+.Dd Apr 22, 2017
 .Dt SYNCTEX 5
 .Os "Independant"
 .\"
@@ -13,8 +13,7 @@
 .Pq synctexs
 are text files that help input/output synchronization during document preparation with the TeX typesetting system.
 .Sh BASICS
-The structure of this file should not be considered public, in the sense that no one should need to parse its contents, except the synctex command line utility, and the synctex_parser library.
-Unless it is absolutely not avoidable, access to the contents of the synctex file should only be made through requests made to the synctex command line utility.
+The structure of this file should not be considered public, in the sense that no one should need to parse its contents, except the synctex command line utility, and the synctex_parser library which are both publicly available. Unless it is absolutely not avoidable, access to the contents of the synctex file should only be made through requests made to the synctex command line utility.
 .\"
 .Sh STRUCTURE
 The element structure of a synctex file is a list of text line records as follows.
@@ -94,19 +93,21 @@
 .Qq Content:
 <EOL>
 .It
+.Li (<Form(k)>|<Input Line>)*
+.It
 .Li <sheet(1)>
 .It
-.Li <Input Line>*
+.Li (<Form(k)>|<Input Line>)*
 .It
 .Li <sheet(2)>
 .It
-.Li <Input Line>*
+.Li (<Form(k)>|<Input Line>)*
 .It
 .Li ...
 .It
 .Li <sheet(N)>
 .It
-.Li <Input Line>*
+.Li (<Form(k)>|<Input Line>)*
 .El
 .It
 .Li <byte offset record> ::=
@@ -123,9 +124,9 @@
 .Li <byte offset record>
 .It
 .Qq \&{
-<the integer n> <end of record>/
+<the integer n> <end of record>
 .It
-.Li <box content>*
+.Li <vbox section>|<hbox section>
 .It
 .Li <byte offset record>
 .It
@@ -132,8 +133,28 @@
 .Qq \&}
 <the integer n> <end of record>
 .El
+.It
+.Li <Form> ::=
+.Bl -item -offset indent
+.It
+.Li <byte offset record>
+.It
+.Qq \&<
+<form tag> <end of record>
+.It
+.Li <vbox section>|<hbox section>
+.It
+.Li <byte offset record>
+.It
+.Qq \&>
+<end of record>
 .El
+.It
+.Li <form tag> ::= <integer>
+.El
 .Pp
+Forms are available with pdfTeX.
+All the numbers are integers encoded using the decimal representation with "C" locale.
 The <box content> describes what is inside a box.
 It is either a vertical or horizontal box,
 with some records related to glue, kern or math nodes.
@@ -146,7 +167,9 @@
 .It
 .Li |<void vbox record>|<void hbox record>
 .It
-.Li |<current record>|<glue record>|<kern record>|<math record>
+.Li |<current record>|<glue record>|<kern record>
+.It
+.Li |<math record>|<form ref record>|<Form>
 .El
 .It
 .Li <vbox section> ::=
@@ -201,6 +224,27 @@
 .Qq \&:
 <size> <end of record>
 .It
+.Li <link> ::= <tag>
+.Qq \&,
+<line>(
+.Qq \&,
+<column>)?
+.It
+.Li <point> ::= <full point>|<compressed point>
+.It
+.Li <full point> ::=
+<integer>
+.Qq \&,
+<integer>
+.It
+.Li <compressed point> ::=
+<integer>
+.Qq \&,=
+.It
+.Li <line> ::= <integer>
+.It
+.Li <column> ::= <integer>
+.It
 .Li <size> ::= <Width>
 .Qq \&,
 <Height>
@@ -212,16 +256,6 @@
 .Li <Height> ::= <integer>
 .It
 .Li <Depth> ::= <integer>
-.It
-.Li <link> ::= <tag>
-.Qq \&,
-<line>(
-.Qq \&,
-<column>)?
-.It
-.Li <line> ::= <integer>
-.It
-.Li <column> ::= <integer>
 .El
 .Pp
 The forthcoming records are basic one liners.
@@ -252,6 +286,12 @@
 <link>
 .Qq \&:
 <point> <end of record>
+.It
+.Li <form ref record> ::=
+.Qq f
+<form tag>
+.Qq \&:
+<point> <end of record>
 .El
 .Pp
 .\" .Sx underline, .Dq double quotes, .Pq enclosed in parenthesis
@@ -308,7 +348,22 @@
 .Sh USAGE
 .Pp
 The <current record> is used to compute the visible size of hbox's.
-The byte offset is an implicit anchor to navigate the synctex file from sheet to sheet.
+The byte offset is an implicit anchor to navigate the synctex file from sheet to sheet. The second coordinate of
+a compressed point has been replaced by a
+.Qq =
+character which means that it is the second coordinate of the
+last full point available above.
+.Sh SEE ALSO 
+.\" List links in ascending order by section, alphabetically within a section.
+.\" Please do not reference files that do not exist without filing a bug report
+.Xr synctex 1
+.Xr tex 1
+.Sh AUTHOR
+The Synchronize TeXnology is essentially due to Jerome Laurens,
+with useful suggestions by some well known actors of the TeX world.
+.\" .Sh BUGS              \" Document known, unremedied bugs 
+.Sh HISTORY           \" Document history if command behaves in a unique manner
+This document has been updated on Sat Apr 22 09:57:20 UTC 2017 to include \\pdfxform support.
 .\" nroff -man synctex.5 | less
 .\"groff -man -Tascii synctex.5 | less
 .\"To convert a man page to plain pre-formatted text (e.g for spell checking) use:

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch2
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch2	2017-04-23 10:06:27 UTC (rev 43988)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch2	2017-04-23 10:46:51 UTC (rev 43989)
@@ -1,8 +1,9 @@
-Copyright (c) 2008, 2009 jerome DOT laurens AT u-bourgogne DOT fr
+Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
 
 This file is part of the SyncTeX package.
 
-Latest Revision: Wed Jul  1 11:17:45 UTC 2009
+Version 1
+Latest Revision: Sat Apr 22 10:07:05 UTC 2017
 
 License:
 --------
@@ -42,14 +43,17 @@
 If you include or use a significant part of the synctex package into a software,
 I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
 
-Version 1
-Latest Revision: Wed Jul  1 08:11:50 UTC 2009
-
 History:
 --------
 
+- the synctex hooks are changed to encapsulate Ship box |p| out
 - if the pdf file is removed, the synctex file is removed too.
 
+ at x pdftex.web l.14550
+@ @<Output the non-|char_node| |p| for |hlist_out|...@>=
+ at y
+@ @<Output the non-|char_node| |p| for |hlist_out|...@>=
+ at z
 @x
 margin_kern_node,
 kern_node: begin
@@ -58,13 +62,13 @@
 kern_node: begin
 @z
 
- at x
+ at x pdftex.web l.18491
 procedure pdf_hlist_out; {output an |hlist_node| box}
 @y
 procedure pdf_hlist_out; {output an |hlist_node| box}
 @z
 
- at x pdftex.web l.18367
+ at x pdftex.web l.18519
 while p<>null do
     @<Output node |p| for |pdf_hlist_out| and move to the next node,
     maintaining the condition |cur_v=base_line|@>;
@@ -76,13 +80,13 @@
 @<Finish hlist {\sl Sync\TeX} information record@>;
 @z
 
- at x
+ at x pdftex.web l.18533
 @ @<Output node |p| for |pdf_hlist_out|...@>=
 @y
 @ @<Output node |p| for |pdf_hlist_out|...@>=
 @z
 
- at x pdftex.web l.18382
+ at x pdftex.web l.18544
   until not is_char_node(p);
 @y
   until not is_char_node(p);
@@ -95,7 +99,7 @@
 @ @<Output the non-|char_node| |p| for |pdf_hlist_out|...@>=
 @z
 
- at x
+ at x pdftex.web l.18557
 margin_kern_node,
 kern_node:cur_h:=cur_h+width(p);
 @y
@@ -115,7 +119,7 @@
 end;
 @z
 
- at x pdftex.web l.18411
+ at x pdftex.web l.18566
 move_past: cur_h:=cur_h+rule_wd;
 @y
 move_past: begin
@@ -146,7 +150,7 @@
 @p procedure pdf_vlist_out; {output a |pdf_vlist_node| box}
 @z
 
- at x pdftex.web l.18521
+ at x pdftex.web l.18670
 left_edge:=cur_h; cur_v:=cur_v-height(this_box); top_edge:=cur_v;
 @y
 left_edge:=cur_h;
@@ -154,7 +158,7 @@
 cur_v:=cur_v-height(this_box); top_edge:=cur_v;
 @z
 
- at x pdftex.web l.18523
+ at x pdftex.web l.18673
 while p<>null do
     @<Output node |p| for |pdf_vlist_out| and move to the next node,
     maintaining the condition |cur_h=left_edge|@>;
@@ -165,7 +169,7 @@
 @<Finish vlist {\sl Sync\TeX} information record@>;
 @z
 
- at x pdftex.web l.18557
+ at x pdftex.web l.18706
 @ @<(\pdfTeX) Output a box in a vlist@>=
 if list_ptr(p)=null then cur_v:=cur_v+height(p)+depth(p)
 @y
@@ -177,29 +181,15 @@
 end
 @z
 
- at x
- at p procedure pdf_ship_out(p: pointer; shipping_page: boolean); {output the box |p|}
+ at x pdftex.web l.18879
+@<(\pdfTeX) Ship box |p| out@>;
 @y
- at p procedure pdf_ship_out(p: pointer; shipping_page: boolean); {output the box |p|}
+pdf_output_value:=pdf_output; {{\sl Sync\TeX}: we assume that |pdf_output| is properly set up}
+if shipping_page then synctex_sheet(mag) @+else synctex_pdfxform(p);
+@<(\pdfTeX) Ship box |p| out@>;
+if shipping_page then synctex_teehs @+else synctex_mrofxfdp;
 @z
 
- at x pdftex.web l.18680
-pdf_last_resources: integer; {pointer to most recently generated Resources object}
- at y
-pdf_last_resources: integer; {pointer to most recently generated Resources object}
-begin @<Start sheet {\sl Sync\TeX} information record@>;
- at z
-
- at x pdftex.web l.18699
-@<Flush the box from memory, showing statistics if requested@>;
-end;
- at y
-@<Flush the box from memory, showing statistics if requested@>;
-end;
-@<Finish sheet {\sl Sync\TeX} information record@>;
-end;
- at z
-
 @x
 procedure close_files_and_terminate;
 @y
@@ -206,7 +196,7 @@
 procedure close_files_and_terminate;
 @z
 
- at x
+ at x pdftex.web l.33072
         remove_pdffile;
 @y
         remove_pdffile;
@@ -213,9 +203,11 @@
 		synctex_abort(log_opened);
 @z
 
- at x
-synctex_sheet(mag);
+ at x pdftex.web l.36224
+procedure out_form(p: pointer);
+begin
 @y
-pdf_output_value:=pdf_output; {{\sl Sync\TeX}: we assume that |pdf_output| is properly set up}
-synctex_sheet(mag);
+procedure out_form(p: pointer);
+begin
+  synctexpdfrefxform(pdf_xform_objnum(p));
 @z

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex-pdftex.h
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex-pdftex.h	2017-04-23 10:06:27 UTC (rev 43988)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex-pdftex.h	2017-04-23 10:46:51 UTC (rev 43989)
@@ -1,9 +1,10 @@
 /* 
-Copyright (c) 2008, 2009, 2010, 2011 jerome DOT laurens AT u-bourgogne DOT fr
+Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
 
 This file is part of the SyncTeX package.
 
-Latest Revision: Fri Apr 15 19:10:57 UTC 2011
+Version 1
+Latest Revision: Sat Apr 22 10:07:05 UTC 2017
 
 License:
 --------
@@ -43,16 +44,28 @@
 If you include or use a significant part of the synctex package into a software,
 I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
 
-Version 1
-Thu Jun 19 09:39:21 UTC 2008
-
 */
 
 #    include "pdftexd.h"
 
-/*   We observe pdfoutputvalue in order to determine whether output mode is
- *   pdf or dvi.
- *   We will assume that pdf_output_value equals pdf_output before entering
- *   the synctex_sheet function below, in the including synctex.c file.  */
-#    define SYNCTEX_OFFSET_IS_PDF (pdfoutputvalue>0)
-#    define SYNCTEX_OUTPUT ((pdfoutputvalue>0)?"pdf":"dvi")
+/*  We observe pdfoutputvalue in order to determine whether output mode is
+ *  pdf or dvi.
+ *  We will assume that pdf_output_value equals pdf_output      entering
+ *  the synctex_sheet function below, in the including synctex.c file.
+ */
+#   define SYNCTEX_OFFSET_IS_PDF (pdfoutputvalue>0)
+#   define SYNCTEX_OUTPUT ((pdfoutputvalue>0)?"pdf":"dvi")
+
+/*  Adding support for pdf forms
+ */
+#   define SYNCTEX_SUPPORT_PDF_FORM (1)
+#   define SYNCTEX_PDF_CUR_FORM (pdfcurform)
+
+/*  these messages should be sent to record information
+ *  for a form node (\pdfrefxform).
+ *  No engine discrimination.
+ */
+extern void synctexpdfxform(halfword p);
+extern void synctexmrofxfdp();
+extern void synctexpdfrefxform(int objnum);
+

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex.c
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex.c	2017-04-23 10:06:27 UTC (rev 43988)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex.c	2017-04-23 10:46:51 UTC (rev 43989)
@@ -1,9 +1,10 @@
 /* 
- Copyright (c) 2008, 2009, 2010, 2011 jerome DOT laurens AT u-bourgogne DOT fr
+ Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
  
  This file is part of the SyncTeX package.
  
- Latest Revision: Fri Apr 15 19:10:57 UTC 2011
+ Version 1
+ Latest Revision: Sat Apr 22 10:07:05 UTC 2017
  
  License:
  --------
@@ -109,7 +110,7 @@
  is producing the expected file named <my file.synctex>, (the '<' and '>' are not part of the name)
  whereas running the command line
  pdftex --synctex=-1 "my file.tex"
- was producing the unexpected file named <"my file".synctex> where the two '"' chracters were part of the name.
+ was producing the unexpected file named <"my file".synctex> where the two '"' characters were part of the name.
  Of course, that was breaking the typesetting mechanism when pdftex was involved.
  To solve this problem, we prefer to rely on the output_file_name instead of the jobname.
  In the case when no output_file_name is available, we use jobname and test if the file name
@@ -118,7 +119,7 @@
  There is some conditional coding.
  
  Version 1
- Latest Revision: Wed Jul  1 08:15:44 UTC 2009
+ Latest Revision: Sat Apr 22 09:10:30 UTC 2017
  
  */
 
@@ -338,6 +339,10 @@
 
 #   include "synctex.h"
 
+#   if !defined(SYNCTEX_SUPPORT_PDF_FORM)
+#       define SYNCTEX_SUPPORT_PDF_FORM 0
+#   endif
+
 #   define SYNCTEX_YES (1)
 #   define SYNCTEX_NO  (0)
 #   define SYNCTEX_NO_ERROR  (0)
@@ -394,7 +399,11 @@
     integer curh, curv;         /*  current point  */
     integer magnification;      /*  The magnification as given by \mag */
     integer unit;               /*  The unit, defaults to 1, use 8192 to produce shorter but less accurate info */
-    integer total_length;       /*  The total length of the bytes written since the last check point  */
+    integer total_length;       /*  The total length of the bytes written since    the last check point  */
+    integer options;            /* unsigned options */
+    integer lastv;              /* compression trick if
+                                 |synctex_options&4|>0.  */
+    integer form_depth;        /*  pdf forms are an example of nested sheets */
     struct _flags {
         unsigned int option_read:1; /*  Command line option read (in case of problem or at the end) */
         unsigned int off:1;         /*  Definitely turn off synctex, corresponds to cli option -synctex=0 */
@@ -406,7 +415,7 @@
         unsigned int reserved:SYNCTEX_BITS_PER_BYTE*sizeof(int)-7; /* Align */
     } flags;
 } synctex_ctxt = {
-    NULL, NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0,0,0}};
+    NULL, NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, {0,0,0,0,0,0,0,0}}; /* last_v_recorded is initialized to -1. */
 
 #   define SYNCTEX_FILE synctex_ctxt.file
 #   define SYNCTEX_IS_OFF (synctex_ctxt.flags.off)
@@ -415,6 +424,13 @@
 #   define SYNCTEX_WARNING_DISABLE (synctex_ctxt.flags.warn)
 #   define SYNCTEX_fprintf (*synctex_ctxt.fprintf)
 
+#   define SYNCTEX_IS_READY (synctex_ctxt.flags.ready)
+
+#   define SYNCTEX_NO_GZ_AUX_NAME\
+    (SYNCTEX_NO_GZ||((synctex_ctxt.options)&2)!=0)
+#   define SYNCTEX_WITH_FORMS (((synctex_ctxt.options)&4)!=0)
+#   define SYNCTEX_H_COMPRESS (((synctex_ctxt.options)&8)!=0)
+
 /*  Initialize the options, synchronize the variables.
  *  This is sent by *tex.web before any TeX macro is used.
  *  */
@@ -429,7 +445,7 @@
         SYNCTEX_VALUE = 0;
     } else if (synctex_options == 0) {
         /*  -synctex=0 was given: SyncTeX must be definitely disabled,
-         *  any subsequent \synctex=1 will have no effect at all */
+         *  any subsequent \synctex=N will have no effect at all */
         SYNCTEX_IS_OFF = SYNCTEX_YES;
         SYNCTEX_VALUE = 0;
     } else {
@@ -436,6 +452,10 @@
         /*  the command line options are not ignored  */
         if (synctex_options < 0) {
             SYNCTEX_NO_GZ = SYNCTEX_YES;
+            synctex_ctxt.options = -synctex_options;
+        } else {
+            SYNCTEX_NO_GZ = SYNCTEX_NO;
+            synctex_ctxt.options =  synctex_options;
         }
         /*  Initialize the content of the \synctex primitive */
         SYNCTEX_VALUE = synctex_options;
@@ -544,6 +564,9 @@
 #define rename fsyscp_rename
 #endif
 
+static inline int synctex_record_content(void);
+static inline int synctex_record_settings(void);
+
 /*  synctex_dot_open ensures that the foo.synctex file is open.
  *  In case of problem, it definitely disables synchronization.
  *  Now all the output synchronization info is gathered in only one file.
@@ -551,6 +574,7 @@
  *  plus 1 for the control but the overall benefits are not so clear.
  *  For example foo-i.synctex would contain input synchronization
  *  information for page i alone.
+ *  Options given through \synctex=Number are managed here too.
  */
 static void *synctex_dot_open(void)
 {
@@ -566,6 +590,18 @@
     if (SYNCTEX_FILE) {
         return SYNCTEX_FILE;    /*  synchronization is already enabled  */
     }
+    if (synctex_options < 0) {
+        SYNCTEX_NO_GZ = SYNCTEX_YES;
+        synctex_ctxt.options = -synctex_options;
+    } else if (synctex_options == 0) {
+        /*  \synctex=0 was given: SyncTeX must be definitely disabled,
+         *  any subsequent \synctex=N will have no effect at all */
+        SYNCTEX_IS_OFF = SYNCTEX_YES;
+        SYNCTEX_VALUE = 0;
+   } else {
+        SYNCTEX_NO_GZ = SYNCTEX_NO;
+        synctex_ctxt.options =  synctex_options;
+    }
 #   if SYNCTEX_DEBUG
     printf("\nwarning: Synchronize DEBUG: synctex_dot_open 1\n");
 #   endif
@@ -579,12 +615,11 @@
         if (len>0) {
             /*  jobname was set by the \jobname command on the *TeX side  */
             char *the_busy_name = xmalloc((size_t)
-                                          ( len
-                                           + strlen(synctex_suffix)
-                                           + strlen(synctex_suffix_gz)
-                                           + strlen(synctex_suffix_busy)
-                                           + 1
-                                           + (output_directory?strlen(output_directory) + strlen(DIR_SEP_STRING):0)));
+                ( len
+                 + strlen(synctex_suffix)
+                 + strlen(synctex_suffix_busy)
+                 + 1
+                 + (output_directory?strlen(output_directory) + strlen(DIR_SEP_STRING):0)));
             if (!the_busy_name) {
                 SYNCTEX_FREE(tmp);
                 tmp = NULL;
@@ -620,8 +655,9 @@
             tmp = NULL;
             strcat(the_busy_name, synctex_suffix);
             /*  Initialize SYNCTEX_NO_GZ with the content of \synctex to let the user choose the format. */
-            SYNCTEX_NO_GZ = SYNCTEX_VALUE < 0 ? SYNCTEX_YES : SYNCTEX_NO;
-            if (!SYNCTEX_NO_GZ) {
+#define SYNCTEX_GZ_LEN(WHAT)\
+(SYNCTEX_NO_GZ_AUX_NAME?0:strlen(WHAT))
+            if (!SYNCTEX_NO_GZ_AUX_NAME) {
                 strcat(the_busy_name, synctex_suffix_gz);
             }
             strcat(the_busy_name, synctex_suffix_busy);
@@ -656,7 +692,10 @@
 #   endif
                     SYNCTEX_FREE(the_busy_name);
                     the_busy_name = NULL;
-                    return SYNCTEX_FILE;
+                    if ((SYNCTEX_NO_ERROR == synctex_record_settings())
+                        && (SYNCTEX_NO_ERROR == synctex_record_content())) {
+                        return SYNCTEX_FILE;
+                    }
                 } else {
                     printf("\nSyncTeX warning: no synchronization, problem with %s\n",
                            the_busy_name);
@@ -798,9 +837,11 @@
 #   endif
     if (log_opened && (tmp = SYNCTEX_GET_LOG_NAME())) {
         /* In version 1, the jobname was used but it caused problems regarding spaces in file names. */
-        the_real_syncname = xmalloc((unsigned)
-                                    (strlen(tmp) + strlen(synctex_suffix) +
-                                     strlen(synctex_suffix_gz) + 1));
+        the_real_syncname =
+        xmalloc((unsigned)(strlen(tmp)
+                           + strlen(synctex_suffix)
+                           + SYNCTEX_GZ_LEN(synctex_suffix_gz)
+                           + 1));
         if (!the_real_syncname) {
             SYNCTEX_FREE(tmp);
             synctexabort(0);
@@ -822,7 +863,9 @@
         if (!SYNCTEX_NO_GZ) {
             /*  Remove any uncompressed synctex file, from a previous build. */
             remove(the_real_syncname);
-            strcat(the_real_syncname, synctex_suffix_gz);
+            if (!SYNCTEX_NO_GZ_AUX_NAME) {
+                strcat(the_real_syncname, synctex_suffix_gz);
+            }
         }
         /* allways remove the synctex output file before renaming it, windows requires it. */
         if (0 != remove(the_real_syncname) && errno == EACCES) {
@@ -852,12 +895,12 @@
 #ifdef W32UPTEXSYNCTEX
                         {
                         char *stmp = chgto_oem(tmp);
-                        printf((synctex_ctxt.flags.quoted ? "\nSyncTeX written on \"%s\"" : "\nSyncTeX written on %s."),
+                        printf((synctex_ctxt.flags.quoted ? "SyncTeX written on \"%s\"" : "\nSyncTeX written on %s.\n"),
                                stmp);
                         free(stmp);
                         }
 #else
-                        printf((synctex_ctxt.flags.quoted ? "\nSyncTeX written on \"%s\"" : "\nSyncTeX written on %s."),
+                        printf((synctex_ctxt.flags.quoted ? "SyncTeX written on \"%s\"\n" : "SyncTeX written on %s.\n"),
                                tmp);
 #endif
                         tmp = NULL;
@@ -878,7 +921,7 @@
                 remove(synctex_ctxt.busy_name);
             }
         }
-        if (SYNCTEX_NO_GZ) {
+        if (SYNCTEX_NO_GZ || SYNCTEX_NO_GZ_AUX_NAME) {
             /*  Remove any compressed synctex file, from a previous build. */
             strcat(the_real_syncname, synctex_suffix_gz);
             remove(the_real_syncname);
@@ -889,8 +932,10 @@
          We just try to remove existing synctex output files
          including the busy one. */
         the_real_syncname = xmalloc((size_t)
-                                    (len + strlen(synctex_suffix)
-                                     + strlen(synctex_suffix_gz) + 1));
+                                    (len
+                                     + strlen(synctex_suffix)
+                                     + SYNCTEX_GZ_LEN(synctex_suffix_gz)
+                                     + 1));
         if (!the_real_syncname) {
             SYNCTEX_FREE(tmp);
             synctexabort(0);
@@ -935,8 +980,6 @@
     synctexabort(0);
 }
 
-static inline int synctex_record_content(void);
-static inline int synctex_record_settings(void);
 static inline int synctex_record_sheet(integer sheet);
 
 /*  Recording the "{..." line.  In *tex.web, use synctex_sheet(pdf_output) at
@@ -967,11 +1010,6 @@
             if (mag > 0) {
                 synctex_ctxt.magnification = mag;
             }
-            if (SYNCTEX_NO_ERROR != synctex_record_settings()
-                || SYNCTEX_NO_ERROR != synctex_record_content()) {
-                synctexabort(0);
-                return;
-            }
         }
         synctex_record_sheet(SYNCTEX_GET_TOTAL_PAGES()+1);
     }
@@ -981,6 +1019,7 @@
     return;
 }
 
+static inline int synctex_record_anchor(void);
 static inline int synctex_record_teehs(integer sheet);
 
 /*  Recording the "}..." line.  In *tex.web, use synctex_teehs at
@@ -1002,8 +1041,217 @@
     return;
 }
 
-static inline void synctex_record_vlist(halfword p);
+/*  The SYNCTEX_IGNORE macro is used to detect unproperly initialized nodes.  See
+ *  details in the implementation of the functions below.  */
+#   define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE || (synctex_ctxt.form_depth>0 && !SYNCTEX_WITH_FORMS)
+#define SYNCTEX_RECORD_LEN_OR_RETURN_ERR do {\
+if (len > 0) {\
+synctex_ctxt.total_length += len;\
+++synctex_ctxt.count;\
+} else {\
+return -1;\
+} } while(false)
+#define SYNCTEX_RECORD_LEN_AND_RETURN_NOERR do {\
+if (len > 0) {\
+synctex_ctxt.total_length += len;\
+++synctex_ctxt.count;\
+return SYNCTEX_NOERR;\
+} } while(false)
 
+/*  Recording a "}..." or a ">" line  */
+static inline int synctex_record_teehs(integer sheet)
+{
+#   if SYNCTEX_DEBUG > 999
+    printf("\nSynchronize DEBUG: synctex_record_teehs\n");
+#   endif
+    if (SYNCTEX_NOERR == synctex_record_anchor()) {
+        int len = SYNCTEX_fprintf(SYNCTEX_FILE, "}%i\n", sheet);
+        SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
+    }
+    synctexabort(0);
+    return -1;
+}
+
+#   define SYNCTEX_CTXT_CURH \
+(synctex_ctxt.curh)
+#   define SYNCTEX_CTXT_CURV \
+(synctex_ctxt.curv)
+#   define SYNCTEX_SHOULD_COMPRESS_V \
+SYNCTEX_H_COMPRESS && (synctex_ctxt.lastv == SYNCTEX_CTXT_CURV)
+
+#if SYNCTEX_SUPPORT_PDF_FORM
+
+static inline int synctex_record_pdfxform(halfword form);
+
+/*  glue code, this message is sent whenever a pdf form will ship out
+ See pdftex.web: procedure out_form(p: pointer);  */
+void synctexpdfxform(halfword p)
+{
+    SYNCTEX_RETURN_IF_DISABLED;
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: synctexpdfxform\n");
+#   endif
+    if (SYNCTEX_IS_OFF) {
+        if (SYNCTEX_VALUE && !SYNCTEX_WARNING_DISABLE) {
+            SYNCTEX_WARNING_DISABLE = SYNCTEX_YES;
+            printf
+            ("\nSyncTeX warning: Synchronization was disabled from\nthe command line with -synctex=0\nChanging the value of \\synctex has no effect.");
+        }
+        return;
+    }
+    if (SYNCTEX_FILE
+        || (SYNCTEX_VALUE && (SYNCTEX_NO_ERROR != synctex_dot_open()))) {
+        synctex_record_pdfxform(p);
+    }
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: synctexpdfxform END\n");
+#   endif
+    return;
+}
+
+static inline int synctex_record_mrofxfdp(void);
+
+/*  glue code, this message is sent whenever a pdf form did ship out  */
+void synctexmrofxfdp(void)
+{
+    SYNCTEX_RETURN_IF_DISABLED;
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: synctexmrofxfdp\n");
+#   endif
+    synctex_record_mrofxfdp();
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: synctexmrofxfdp END\n");
+#   endif
+    return;
+}
+
+static inline int synctex_record_node_pdfrefxform(int formout);
+
+/*  glue code, this message is sent whenever a pdf form ref will ship out
+ See pdftex.web: procedure out_form(p: pointer);  */
+void synctexpdfrefxform(int objnum)
+{
+    SYNCTEX_RETURN_IF_DISABLED;
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: synctexpdfrefxform\n");
+#   endif
+    if (SYNCTEX_WITH_FORMS) {
+        synctex_record_node_pdfrefxform(objnum);
+    }
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: synctexpdfrefxform END\n");
+#   endif
+    return;
+}
+
+/*  Recording a "<..." line  */
+static inline int synctex_record_pdfxform(halfword form)
+{
+    SYNCTEX_RETURN_IF_DISABLED;
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: synctex_record_pdfxform\n");
+#   endif
+    if (SYNCTEX_IGNORE(nothing)) {
+        return SYNCTEX_NO_ERROR;
+    } else {
+        ++synctex_ctxt.form_depth;
+        if (SYNCTEX_WITH_FORMS) {
+            int len = SYNCTEX_fprintf(SYNCTEX_FILE, "<%i\n",
+                                  SYNCTEX_PDF_CUR_FORM);
+            SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
+        } else {
+            return SYNCTEX_NO_ERROR;
+        }
+    }
+    synctexabort(0);
+    return -1;
+}
+
+/*  Recording a ">" line  */
+static inline int synctex_record_mrofxfdp(void)
+{
+#   if SYNCTEX_DEBUG > 999
+    printf("\nSynchronize DEBUG: synctex_record_mrofxfpd\n");
+#   endif
+    if (SYNCTEX_NOERR == synctex_record_anchor()) {
+        --synctex_ctxt.form_depth;
+        if (SYNCTEX_WITH_FORMS) {
+            int len = SYNCTEX_fprintf(SYNCTEX_FILE, ">\n",
+                                  SYNCTEX_PDF_CUR_FORM);
+            SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
+        } else {
+            return SYNCTEX_NO_ERROR;
+        }
+    }
+    synctexabort(0);
+    return -1;
+}
+
+/*  Recording a "f..." line  */
+static inline int synctex_record_node_pdfrefxform(int objnum)//UNUSED form JL
+{
+    SYNCTEX_RETURN_IF_DISABLED;
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: synctex_record_node_pdfrefxform\n");
+#   endif
+    synctex_ctxt.curh = SYNCTEX_CURH;
+    synctex_ctxt.curv = SYNCTEX_CURV;
+    if (SYNCTEX_IGNORE(nothing)) {
+        return SYNCTEX_NO_ERROR;
+    } else if (synctex_ctxt.form_depth>0 && !SYNCTEX_WITH_FORMS) {
+        return SYNCTEX_NO_ERROR;
+    } else {
+        int len = 0;
+        if (SYNCTEX_SHOULD_COMPRESS_V) {
+            len = SYNCTEX_fprintf(SYNCTEX_FILE, "f%i:%i,=\n",
+                                  objnum,
+                                  SYNCTEX_CURH UNIT);
+        } else {
+            len = SYNCTEX_fprintf(SYNCTEX_FILE, "f%i:%i,%i\n",
+                                  objnum,
+                                  SYNCTEX_CURH UNIT,
+                                  SYNCTEX_CURV UNIT);
+            synctex_ctxt.lastv = SYNCTEX_CURV;
+        }
+        SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
+    }
+    synctexabort(0);
+    return -1;
+}
+#else
+/*  DO NOTHING functions.
+    Any engine will have these functions, even when not using pdf xforms.
+    One shoud be able to replace these void implementaions with an alternation in the header file.
+ */
+void synctexpdfxform(halfword p)
+{
+    SYNCTEX_RETURN_IF_DISABLED;
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: DO NOTHING synctexpdfxform\n");
+#   endif
+    return;
+}
+void synctexmrofxfdp(void)
+{
+    SYNCTEX_RETURN_IF_DISABLED;
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: DO NOTHING synctexmrofxfdp END\n");
+#   endif
+    return;
+}
+void synctexpdfrefxform(int objnum)
+{
+    SYNCTEX_RETURN_IF_DISABLED;
+#   if SYNCTEX_DEBUG
+    printf("\nSynchronize DEBUG: DO NOTHING synctexpdfrefxform\n");
+#   endif
+    return;
+}
+#endif
+/*#if SYNCTEX_SUPPORT_PDF_FORM*/
+
+static inline void synctex_record_node_vlist(halfword p);
+
 /*  When an hlist ships out, it can contain many different kern/glue nodes with
  *  exactly the same sync tag and line.  To reduce the size of the .synctex
  *  file, we only display a kern node sync info when either the sync tag or the
@@ -1012,16 +1260,12 @@
  *  consecutive nodes, as far as possible.  This tricky part uses a "recorder",
  *  which is the address of the routine that knows how to write the
  *  synchronization info to the .synctex file.  It also uses criteria to detect
- *  a change in the context, this is the macro SYNCTEX_???_CONTEXT_DID_CHANGE. The
- *  SYNCTEX_IGNORE macro is used to detect unproperly initialized nodes.  See
- *  details in the implementation of the functions below.  */
-#   define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE
+ *  a change in the context, this is the macro SYNCTEX_???_CONTEXT_DID_CHANGE.*/
 
-
 /*  This message is sent when a vlist will be shipped out, more precisely at
  *  the beginning of the vlist_out procedure in *TeX.web.  It will be balanced
  *  by a synctex_tsilv, sent at the end of the vlist_out procedure.  p is the
- *  address of the vlist We assume that p is really a vlist node! */
+ *  address of the vlist. We assume that p is really a vlist node! */
 void synctexvlist(halfword this_box)
 {
     SYNCTEX_RETURN_IF_DISABLED;
@@ -1037,10 +1281,10 @@
     synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box,box);
     synctex_ctxt.curh = SYNCTEX_CURH;
     synctex_ctxt.curv = SYNCTEX_CURV;
-    synctex_record_vlist(this_box);
+    synctex_record_node_vlist(this_box);
 }
 
-static inline void synctex_record_tsilv(halfword p);
+static inline void synctex_record_node_tsilv(halfword p);
 
 /*  Recording a "f" line ending a vbox: this message is sent whenever a vlist
  *  has been shipped out. It is used to close the vlist nesting level. It is
@@ -1062,10 +1306,10 @@
     synctex_ctxt.curh = SYNCTEX_CURH;
     synctex_ctxt.curv = SYNCTEX_CURV;
     synctex_ctxt.recorder = NULL;
-    synctex_record_tsilv(this_box);
+    synctex_record_node_tsilv(this_box);
 }
 
-static inline void synctex_record_void_vlist(halfword p);
+static inline void synctex_record_node_void_vlist(halfword p);
 
 /*  This message is sent when a void vlist will be shipped out.
  *  There is no need to balance a void vlist.  */
@@ -1084,7 +1328,7 @@
     synctex_ctxt.curh = SYNCTEX_CURH;
     synctex_ctxt.curv = SYNCTEX_CURV;
     synctex_ctxt.recorder = NULL;   /*  reset  */
-    synctex_record_void_vlist(p);
+    synctex_record_node_void_vlist(p);
 }
 
 static inline void synctex_record_hlist(halfword p);
@@ -1111,7 +1355,7 @@
     synctex_record_hlist(this_box);
 }
 
-static inline void synctex_record_tsilh(halfword p);
+static inline void synctex_record_node_tsilh(halfword p);
 
 /*  Recording a ")" line ending an hbox this message is sent whenever an hlist
  *  has been shipped out it is used to close the hlist nesting level. It is
@@ -1133,10 +1377,10 @@
     synctex_ctxt.curh = SYNCTEX_CURH;
     synctex_ctxt.curv = SYNCTEX_CURV;
     synctex_ctxt.recorder = NULL;   /*  reset  */
-    synctex_record_tsilh(this_box);
+    synctex_record_node_tsilh(this_box);
 }
 
-static inline void synctex_record_void_hlist(halfword p);
+static inline void synctex_record_node_void_hlist(halfword p);
 
 /*  This message is sent when a void hlist will be shipped out.
  *  There is no need to balance a void hlist.  */
@@ -1160,11 +1404,12 @@
     synctex_ctxt.curh = SYNCTEX_CURH;
     synctex_ctxt.curv = SYNCTEX_CURV;
     synctex_ctxt.recorder = NULL;   /*  reset  */
-    synctex_record_void_hlist(p);
+    synctex_record_node_void_hlist(p);
 }
 
 /* With LuaTeX we have to consider other node sizes than medium ones */
 #   define SYNCTEX_IGNORE_NODE(NODE,TYPE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
+|| (synctex_ctxt.form_depth>0 && !SYNCTEX_WITH_FORMS) \
 || (0 >= SYNCTEX_TAG_MODEL(NODE,TYPE)) \
 || (0 >= SYNCTEX_LINE_MODEL(NODE,TYPE))
 /*  This macro will detect a change in the synchronization context.  As long as
@@ -1175,7 +1420,7 @@
 || (SYNCTEX_TAG_MODEL(NODE,TYPE) != synctex_ctxt.tag)\
 || (SYNCTEX_LINE_MODEL(NODE,TYPE) != synctex_ctxt.line))
 
-void synctex_math_recorder(halfword p);
+void synctex_record_node_math(halfword p);
 
 /*  glue code, this message is sent whenever an inline math node will ship out
  See: @ @<Output the non-|char_node| |p| for...  */
@@ -1198,12 +1443,12 @@
     synctex_ctxt.curh = SYNCTEX_CURH;
     synctex_ctxt.curv = SYNCTEX_CURV;
     synctex_ctxt.recorder = NULL;/*  no need to record once more  */
-    synctex_math_recorder(p);/*  always record synchronously  */
+    synctex_record_node_math(p);/*  always record synchronously  */
 }
 
-static inline void synctex_record_glue(halfword p);
-static inline void synctex_record_kern(halfword p);
-static inline void synctex_record_rule(halfword p);
+static inline void synctex_record_node_glue(halfword p);
+static inline void synctex_record_node_rule(halfword p);
+static inline void synctex_record_node_kern(halfword p);
 
 /*  this message is sent whenever an horizontal glue node or rule node ships out
  See: move_past:...    */
@@ -1216,7 +1461,7 @@
 {
     SYNCTEX_RETURN_IF_DISABLED;
 #   if SYNCTEX_DEBUG
-    printf("\nSynchronize DEBUG: synctexglue\n");
+    printf("\nSynchronize DEBUG: synctexhorizontalruleorglue\n");
 #   endif
     switch (SYNCTEX_TYPE(p)) {
         case rule_node:
@@ -1245,17 +1490,17 @@
         case rule_node:
             synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,rule);
             synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,rule);
-            synctex_record_rule(p); /*  always record synchronously: maybe some text is outside the box  */
+            synctex_record_node_rule(p); /*  always record synchronously: maybe some text is outside the box  */
             break;
         case glue_node:
             synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,glue);
             synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,glue);
-            synctex_record_glue(p); /*  always record synchronously: maybe some text is outside the box  */
+            synctex_record_node_glue(p); /*  always record synchronously: maybe some text is outside the box  */
             break;
         case kern_node:
             synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,kern);
             synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,kern);
-            synctex_record_kern(p); /*  always record synchronously: maybe some text is outside the box  */
+            synctex_record_node_kern(p); /*  always record synchronously: maybe some text is outside the box  */
             break;
         default:
             printf("\nSynchronize ERROR: unknown node type %i\n", SYNCTEX_TYPE(p));
@@ -1262,8 +1507,6 @@
     }
 }
 
-void synctex_kern_recorder(halfword p);
-
 /*  this message is sent whenever a kern node ships out
  See: @ @<Output the non-|char_node| |p| for...    */
 void synctexkern(halfword p, halfword this_box)
@@ -1286,7 +1529,7 @@
             synctex_ctxt.node = p;
             synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,kern);
             synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,kern);
-            synctex_ctxt.recorder = &synctex_kern_recorder;
+            synctex_ctxt.recorder = &synctex_record_node_kern;
         } else {
             synctex_ctxt.node = p;
             synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,kern);
@@ -1294,7 +1537,7 @@
             synctex_ctxt.recorder = NULL;
             /*  always record when the context has just changed
              *  and when not the first node  */
-            synctex_kern_recorder(p);
+            synctex_record_node_kern(p);
         }
     } else {
         /*  just update the geometry and type (for future improvements)  */
@@ -1301,7 +1544,7 @@
         synctex_ctxt.node = p;
         synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,kern);
         synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,kern);
-        synctex_ctxt.recorder = &synctex_kern_recorder;
+        synctex_ctxt.recorder = &synctex_record_node_kern;
     }
 }
 
@@ -1311,7 +1554,7 @@
 #   define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE \
 || (synctex_ctxt.count>2000)
 
-void synctex_char_recorder(halfword p);
+void synctex_record_node_char(halfword p);
 
 /*  this message is sent whenever a char node ships out    */
 void synctexchar(halfword p, halfword this_box __attribute__ ((unused)))
@@ -1332,10 +1575,10 @@
     synctex_ctxt.line = 0;
     synctex_ctxt.recorder = NULL;
     /*  always record when the context has just changed  */
-    synctex_char_recorder(p);
+    synctex_record_node_char(p);
 }
 
-void synctex_node_recorder(halfword p);
+void synctex_record_node_unknown(halfword p);
 
 #   undef SYNCTEX_IGNORE
 #   define SYNCTEX_IGNORE(NODE) (SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE)
@@ -1352,7 +1595,7 @@
         return;
     }
     /*  always record, not very usefull yet  */
-    synctex_node_recorder(p);
+    synctex_record_node_unknown(p);
 }
 
 /*  this message should be sent to record information
@@ -1366,9 +1609,18 @@
     if (SYNCTEX_IGNORE(nothing)) {
         return;
     } else {
-        int len = SYNCTEX_fprintf(SYNCTEX_FILE, "x%i,%i:%i,%i\n",
+        int len = 0;
+        if (SYNCTEX_SHOULD_COMPRESS_V) {
+            len = SYNCTEX_fprintf(SYNCTEX_FILE, "x%i,%i:%i,=\n",
                                   synctex_ctxt.tag,synctex_ctxt.line,
-                                  SYNCTEX_CURH UNIT,SYNCTEX_CURV UNIT);
+                                  SYNCTEX_CURH UNIT);
+        } else {
+            len = SYNCTEX_fprintf(SYNCTEX_FILE, "x%i,%i:%i,%i\n",
+                                  synctex_ctxt.tag,synctex_ctxt.line,
+                                  SYNCTEX_CURH UNIT,
+                                  SYNCTEX_CURV UNIT);
+            synctex_ctxt.lastv = SYNCTEX_CURV;
+        }
         if (len > 0) {
             synctex_ctxt.total_length += len;
             return;
@@ -1409,7 +1661,9 @@
     printf("\nSynchronize DEBUG: synctex_record_preamble\n");
 #   endif
     len =
-    SYNCTEX_fprintf(SYNCTEX_FILE, "SyncTeX Version:%i\n", SYNCTEX_VERSION);
+    SYNCTEX_fprintf(SYNCTEX_FILE, "SyncTeX Version:%i\n",
+                    synctex_ctxt.options>SYNCTEX_VERSION?
+                    synctex_ctxt.options:SYNCTEX_VERSION);
     if (len > 0) {
         synctex_ctxt.total_length = len;
         return SYNCTEX_NOERR;
@@ -1475,116 +1729,121 @@
 #   endif
     if (SYNCTEX_NOERR == synctex_record_anchor()) {
         int len = SYNCTEX_fprintf(SYNCTEX_FILE, "{%i\n", sheet);
-        if (len > 0) {
-            synctex_ctxt.total_length += len;
-            ++synctex_ctxt.count;
-            return SYNCTEX_NOERR;
-        }
+        SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
     }
     synctexabort(0);
     return -1;
 }
 
-/*  Recording a "}..." line  */
-static inline int synctex_record_teehs(integer sheet)
-{
-#   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_record_teehs\n");
-#   endif
-    if (SYNCTEX_NOERR == synctex_record_anchor()) {
-        int len = SYNCTEX_fprintf(SYNCTEX_FILE, "}%i\n", sheet);
-        if (len > 0) {
-            synctex_ctxt.total_length += len;
-            ++synctex_ctxt.count;
-            return SYNCTEX_NOERR;
-        }
-    }
-    synctexabort(0);
-    return -1;
-}
-
 /*  Recording a "v..." line  */
-static inline void synctex_record_void_vlist(halfword p)
+static inline void synctex_record_node_void_vlist(halfword p)
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_record_void_vlist\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_void_vlist\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "v%i,%i:%i,%i:%i,%i,%i\n",
-                          SYNCTEX_TAG_MODEL(p,box),
-                          SYNCTEX_LINE_MODEL(p,box),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
-                          SYNCTEX_WIDTH(p) UNIT,
-                          SYNCTEX_HEIGHT(p) UNIT,
-                          SYNCTEX_DEPTH(p) UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
-    }
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "v%i,%i:%i,=:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,box),
+                              SYNCTEX_LINE_MODEL(p,box),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_WIDTH(p) UNIT,
+                              SYNCTEX_HEIGHT(p) UNIT,
+                              SYNCTEX_DEPTH(p) UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "v%i,%i:%i,%i:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,box),
+                              SYNCTEX_LINE_MODEL(p,box),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT,
+                              SYNCTEX_WIDTH(p) UNIT,
+                              SYNCTEX_HEIGHT(p) UNIT,
+                              SYNCTEX_DEPTH(p) UNIT);
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
+   }
+#   define SYNCTEX_RECORD_LEN_AND_RETURN do {\
+    if (len > 0) {\
+        synctex_ctxt.total_length += len;\
+        ++synctex_ctxt.count;\
+        return;\
+    } } while(false)
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
 /*  Recording a "[..." line  */
-static inline void synctex_record_vlist(halfword p)
+static inline void synctex_record_node_vlist(halfword p)
 {
     int len = 0;
     SYNCTEX_NOT_VOID = SYNCTEX_YES;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_record_vlist\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_vlist\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "[%i,%i:%i,%i:%i,%i,%i\n",
-                          SYNCTEX_TAG_MODEL(p,box),
-                          SYNCTEX_LINE_MODEL(p,box),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
-                          SYNCTEX_WIDTH(p) UNIT,
-                          SYNCTEX_HEIGHT(p) UNIT,
-                          SYNCTEX_DEPTH(p) UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "[%i,%i:%i,=:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,box),
+                              SYNCTEX_LINE_MODEL(p,box),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_WIDTH(p) UNIT,
+                              SYNCTEX_HEIGHT(p) UNIT,
+                              SYNCTEX_DEPTH(p) UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "[%i,%i:%i,%i:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,box),
+                              SYNCTEX_LINE_MODEL(p,box),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT,
+                              SYNCTEX_WIDTH(p) UNIT,
+                              SYNCTEX_HEIGHT(p) UNIT,
+                              SYNCTEX_DEPTH(p) UNIT);
+       synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
 /*  Recording a "]..." line  */
-static inline void synctex_record_tsilv(halfword p __attribute__ ((unused)))
+static inline void synctex_record_node_tsilv(halfword p __attribute__ ((unused)))
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_record_tsilv\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_tsilv\n");
 #   endif
     len = SYNCTEX_fprintf(SYNCTEX_FILE, "]\n");
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        return;
-    }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
 /*  Recording a "h..." line  */
-static inline void synctex_record_void_hlist(halfword p)
+static inline void synctex_record_node_void_hlist(halfword p)
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_record_void_hlist\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_void_hlist\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "h%i,%i:%i,%i:%i,%i,%i\n",
-                          SYNCTEX_TAG_MODEL(p,box),
-                          SYNCTEX_LINE_MODEL(p,box),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
-                          SYNCTEX_WIDTH(p) UNIT,
-                          SYNCTEX_HEIGHT(p) UNIT,
-                          SYNCTEX_DEPTH(p) UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "h%i,%i:%i,=:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,box),
+                              SYNCTEX_LINE_MODEL(p,box),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_WIDTH(p) UNIT,
+                              SYNCTEX_HEIGHT(p) UNIT,
+                              SYNCTEX_DEPTH(p) UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "h%i,%i:%i,%i:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,box),
+                              SYNCTEX_LINE_MODEL(p,box),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT,
+                              SYNCTEX_WIDTH(p) UNIT,
+                              SYNCTEX_HEIGHT(p) UNIT,
+                              SYNCTEX_DEPTH(p) UNIT);
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
@@ -1597,35 +1856,39 @@
 #   if SYNCTEX_DEBUG > 999
     printf("\nSynchronize DEBUG: synctex_record_hlist\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "(%i,%i:%i,%i:%i,%i,%i\n",
-                          SYNCTEX_TAG_MODEL(p,box),
-                          SYNCTEX_LINE_MODEL(p,box),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
-                          SYNCTEX_WIDTH(p) UNIT,
-                          SYNCTEX_HEIGHT(p) UNIT,
-                          SYNCTEX_DEPTH(p) UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "(%i,%i:%i,=:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,box),
+                              SYNCTEX_LINE_MODEL(p,box),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_WIDTH(p) UNIT,
+                              SYNCTEX_HEIGHT(p) UNIT,
+                              SYNCTEX_DEPTH(p) UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "(%i,%i:%i,%i:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,box),
+                              SYNCTEX_LINE_MODEL(p,box),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT,
+                              SYNCTEX_WIDTH(p) UNIT,
+                              SYNCTEX_HEIGHT(p) UNIT,
+                              SYNCTEX_DEPTH(p) UNIT);
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
 /*  Recording a ")..." line  */
-static inline void synctex_record_tsilh(halfword p __attribute__ ((unused)))
+static inline void synctex_record_node_tsilh(halfword p __attribute__ ((unused)))
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_record_tsilh\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_tsilh\n");
 #   endif
     len = SYNCTEX_fprintf(SYNCTEX_FILE, ")\n");
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
-    }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
@@ -1671,141 +1934,149 @@
 }
 
 /*  Recording a "g..." line  */
-static inline void synctex_record_glue(halfword p)
+static inline void synctex_record_node_glue(halfword p)
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_glue_recorder\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_glue\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "g%i,%i:%i,%i\n",
-                          SYNCTEX_TAG_MODEL(p,glue),
-                          SYNCTEX_LINE_MODEL(p,glue),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "g%i,%i:%i,=\n",
+                              SYNCTEX_TAG_MODEL(p,glue),
+                              SYNCTEX_LINE_MODEL(p,glue),
+                              SYNCTEX_CTXT_CURH UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "g%i,%i:%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,glue),
+                              SYNCTEX_LINE_MODEL(p,glue),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT);
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
 /*  Recording a "k..." line  */
-static inline void synctex_record_kern(halfword p)
+static inline void synctex_record_node_kern(halfword p)
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_kern_recorder\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_kern\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
-                          SYNCTEX_TAG_MODEL(p,glue),
-                          SYNCTEX_LINE_MODEL(p,glue),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
-                          SYNCTEX_WIDTH(p) UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,=:%i\n",
+                              SYNCTEX_TAG_MODEL(p,glue),
+                              SYNCTEX_LINE_MODEL(p,glue),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_WIDTH(p) UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
+                              SYNCTEX_TAG_MODEL(p,glue),
+                              SYNCTEX_LINE_MODEL(p,glue),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT,
+                              SYNCTEX_WIDTH(p) UNIT);
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
 /*  Recording a "r..." line  */
-static inline void synctex_record_rule(halfword p)
+static inline void synctex_record_node_rule(halfword p)
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_record_tsilh\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_tsilh\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "r%i,%i:%i,%i:%i,%i,%i\n",
-                          SYNCTEX_TAG_MODEL(p,rule),
-                          SYNCTEX_LINE_MODEL(p,rule),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
-                          SYNCTEX_RULE_WD UNIT, SYNCTEX_RULE_HT UNIT, SYNCTEX_RULE_DP UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "r%i,%i:%i,=:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,rule),
+                              SYNCTEX_LINE_MODEL(p,rule),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_RULE_WD UNIT, SYNCTEX_RULE_HT UNIT, SYNCTEX_RULE_DP UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "r%i,%i:%i,%i:%i,%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p,rule),
+                              SYNCTEX_LINE_MODEL(p,rule),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT,
+                              SYNCTEX_RULE_WD UNIT, SYNCTEX_RULE_HT UNIT, SYNCTEX_RULE_DP UNIT);
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
 /*  Recording a "$..." line  */
-void synctex_math_recorder(halfword p)
+void synctex_record_node_math(halfword p)
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_math_recorder\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_math\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "$%i,%i:%i,%i\n",
-                          SYNCTEX_TAG_MODEL(p, math),
-                          SYNCTEX_LINE_MODEL(p, math),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "$%i,%i:%i,=\n",
+                              SYNCTEX_TAG_MODEL(p, math),
+                              SYNCTEX_LINE_MODEL(p, math),
+                              SYNCTEX_CTXT_CURH UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "$%i,%i:%i,%i\n",
+                              SYNCTEX_TAG_MODEL(p, math),
+                              SYNCTEX_LINE_MODEL(p, math),
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT);
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
-/*  Recording a "k..." line  */
-void synctex_kern_recorder(halfword p)
-{
-    int len = 0;
-#   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_kern_recorder\n");
-#   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
-                          SYNCTEX_TAG_MODEL(p, kern),
-                          SYNCTEX_LINE_MODEL(p, kern),
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
-                          SYNCTEX_WIDTH(p) UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
-    }
-    synctexabort(0);
-    return;
-}
-
 /*  Recording a "c..." line  */
-void synctex_char_recorder(halfword p __attribute__ ((unused)))
+void synctex_record_node_char(halfword p __attribute__ ((unused)))
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_char_recorder\n");
+    printf("\nSynchronize DEBUG: synctex_record_node_char\n");
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "c%i,%i\n",
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "c%i,=\n",
+                              SYNCTEX_CTXT_CURH UNIT);
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "c%i,%i\n",
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT);
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }
 
 /*  Recording a "?..." line, type, subtype and position  */
-void synctex_node_recorder(halfword p)
+void synctex_record_node_unknown(halfword p)
 {
     int len = 0;
 #   if SYNCTEX_DEBUG > 999
-    printf("\nSynchronize DEBUG: synctex_node_recorder(0x%x)\n", p);
+    printf("\nSynchronize DEBUG: synctex_record_node_unknown(0x%x)\n", p);
 #   endif
-    len = SYNCTEX_fprintf(SYNCTEX_FILE, "?%i,%i:%i,%i\n",
-                          synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
-                          SYNCTEX_TYPE(p), SYNCTEX_SUBTYPE(p));
-    if (len > 0) {
-        synctex_ctxt.total_length += len;
-        ++synctex_ctxt.count;
-        return;
+    if (SYNCTEX_SHOULD_COMPRESS_V) {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "?%i,=:%i,%i\n",
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_TYPE(p), SYNCTEX_SUBTYPE(p));
+    } else {
+        len = SYNCTEX_fprintf(SYNCTEX_FILE, "?%i,%i:%i,%i\n",
+                              SYNCTEX_CTXT_CURH UNIT,
+                              SYNCTEX_CTXT_CURV UNIT,
+                              SYNCTEX_TYPE(p), SYNCTEX_SUBTYPE(p));
+        synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
     }
+    SYNCTEX_RECORD_LEN_AND_RETURN;
     synctexabort(0);
     return;
 }

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex.defines
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex.defines	2017-04-23 10:06:27 UTC (rev 43988)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex.defines	2017-04-23 10:46:51 UTC (rev 43989)
@@ -1,9 +1,10 @@
 {
-Copyright (c) 2008, 2009 jerome DOT laurens AT u-bourgogne DOT fr
+Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
 
 This file is part of the SyncTeX package.
 
-Latest Revision: Wed Jul  1 11:18:05 UTC 2009
+Version 1
+Latest Revision: Sat Apr 22 10:07:05 UTC 2017
 
 License:
 --------
@@ -43,9 +44,6 @@
 If you include or use a significant part of the synctex package into a software,
 I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
 
-Version 1
-Latest Revision: Wed Jul  1 08:17:41 UTC 2009
-
 Notice:
 -------
 This file is an interface to the synctex system for web2c.
@@ -74,5 +72,9 @@
 @define procedure synctexcurrent;
 @define procedure synctexhorizontalruleorglue();
 
+ at define procedure synctexpdfxform();
+ at define procedure synctexmrofxfdp;
+ at define procedure synctexpdfrefxform();
+
 { end of synctex.defines }
 { vim: set syntax=web : }

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex.h
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex.h	2017-04-23 10:06:27 UTC (rev 43988)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex.h	2017-04-23 10:46:51 UTC (rev 43989)
@@ -1,9 +1,12 @@
 /* synctex.h
 
-Copyright (c) 2008, 2009 jerome DOT laurens AT u-bourgogne DOT fr
+Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
 
 This file is part of the SyncTeX package.
 
+Version 1
+Lates Revision: Sat Apr 22 10:07:05 UTC 2017
+
 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation
 files (the "Software"), to deal in the Software without
@@ -35,9 +38,6 @@
 If you include or use a significant part of the synctex package into a software,
 I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
 
-Version 1
-Latest Revision: Wed Jul  1 08:17:50 UTC 2009
-
 */
 
 #  ifndef __SYNCTEX_HEADER__
@@ -53,14 +53,24 @@
 
 /*  Recording the "{..." line.  In *tex.web, use synctex_sheet(pdf_output) at
  *  the very beginning of the ship_out procedure.
-*/
+ */
 extern void synctexsheet(integer mag);
 
 /*  Recording the "}..." line.  In *tex.web, use synctex_teehs at
  *  the very end of the ship_out procedure.
-*/
+ */
 extern void synctexteehs(void);
 
+/*  Recording the "<..." line.  In pdftex.web, use synctex_pdfxform(p) at
+ *  the very beginning of the pdf_ship_out procedure.
+ */
+extern void synctexpdfxform(halfword p);
+
+/*  Recording the ">" line.  In pdftex.web, use synctex_mrofxfdp at
+ *  the very end of the ship_out procedure.
+ */
+extern void synctexmrofxfdp(void);
+
 /*  This message is sent when a vlist will be shipped out, more precisely at
  *  the beginning of the vlist_out procedure in *TeX.web.  It will be balanced
  *  by a synctex_tsilv, sent at the end of the vlist_out procedure.  p is the
@@ -100,6 +110,10 @@
 /*  Send this message whenever a kern node will ship out. */
 extern void synctexkern(halfword p, halfword this_box);
 
+/*  Recording the "f" line.  In pdftex.web, use synctex_pdfrefxform when \pfdrefxform si used.
+ */
+extern void synctexpdfrefxform(int objnum);
+
 /*  this message is sent whenever a char node ships out    */
 extern void synctexchar(halfword p, halfword this_box);
 



More information about the tex-live-commits mailing list