syncTeX 文件是什么时候写入的?在写入之后,有没有办法将回调传入 lua?我希望在编译过程结束时读取它,而不必编译两次才能获取它。
我可以运行外部脚本或包装编译过程来完成此任务,但这比必要的工作要多得多。
finish_pdffile 发生在 synctex 写入之前,因此它不好 ;/
这是所有回调的列表,我相信,我没有看到任何有帮助的东西。
local callbacktypes = callbacktypes or {
find_read_file = exclusive,
find_write_file = exclusive,
find_font_file = data,
find_output_file = data,
find_format_file = data,
find_vf_file = data,
find_map_file = data,
find_enc_file = data,
find_sfd_file = data,
find_pk_file = data,
find_data_file = data,
find_opentype_file = data,
find_truetype_file = data,
find_type1_file = data,
find_image_file = data,
open_read_file = exclusive,
read_font_file = exclusive,
read_vf_file = exclusive,
read_map_file = exclusive,
read_enc_file = exclusive,
read_sfd_file = exclusive,
read_pk_file = exclusive,
read_data_file = exclusive,
read_truetype_file = exclusive,
read_type1_file = exclusive,
read_opentype_file = exclusive,
find_cidmap_file = data,
read_cidmap_file = exclusive,
process_input_buffer = data,
process_output_buffer = data,
process_jobname = data,
contribute_filter = simple,
buildpage_filter = simple,
pre_linebreak_filter = list,
linebreak_filter = list,
append_to_vlist_filter = list,
post_linebreak_filter = list,
hpack_filter = list,
vpack_filter = list,
hpack_quality = list,
vpack_quality = list,
pre_output_filter = list,
process_rule = list,
hyphenate = simple,
ligaturing = simple,
kerning = simple,
insert_local_par = simple,
mlist_to_hlist = list,
pre_dump = simple,
start_run = simple,
stop_run = simple,
start_page_number = simple,
stop_page_number = simple,
show_error_hook = simple,
show_warning_message = simple,
show_error_message = simple,
show_lua_error_hook = simple,
start_file = simple,
stop_file = simple,
finish_pdffile = data,
finish_pdfpage = data,
define_font = exclusive,
}
我也不确定纯 lua 方式或是否在所有 lua 代码完成后写入 synctex 文件。
答案1
从源代码来看,synctex 文件在所有回调之后被关闭。
/* Close {\sl Sync\TeX} file and write status */
synctexterminate(log_opened_global); /* Let the {\sl Sync\TeX} controller close its files. */
free_text_codes();
free_math_codes();
if (log_opened_global) {
wlog_cr();
selector = selector - 2;
if ((selector == term_only) && (callback_id == 0)) {
tprint_nl("Transcript written on ");
tprint_file_name(NULL, texmf_log_name, NULL);
print_char('.');
print_ln();
}
lua_a_close_out(log_file);
}
}
这是结束close_files_and_terminate
,之后唯一调用的是do_final_end();
设置错误状态并停止。
因此我认为 synctex 数据在当前运行期间无法可靠地获得。