Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
2. 构建方式:`xmake b xxx_test`
3. 运行方式:`xmake r xxx_test`

## 构建命令

主项目构建:`xmake b stem`

## 工作流程

1. 基于主分支创建新分支
Expand Down
8 changes: 0 additions & 8 deletions TeXmacs/packages/standard/std-latex-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@
<with|text-color|<value|color>|<with|color|<arg|border>|<colored-frame|<arg|background>|<with|color|<value|text-color>|<arg|body>>>>>
</macro>>

<active*|<\src-comment>
<LaTeX> preview
</src-comment>>

<assign|latex_preview|<macro|pic|src|<block|<tformat|<cwith|1|1|1|1|cell-background|dark
grey>|<table|<row|<cell|<with|color|white|font-family|ss|<small|<LaTeX>
preview>>>>|<row|<cell|<verbatim|<arg|src>>>>>>>>>

<\active*>
<\src-comment>
Footnotes.
Expand Down
35 changes: 0 additions & 35 deletions TeXmacs/plugins/latex/progs/binary/pdflatex.scm

This file was deleted.

5 changes: 0 additions & 5 deletions TeXmacs/progs/texmacs/texmacs/tm-server.scm
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
((== val "prompt on scripts") (set-script-status 1))
((== val "accept all scripts") (set-script-status 2))))

(define (notify-latex-command var val)
(if (use-plugin-tex?)
(set-latex-command val)))

(define (notify-bibtex-command var val)
(if (use-plugin-bibtex?)
(set-bibtex-command val)))
Expand Down Expand Up @@ -113,7 +109,6 @@
("manual zealous invisible correct" "off" (lambda args (noop)))
("manual homoglyph correct" "on" (lambda args (noop)))
("security" "prompt on scripts" notify-security)
("latex command" "pdflatex" notify-latex-command)
("bibtex command" "bibtex" notify-bibtex-command)
("scripting language" "none" notify-scripting-language)
("speech" "off" noop)
Expand Down
39 changes: 38 additions & 1 deletion devel/0130.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
- `TeXmacs/progs/convert/latex/tmtex-widgets.scm`
- `TeXmacs/plugins/latex/progs/convert/latex/tmtex-widgets.scm`
- `TeXmacs/progs/init-research.scm`
- `src/Plugins/Tex/latex_recover.cpp`
- `src/Plugins/Tex/tex.hpp`
- `src/Scheme/Plugins/glue_tex.lua`
- `src/Plugins/LaTeX_Preview/latex_preview.cpp`
- `src/Plugins/LaTeX_Preview/latex_preview.hpp`
- `src/Plugins/Tex/fromtex.cpp`
- `src/Plugins/Tex/fromtex_post.cpp`
- `src/Scheme/Plugins/init_glue_plugins.cpp`
- `src/Data/Convert/Verbatim/verbatim.cpp`
- `src/System/config.h.xmake`
- `xmake.lua`

## 3 如何测试

Expand Down Expand Up @@ -52,8 +63,34 @@ Mogan STEM 的目标用户大多不安装本地 TeX Live,而是使用 Overleaf

因此,这三个菜单项均应移除。

### 7.2 修改步骤
此外,scheme 入口移除后,对应的 C++ glue 实现也应一并清理,避免留下无调用者的死代码。

### 7.2 修改步骤(Scheme 层)

1. **移除菜单入口**:在 `TeXmacs/progs/texmacs/menus/tools-menu.scm` 中,移除条件显示的 `LaTeX` 子菜单(`(-> "LaTeX" (link tmtex-menu))`)。
2. **移除函数和菜单绑定**:在 `TeXmacs/progs/convert/latex/tmtex-widgets.scm` 和 `TeXmacs/plugins/latex/progs/convert/latex/tmtex-widgets.scm` 中,移除 `latex-export`、`latex-run`、`latex-preview` 三个函数,以及 `tmtex-menu` 的 `menu-bind`。
3. **移除懒加载引用**:在 `TeXmacs/progs/init-research.scm` 中,移除 `tmtex-menu` 的 `lazy-menu` 引用。

### 7.3 修改步骤(C++ 层)

#### 7.3.1 移除 `try_latex_export` 及辅助函数

`latex-run` 被移除后,`try-latex-export` 在 scheme 中不再有调用者。其 C++ 实现 `try_latex_export` 及所有辅助函数(`number_latex_errors`、`get_latex_errors`、`latex_error_*`、`texmacs_error_find`、`get_line_number`、`get_column_number`)均变为死代码。

- **移除实现**:在 `src/Plugins/Tex/latex_recover.cpp` 中移除上述所有函数。
- **移除声明**:在 `src/Plugins/Tex/tex.hpp` 中移除对应的函数声明。
- **移除 glue**:在 `src/Scheme/Plugins/glue_tex.lua` 中移除 `try-latex-export`、`number-latex-errors`、`get-line-number`、`get-column-number` 的 glue 定义。`build/glue/glue_tex.cpp` 为自动生成文件,在重新构建时会同步更新。

#### 7.3.2 移除 `LaTeX_Preview` 插件

`latex-preview` 的设计意图是调用外部 `pdflatex` 生成 PDF。Mogan STEM 不依赖本地 LaTeX 命令行,因此 `LaTeX_Preview` 插件(在导入 LaTeX 时用于将公式渲染为图片,同样依赖 `pdflatex` 和 `gs`)也应一并移除。

- **删除插件源码**:删除 `src/Plugins/LaTeX_Preview/latex_preview.cpp` 和 `latex_preview.hpp`。
- **修改构建系统**:
- 在 `xmake.lua` 中移除 `src/Plugins/LaTeX_Preview/**.cpp` 的编译规则。
- 在 `src/System/config.h.xmake` 中移除 `USE_PLUGIN_LATEX_PREVIEW` 宏定义。
- **移除引用**:
- 在 `src/Scheme/Plugins/init_glue_plugins.cpp` 中移除 `#include "LaTeX_Preview/latex_preview.hpp"`。
- 在 `src/Data/Convert/Verbatim/verbatim.cpp` 中移除 `latex_preview` 的类型检查。
- 在 `src/Plugins/Tex/fromtex.cpp` 中移除 `#include "LaTeX_Preview/latex_preview.hpp"`,并移除 `find_latex_previews`、`substitute_latex_previews`、`merge_environment_previews`、`count_unbalanced_preview` 等内部辅助函数。将 `latex_fallback_on_pictures` 改为空实现(直接 `return t;`)。
- 在 `src/Plugins/Tex/fromtex_post.cpp` 中移除 `#include "LaTeX_Preview/latex_preview.hpp"` 和 `latex_fallback_on_pictures` 的前置声明。
3 changes: 1 addition & 2 deletions src/Data/Convert/Verbatim/verbatim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,5 @@ is_verbatim (tree t) {
is_compound (t, "scm-code") || is_compound (t, "shell-code") ||
is_compound (t, "code") || is_compound (t, "verbatim") ||
is_compound (t, "scilab-code") || is_compound (t, "scala-code") ||
is_compound (t, "java-code") || is_compound (t, "latex_preview") ||
is_compound (t, "picture-mixed");
is_compound (t, "java-code") || is_compound (t, "picture-mixed");
}
Loading
Loading