gpt4 book ai didi

emacs - 通过emacs加载绘图程序

转载 作者:行者123 更新时间:2023-12-01 07:31:42 24 4
gpt4 key购买 nike

我正在寻找一种将绘图程序与 emacs 集成的方法。我经常使用 emacs 在 LaTeX 中编写讲义。问题是,当演示者绘制图表时,我开始争先恐后地绘制图表、保存它,并在合理的时间内将位置输入到我的 TeX 文件中。

是否可以将 emacs 设置为当我按下组合键时将加载绘图程序(例如 pinta)并且一旦我绘制了图表,该文件将自动保存在 emacs 文件的文件夹中并命名为该文件将通过

插入到 emacs 中
\includegraphics{File_Name}

如果这个功能太难实现,请告诉我(我也很乐意尝试这个想法的变体)。

针对评论进行编辑:我的操作系统是 Ubuntu 14.04,我的绘图程序的绝对路径是/usr/bin/pinta

最佳答案

初稿 -- 未完全测试 -- 原型(prototype)(2014 年 6 月 22 日):以下是概念功能想法的初稿/未完全测试的原型(prototype),在下面的评论中概述楼主提问。因为@lawlist 没有安装 Ubantu 操作系统或安装 pinta,所以该函数的最后一部分未经测试——即 (start-process "open-in-pinta"nil "/usr/bin/品塔“我的新文件名)。如果 start-process 语句在 Ubantu 上工作需要额外的命令行参数,请告诉我。变量 form-graphic-file 需要有一个已经存在的空白文件的绝对路径,该空白文件是用 pinta 程序创建的——该文件应该保存在用户选择的某个地方的表单目录中。函数 copy-graphic 是函数 dired-do-create-files 的修改。

待办事项:

  • 验证 start-process 语句的功能。

  • 将变量 form-file-graphiclist 转换为 string 格式并修改 copy-graphic 相应地运行。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; \includegraphics{File_Name}

(defvar form-file-graphic "~/forms/my-empty-image.ora"
"Absolute path to existing blank graphic file previously created with `pinta'.")

(defun copy-graphic (target)
"This function is a modification of `dired-do-create-files'."
(interactive
(list (expand-file-name (read-file-name "Copy to: " nil "diagram.ora"))))
(copy-file form-file-graphic target)
(insert "\\includegraphics{" (file-relative-name target) "}\n")
(start-process "open-in-pinta" nil "/usr/bin/pinta" target))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

关于emacs - 通过emacs加载绘图程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24352464/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com