Org mode无法生成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" test.tex''
C:/cygwin64/bin/pdftex.exe: 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
命令检查可执行文件对于动态链接库的依赖关系。将其用于latex.exe
则得到如下信息:
$ cygcheck latex.exe
Found: C:\cygwin64\bin\latex.exe
Found: D:\texlive\2016\bin\win32\latex.exe
Found: C:\cygwin64\bin\latex.exe
C:\cygwin64\bin\latex.exe
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\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.com 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)
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
$ 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.2r-1.tar.xz,其中正好包含了上述两个动态链接库。将它们拷贝到C:\cygwin64\bin
下,一切就恢复正常了。
从以上问题解决的过程中我学到了如下两条经验:
软件给出的错误信息并不一定反映问题的真相,而有可能是由另一个潜在的或者更深层次的问题导致的。这个时候不能拘泥于表象,要设计新的测试环境来予以探索、验证。
当遇到了异常与错误,需要使用合适的工具来搜集线索、定位问题的源头以至最终将其解决。
Org mode无法生成LaTeX公式预览图片的更多相关文章
- html生成缩略图来预览解决方案
html生成缩略图来预览解决方案 一.总结 一句话总结:先将html转化为canvas,然后将canvas生成图片ajax上传到服务器,就可以了 html 转化 canvas 图片 上传 html2c ...
- JS实现图片base64转blob对象,压缩图片,预览图片,图片旋转到正确角度
base64转blob对象 /** 将base64转换为文件对象 * @param {String} base64 base64字符串 * */ var convertBase64ToBlob = f ...
- file上传图片,base64转换、压缩图片、预览图片、将图片旋转到正确的角度
/** * 将base64转换为文件对象 * (即用文件上传输入框上传文件得到的对象) * @param {String} base64 base64字符串 */ function convertBa ...
- 微信开发中使用微信JSSDK和使用URL.createObjectURL上传预览图片的不同处理对比
在做微信公众号或者企业微信开发业务应用的时候,我们常常会涉及到图片预览.上传等的处理,往往业务需求不止一张图片,因此相对来说,需要考虑的全面一些,用户还需要对图片进行预览和相应的处理,在开始的时候我使 ...
- 富文本编辑器handyeditor,上传和预览图片的host地址不一样
使用富文本编辑器(官网)时,大多时候都会用到图片上传,但是下载的富文本编辑器的默认配置是只有一个上传地址的host的. var he = HE.getEditor('editor', { autoHe ...
- hTML5实现表单内的上传文件框,上传前预览图片,针刷新预览images
hTML5实现表单内的上传文件框,上传前预览图片,针刷新预览images, 本例子主要是使用HTML5 的File API,建立一個可存取到该file的url, 一个空的img标签,ID为img0,把 ...
- [js/jquery]移动端手势拖动,放大,缩小预览图片
摘要 有这样的需求需要在手机端预览图片的时候,实现图片的手势拖动,放大缩小功能.最终通过touch.js这个插件实现了效果. touch.js Touch.js是移动设备上的手势识别与事件库, 由百度 ...
- ftp如何预览图片 解决方案
下载使用 server-U ,开启 HTTP 服务,输入 http://ip:端口 后,登录ftp账号密码,可选使用 基于java的应用 web client 或 FTP Voyager JV,来预览 ...
- 本地预览图片html和js例子
本地预览图片html和js例子,直接上代码吧. <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" ...
随机推荐
- css 图像热区
CSS图像热区 在img标签当中,存在一个属性usemap属性,用来和map标签进行绑定,从而实现图像热区.所谓的图像热区,其实指的是在图像中插入一个连接,当用户点击图像的指定区域后就会进行页面跳转. ...
- [JSOI2009]密码 [AC自动机]
题面 bzoj luogu 首先看到这题就知道随便暴枚 只要是多项式算法都能过 先常规建AC自动机 注意被别的单词包含的单词没有存在的价值 剩余单词状压 大力dp f[长度][节点编号][状态] \( ...
- linux的/etc/profile、~/.profile、~/.bashrc、~./bash_profile这几个配置文件
在添加环境变量的时候,我们会去修改配置文件 如果留意过,网上博文,有些在/etc/profile文件中配置的,有些是在~./bash_profile文件中配置的,等等 那么,/etc/profile. ...
- antd Tree组件中,自定义右键菜单
最近项目中,有一个需求是自定义antd的Tree组件的右键菜单功能. 直接上代码 class Demo extends Component { state = { rightClickNodeTree ...
- cookie-闲聊
最近练习时对cookie接触较多,所以就着cookie的Domain与path属性闲聊几句. 首先,对于cookie要明确,cookie可以由自身属性确定哪些站点可以看到相应的cookie.毕竟一个浏 ...
- 适用于单片机的数据加密算法:xxtea
转:https://www.cnblogs.com/LittleTiger/p/4384741.html 各位大侠在做数据传输时,有没有考虑过把数据加密起来进行传输,若在串口或者无线中把所要传的数据加 ...
- Object Detection / Human Action Recognition 项目
https://towardsdatascience.com/real-time-and-video-processing-object-detection-using-tensorflow-open ...
- js数字串传参时变科学计数法
例1:onclick=channel_info_listFt(\"'+val.gid+'\",'+val.deviceIdOwner+','+val.gname+') 当长度过长的 ...
- Linux设置允许指定端口通过防火墙centos7
开启防火墙 1.systemctl start firewalld.service(开启防火墙) 2.systemctl stop firewalld.service(开启防火墙) 3.service ...
- Linux 下的各种环境安装
Linux 下的各种环境安装 1.安装 python Centos7 安装 python 2.7 : https://www.cnblogs.com/Jomini/p/10507077.html ...