| 1 |
Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr |
| 2 |
|
| 3 |
This file is part of the SyncTeX package. |
| 4 |
|
| 5 |
Version 1 |
| 6 |
Latest Revision: Sat Apr 22 10:07:05 UTC 2017 |
| 7 |
|
| 8 |
License: |
| 9 |
-------- |
| 10 |
Permission is hereby granted, free of charge, to any person |
| 11 |
obtaining a copy of this software and associated documentation |
| 12 |
files (the "Software"), to deal in the Software without |
| 13 |
restriction, including without limitation the rights to use, |
| 14 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 15 |
copies of the Software, and to permit persons to whom the |
| 16 |
Software is furnished to do so, subject to the following |
| 17 |
conditions: |
| 18 |
|
| 19 |
The above copyright notice and this permission notice shall be |
| 20 |
included in all copies or substantial portions of the Software. |
| 21 |
|
| 22 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 23 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 24 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 25 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 26 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 27 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 28 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 29 |
OTHER DEALINGS IN THE SOFTWARE |
| 30 |
|
| 31 |
Except as contained in this notice, the name of the copyright holder |
| 32 |
shall not be used in advertising or otherwise to promote the sale, |
| 33 |
use or other dealings in this Software without prior written |
| 34 |
authorization from the copyright holder. |
| 35 |
|
| 36 |
Acknowledgments: |
| 37 |
---------------- |
| 38 |
The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh, |
| 39 |
and significant help from XeTeX developer Jonathan Kew |
| 40 |
|
| 41 |
Nota Bene: |
| 42 |
---------- |
| 43 |
If you include or use a significant part of the synctex package into a software, |
| 44 |
I would appreciate to be listed as contributor and see "SyncTeX" highlighted. |
| 45 |
|
| 46 |
History: |
| 47 |
-------- |
| 48 |
|
| 49 |
- the synctex hooks are changed to encapsulate Ship box |p| out |
| 50 |
- if the pdf file is removed, the synctex file is removed too. |
| 51 |
|
| 52 |
@x pdftex.web l.14550 |
| 53 |
@ @<Output the non-|char_node| |p| for |hlist_out|...@>= |
| 54 |
@y |
| 55 |
@ @<Output the non-|char_node| |p| for |hlist_out|...@>= |
| 56 |
@z |
| 57 |
@x |
| 58 |
margin_kern_node, |
| 59 |
kern_node: begin |
| 60 |
@y |
| 61 |
margin_kern_node:cur_h:=cur_h+width(p); {separate the |margin_kern_node| case in |hlist_out|} |
| 62 |
kern_node: begin |
| 63 |
@z |
| 64 |
|
| 65 |
@x pdftex.web l.18491 |
| 66 |
procedure pdf_hlist_out; {output an |hlist_node| box} |
| 67 |
@y |
| 68 |
procedure pdf_hlist_out; {output an |hlist_node| box} |
| 69 |
@z |
| 70 |
|
| 71 |
@x pdftex.web l.18519 |
| 72 |
while p<>null do |
| 73 |
@<Output node |p| for |pdf_hlist_out| and move to the next node, |
| 74 |
maintaining the condition |cur_v=base_line|@>; |
| 75 |
@y |
| 76 |
@<Start hlist {\sl Sync\TeX} information record@>; |
| 77 |
while p<>null do |
| 78 |
@<Output node |p| for |pdf_hlist_out| and move to the next node, |
| 79 |
maintaining the condition |cur_v=base_line|@>; |
| 80 |
@<Finish hlist {\sl Sync\TeX} information record@>; |
| 81 |
@z |
| 82 |
|
| 83 |
@x pdftex.web l.18533 |
| 84 |
@ @<Output node |p| for |pdf_hlist_out|...@>= |
| 85 |
@y |
| 86 |
@ @<Output node |p| for |pdf_hlist_out|...@>= |
| 87 |
@z |
| 88 |
|
| 89 |
@x pdftex.web l.18544 |
| 90 |
until not is_char_node(p); |
| 91 |
@y |
| 92 |
until not is_char_node(p); |
| 93 |
@<Record current point {\sl Sync\TeX} information@>; |
| 94 |
@z |
| 95 |
|
| 96 |
@x |
| 97 |
@ @<Output the non-|char_node| |p| for |pdf_hlist_out|...@>= |
| 98 |
@y |
| 99 |
@ @<Output the non-|char_node| |p| for |pdf_hlist_out|...@>= |
| 100 |
@z |
| 101 |
|
| 102 |
@x pdftex.web l.18557 |
| 103 |
margin_kern_node, |
| 104 |
kern_node:cur_h:=cur_h+width(p); |
| 105 |
@y |
| 106 |
margin_kern_node:cur_h:=cur_h+width(p); |
| 107 |
kern_node: begin |
| 108 |
@<Record |kern_node| {\sl Sync\TeX} information@>; |
| 109 |
cur_h:=cur_h+width(p); |
| 110 |
end; |
| 111 |
@z |
| 112 |
|
| 113 |
@x |
| 114 |
math_node: @<Handle a math node in |hlist_out|@>; |
| 115 |
@y |
| 116 |
math_node: begin |
| 117 |
@<Record |math_node| {\sl Sync\TeX} information@>; |
| 118 |
@<Handle a math node in |hlist_out|@>; |
| 119 |
end; |
| 120 |
@z |
| 121 |
|
| 122 |
@x pdftex.web l.18566 |
| 123 |
move_past: cur_h:=cur_h+rule_wd; |
| 124 |
@y |
| 125 |
move_past: begin |
| 126 |
cur_h:=cur_h+rule_wd; |
| 127 |
@<Record horizontal |rule_node| or |glue_node| {\sl Sync\TeX} information@>; |
| 128 |
end; |
| 129 |
@z |
| 130 |
|
| 131 |
@x |
| 132 |
@ @<(\pdfTeX) Output a box in an hlist@>= |
| 133 |
@y |
| 134 |
@ @<(\pdfTeX) Output a box in an hlist@>= |
| 135 |
@z |
| 136 |
|
| 137 |
@x |
| 138 |
if list_ptr(p)=null then cur_h:=cur_h+width(p) |
| 139 |
@y |
| 140 |
if list_ptr(p)=null then |
| 141 |
begin |
| 142 |
@<Record void list {\sl Sync\TeX} information@>; |
| 143 |
cur_h:=cur_h+width(p); |
| 144 |
end |
| 145 |
@z |
| 146 |
|
| 147 |
@x |
| 148 |
@p procedure pdf_vlist_out; {output a |pdf_vlist_node| box} |
| 149 |
@y |
| 150 |
@p procedure pdf_vlist_out; {output a |pdf_vlist_node| box} |
| 151 |
@z |
| 152 |
|
| 153 |
@x pdftex.web l.18670 |
| 154 |
left_edge:=cur_h; cur_v:=cur_v-height(this_box); top_edge:=cur_v; |
| 155 |
@y |
| 156 |
left_edge:=cur_h; |
| 157 |
@<Start vlist {\sl Sync\TeX} information record@>; |
| 158 |
cur_v:=cur_v-height(this_box); top_edge:=cur_v; |
| 159 |
@z |
| 160 |
|
| 161 |
@x pdftex.web l.18673 |
| 162 |
while p<>null do |
| 163 |
@<Output node |p| for |pdf_vlist_out| and move to the next node, |
| 164 |
maintaining the condition |cur_h=left_edge|@>; |
| 165 |
@y |
| 166 |
while p<>null do |
| 167 |
@<Output node |p| for |pdf_vlist_out| and move to the next node, |
| 168 |
maintaining the condition |cur_h=left_edge|@>; |
| 169 |
@<Finish vlist {\sl Sync\TeX} information record@>; |
| 170 |
@z |
| 171 |
|
| 172 |
@x pdftex.web l.18706 |
| 173 |
@ @<(\pdfTeX) Output a box in a vlist@>= |
| 174 |
if list_ptr(p)=null then cur_v:=cur_v+height(p)+depth(p) |
| 175 |
@y |
| 176 |
@ @<(\pdfTeX) Output a box in a vlist@>= |
| 177 |
if list_ptr(p)=null then begin |
| 178 |
cur_v:=cur_v+height(p); |
| 179 |
@<Record void list {\sl Sync\TeX} information@>; |
| 180 |
cur_v:=cur_v+depth(p); |
| 181 |
end |
| 182 |
@z |
| 183 |
|
| 184 |
@x pdftex.web l.18879 |
| 185 |
@<(\pdfTeX) Ship box |p| out@>; |
| 186 |
@y |
| 187 |
pdf_output_value:=pdf_output; {{\sl Sync\TeX}: we assume that |pdf_output| is properly set up} |
| 188 |
if shipping_page then synctex_sheet(mag) @+else synctex_pdfxform(p); |
| 189 |
@<(\pdfTeX) Ship box |p| out@>; |
| 190 |
if shipping_page then synctex_teehs @+else synctex_mrofxfdp; |
| 191 |
@z |
| 192 |
|
| 193 |
@x |
| 194 |
procedure close_files_and_terminate; |
| 195 |
@y |
| 196 |
procedure close_files_and_terminate; |
| 197 |
@z |
| 198 |
|
| 199 |
@x pdftex.web l.33072 |
| 200 |
remove_pdffile; |
| 201 |
@y |
| 202 |
remove_pdffile; |
| 203 |
synctex_abort(log_opened); |
| 204 |
@z |
| 205 |
|
| 206 |
@x pdftex.web l.36224 |
| 207 |
procedure out_form(p: pointer); |
| 208 |
begin |
| 209 |
@y |
| 210 |
procedure out_form(p: pointer); |
| 211 |
begin |
| 212 |
synctexpdfrefxform(pdf_xform_objnum(p)); |
| 213 |
@z |