Orgmode无法生成LaTeX公式预览图片

Orgmode⽆法⽣成LaTeX公式预览图⽚
最近需要在Cygwin平台下的Emacs Org mode中⽣成LaTeX数学公式的预览图⽚,从⽽得到图⽂并貌的笔记与任务管理⽂档。但当我执⾏org-toggle-latex-fragment命令后却出现了如下错误:
org-compile-file: File "/tmp/orgtex5473MjV.dvi" wasn’t produced. Please adjust ’dvipng’ part of ‘org-preview-latex-process-alist’.
根据提⽰判断,应该是变量org-preview-latex-process-alist中dvipng部分的配置出了问题。于是按C-h v查看该变量的值,并参照man⼿册核对了dvipng的命令⾏参数,并未发现什么明显的异常。之后,看到有⼈说是未安装texlive-latex-extra包的问题。然后,便转到/tmp⽬录下查看LaTeX编译⽇志⽂件orgtex5473MjV.log⾥是否有不到相关宏包的提⽰。可奇怪的是,该⽂件根本不见踪影。这就说明很可能连latex命令的启动都未成功,以⾄于根本没有进⼊到实质的编译阶段。接下来,我便⼿动创建了⼀个简单的tex⽂件⽤latex编译,结果直接报出下⾯的错误:
Running `LaTeX' on `test' with ``pdflatex  -file-line-error  -interaction=nonstopmode "\input" ''
C:/cygwin64/: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
TeX Output exited abnormally with code 127 at Wed Apr  2 20:58:49
错误信息中的error while loading shared libraries给出了明显的提⽰,那就是缺少了某些动态链接库。然后通过上⽹搜索,得知可以使
⽤cygcheck命令检查可执⾏⽂件对于动态链接库的依赖关系。将其⽤于则得到如下信息:
$
Found: C:\cygwin64\
Found: D:\texlive\2016\bin\
Found: C:\cygwin64\
C:\cygwin64\
C:\cygwin64\bin\cygkpathsea-6.dll
C:\cygwin64\bin\cygwin1.dll
C:\Windows\system32\KERNEL32.dll
C:\Windows\system32\API-MS-Win-Core-RtlSupport-L1-1-0.dll
C:\Windows\system32\ntdll.dll
C:\Windows\system32\KERNELBASE.dll
C:\Windows\system32\API-MS-Win-Core-ProcessThreads-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Heap-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Memory-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Handle-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Synch-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-File-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-IO-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-ThreadPool-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-LibraryLoader-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-NamedPipe-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Misc-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-SysInfo-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Localization-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-ProcessEnvironment-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-String-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Debug-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-ErrorHandling-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Fibers-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Util-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Core-Profile-L1-1-0.dll
C:\Windows\system32\API-MS-Win-Security-Base-L1-1-0.dll
C:\cygwin64\bin\cygpng16-16.dll
C:\cygwin64\bin\cygz.dll
C:\cygwin64\bin\cygpoppler-49.dll
C:\cygwin64\bin\cygcurl-4.dll
C:\cygwin64\bin\cyggssapi_krb5-2.dll
C:\cygwin64\bin\cygk5crypto-3.dll
C:\cygwin64\bin\cygkrb5support-0.dll
C:\cygwin64\bin\cygintl-8.dll
C:\cygwin64\bin\cygiconv-2.dll
C:\cygwin64\bin\cygiconv-2.dll
C:\cygwin64\bin\cygkrb5-3.dll
C:\cygwin64\bin\cygcom_err-2.dll
C:\cygwin64\bin\cyggcc_s-seh-1.dll
C:\cygwin64\bin\cygidn2-0.dll
C:\cygwin64\bin\cygunistring-2.dll
C:\cygwin64\bin\cyglber-2-4-2.dll
C:\cygwin64\bin\cygldap-2-4-2.dll
C:\cygwin64\bin\cygsasl2-3.dll
C:\cygwin64\bin\cygnghttp2-14.dll
C:\cygwin64\bin\cygpsl-5.dll
C:\cygwin64\bin\cygssh2-1.dll
C:\cygwin64\bin\cygfontconfig-1.dll
C:\cygwin64\bin\cygexpat-1.dll
C:\cygwin64\bin\cygfreetype-6.dll
C:\cygwin64\bin\cygbz2-1.dll
C:\cygwin64\bin\cygjpeg-8.dll
C:\cygwin64\bin\cyglcms2-2.dll
C:\cygwin64\bin\cygtiff-6.dll
C:\cygwin64\bin\cygjbig-2.dll
C:\cygwin64\bin\cyglzma-5.dll
C:\cygwin64\bin\cygstdc++-6.dll
cygcheck: track_down: could not find cygcrypto-1.0.0.dll
cygcheck: track_down: could not find cygcrypto-1.0.0.dll
cygcheck: track_down: could not find cygssl-1.0.0.dll
cygcheck: track_down: could not find cygcrypto-1.0.0.dll
cygcheck: track_down: could not find cygssl-1.0.0.dll
可以看出,当前的Cygwin系统缺少了cygcrypto-1.0.0.dll与cygssl-1.0.0.dll两个⽂件,⽽且在⽬录/bin下也确实没有这两个⽂件:
$ ls /bin | grep "\(cygcrypto\)\|\(cygssl\)"
cygcrypto-1.1.dll*
cygssl-1.1.dll*
cygssl3.dll*
⾄此,Emacs Org mode⽆法⽣成LaTeX公式预览图⽚的原因真相⼤⽩:并⾮Org mode或dvipng本⾝的问题,⽽是由于Cygwin缺少动态链接库导致的。要想解决这个问题,就需要到它们。我们使⽤cygcheck的-p选项,可以查询与动态链接库相关的软件包:
$ cygcheck --help
-p, --package-query  search for REGEXP in the entire cygwin package
repository (requires internet connectivity)
$ cygcheck -p cygssl-1.0.0.dll
Found 6 matches for cygssl-1.0.0
libopenssl100-1.0.2p-1 - libopenssl100: A general purpose cryptography toolkit with TLS implementation (runtime)
libopenssl100-1.0.2r-1 - libopenssl100: A general purpose cryptography toolkit with TLS implementation (runtime)
libssl1.0-1.0.2r-2 - libssl1.0: A general purpose cryptography toolkit with TLS implementation (runtime)
msinfoopenssl-debuginfo-1.0.2p-1 - openssl-debuginfo: Debug info for openssl
openssl-debuginfo-1.0.2r-1 - openssl-debuginfo: Debug info for openssl
openssl10-debuginfo-1.0.2r-2 - openssl10-debuginfo: Debug info for openssl10
$ cygcheck -p cygcrypto-1.0.0.dll
libopenssl100-1.0.2p-1 - libopenssl100: A general purpose cryptography toolkit with TLS implementation (runtime)
libopenssl100-1.0.2r-1 - libopenssl100: A general purpose cryptography toolkit with TLS implementation (runtime)
libssl1.0-1.0.2r-2 - libssl1.0: A general purpose cryptography toolkit with TLS implementation (runtime)
openssl-debuginfo-1.0.2p-1 - openssl-debuginfo: Debug info for openssl
openssl-debuginfo-1.0.2r-1 - openssl-debuginfo: Debug info for openssl
openssl10-debuginfo-1.0.2r-2 - openssl10-debuginfo: Debug info for openssl10
可以看出,这两个库均与openssl软件包有关。幸好,我之前从镜象服务器下载的缓存⽂件⾥有libopenssl100-1.0.,其中正好包含了上述两个动态链接库。将它们拷贝到C:\cygwin64\bin下,⼀切就恢复正常了。
从以上问题解决的过程中我学到了如下两条经验:
1. 软件给出的错误信息并不⼀定反映问题的真相,⽽有可能是由另⼀个潜在的或者更深层次的问题导致的。这个时候不能拘泥于表象,
要设计新的测试环境来予以探索、验证。
2. 当遇到了异常与错误,需要使⽤合适的⼯具来搜集线索、定位问题的源头以⾄最终将其解决。

本文发布于:2024-09-23 21:25:56,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/3/380581.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:问题   命令   预览   编译   相关   错误   需要
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议