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: 2 additions & 2 deletions TeXmacs/packages/section/section-article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
</src-comment>
</active*>

<assign|paragraph-title|<macro|name|<style-with|src-compact|none|<paragraph-title-render|<vspace*|0.5fn><arg|name>>>>>
<assign|paragraph-title|<macro|name|<style-with|src-compact|none|<sectional-short-bold|<vspace*|0.5fn><arg|name>>>>>

<assign|subparagraph-title|<macro|name|<style-with|src-compact|none|<subparagraph-title-render|<vspace*|0.25fn><arg|name>>>>>
<assign|subparagraph-title|<macro|name|<style-with|src-compact|none|<sectional-short-bold|<vspace*|0.25fn><arg|name>>>>>

\;
</body>
Expand Down
20 changes: 5 additions & 15 deletions TeXmacs/packages/section/section-base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<TeXmacs|1.99.19>
<TeXmacs|2.1.4>

<style|source>

Expand Down Expand Up @@ -42,10 +42,6 @@

<assign|subsubsection-title-style|left>

<assign|paragraph-title-style|left>

<assign|subparagraph-title-style|left>

<assign|chapter-number-style|arabic>

<assign|section-number-style|arabic>
Expand Down Expand Up @@ -74,10 +70,6 @@

<drd-props|subsubsection-title-style|macro-parameter|string>

<drd-props|paragraph-title-style|macro-parameter|string>

<drd-props|subparagraph-title-style|macro-parameter|string>

<\active*>
<\src-comment>
Names of special sections.
Expand All @@ -104,7 +96,8 @@

<assign|list-of-tables-text|<macro|<localize|List of tables>>>

<assign|list-of-abbreviations-text|<macro|<localize|List of abbreviations>>>
<assign|list-of-abbreviations-text|<macro|<localize|List of
abbreviations>>>

<\active*>
<\src-comment>
Expand Down Expand Up @@ -143,10 +136,6 @@

<assign|subsubsection-title-render|<macro|name|<sectional-select-bold|<value|subsubsection-title-style>|<arg|name>>>>

<assign|paragraph-title-render|<macro|name|<sectional-select-bold|<value|paragraph-title-style>|<arg|name>>>>

<assign|subparagraph-title-render|<macro|name|<sectional-select-bold|<value|subparagraph-title-style>|<arg|name>>>>

<assign|sectional-prefixed|<macro|prefix|name|<prefixed-line|<arg|prefix>|<arg|name>>>>

<assign|tmhtml-sectional-prefixed|<macro|prefix|name|<arg|prefix><arg|name>>>
Expand Down Expand Up @@ -295,7 +284,8 @@

<assign|part-toc|<macro|name|<toc-main-1|<toc-title|part|<arg|name>>>>>

<assign|chapter-toc|<macro|name|<style-with|src-compact|none|<if|<sectional-short-style>|<toc-main-1|<toc-title|chapter|<arg|name>>>|<toc-main-2|<if|<chapter-numbered>|<chapter-text> <the-chapter><chapter-sep><arg|name>|<arg|name>>>>>>>
<assign|chapter-toc|<macro|name|<style-with|src-compact|none|<if|<sectional-short-style>|<toc-main-1|<toc-title|chapter|<arg|name>>>|<toc-main-2|<if|<chapter-numbered>|<chapter-text>
<the-chapter><chapter-sep><arg|name>|<arg|name>>>>>>>

<assign|section-toc|<macro|name|<style-with|src-compact|none|<if|<sectional-short-style>|<toc-main-2|<toc-title|section|<arg|name>>>|<if|<value|in-appendix>||<toc-normal-2|<toc-title|section|<arg|name>>>>>>>>

Expand Down
4 changes: 2 additions & 2 deletions TeXmacs/packages/section/section-book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
</src-comment>
</active*>

<assign|paragraph-title|<macro|name|<style-with|src-compact|none|<paragraph-title-render|<vspace*|0.5fn><arg|name>>>>>
<assign|paragraph-title|<macro|name|<style-with|src-compact|none|<sectional-short-bold|<vspace*|0.5fn><arg|name>>>>>

<assign|subparagraph-title|<macro|name|<style-with|src-compact|none|<subparagraph-title-render|<vspace*|0.25fn><arg|name>>>>>
<assign|subparagraph-title|<macro|name|<style-with|src-compact|none|<sectional-short-bold|<vspace*|0.25fn><arg|name>>>>>

\;
</body>
Expand Down
4 changes: 2 additions & 2 deletions TeXmacs/packages/section/section-generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
</src-comment>
</active*>

<assign|paragraph-title|<macro|name|<style-with|src-compact|none|<paragraph-title-render|<vspace*|0.5fn><arg|name>>>>>
<assign|paragraph-title|<macro|name|<style-with|src-compact|none|<sectional-short-bold|<vspace*|0.5fn><arg|name>>>>>

<assign|subparagraph-title|<macro|name|<style-with|src-compact|none|<subparagraph-title-render|<vspace*|0.25fn><arg|name>>>>>
<assign|subparagraph-title|<macro|name|<style-with|src-compact|none|<sectional-short-bold|<vspace*|0.25fn><arg|name>>>>>

\;
</body>
Expand Down
2 changes: 0 additions & 2 deletions TeXmacs/progs/text/text-menu.scm
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,6 @@
((in? l '(section section*)) "section-title-style")
((in? l '(subsection subsection*)) "subsection-title-style")
((in? l '(subsubsection subsubsection*)) "subsubsection-title-style")
((in? l '(paragraph paragraph*)) "paragraph-title-style")
((in? l '(subparagraph subparagraph*)) "subparagraph-title-style")
(else #f))))

(tm-define (focus-has-preferences? t)
Expand Down
50 changes: 50 additions & 0 deletions devel/222_79.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 222_79 简化 paragraph/subparagraph 标题样式机制

## 如何测试

1. 编译:`xmake b stem`
2. 启动 Mogan,新建空白文档。
3. 依次插入 **Paragraph** 和 **Subparagraph**(通过 `Structure → Section` 菜单或快捷键)。
4. 确认 paragraph/subparagraph 标题显示为**粗体短标题样式**(`sectional-short-bold`),上下保留原有间距(`0.5fn` / `0.25fn`)。
5. 将光标置于 paragraph 或 subparagraph 标题内,打开右侧 **Focus** 菜单,确认**无 "Title style" 选项**(此前存在)。
6. 分别切换文档类型为 **Article**、**Book**、**Generic**,重复步骤 3-5,确认表现一致。
7. 确认 section、subsection、subsubsection 的 title-style 切换功能**不受影响**。

## 2026/04/30 实现说明

### What

移除 paragraph 和 subparagraph 独立的 `title-style` 样式切换机制,将其标题渲染统一为 `sectional-short-bold`,不再支持与其他章节标题一样的 "left/centered" 样式偏好设置。

#### 修改文件

**TeXmacs/packages/section/section-base.ts**
- 移除 `paragraph-title-style` 和 `subparagraph-title-style` 的默认值赋值(原为 `left`)。
- 移除对应的 `drd-props` 声明。
- 移除 `paragraph-title-render` 和 `subparagraph-title-render` 宏定义(原通过 `sectional-select-bold` 根据 `title-style` 选择渲染方式)。

**TeXmacs/packages/section/section-article.ts**
- `paragraph-title` 宏:由 `<paragraph-title-render|...>` 改为 `<sectional-short-bold|...>`。
- `subparagraph-title` 宏:由 `<subparagraph-title-render|...>` 改为 `<sectional-short-bold|...>`。

**TeXmacs/packages/section/section-book.ts**
- 同上,paragraph/subparagraph 标题渲染改为 `sectional-short-bold`。

**TeXmacs/packages/section/section-generic.ts**
- 同上,paragraph/subparagraph 标题渲染改为 `sectional-short-bold`。

**TeXmacs/progs/text/text-menu.scm**
- 在 `focus-get-preferences` 函数中移除 paragraph 和 subparagraph 对应的 `"paragraph-title-style"` 和 `"subparagraph-title-style"` 偏好设置入口。

### Why

1. **职责精简**:paragraph 和 subparagraph 是最底层的小节标题,在实际使用中几乎不需要与其他章节(section/subsection)同等级别的 "left/center" 样式切换能力。
2. **代码简化**:移除两套专用的 `*-title-style` 环境变量、drd-props 和 render 宏定义,降低 section-base.ts 的维护复杂度。
3. **行为统一**:统一使用 `sectional-short-bold` 渲染,与短标题风格的视觉层级保持一致,避免底层小节标题因样式切换导致版面不协调。
4. **菜单降噪**:Focus 菜单中不再显示对 paragraph/subparagraph 无实际意义的 "Title style" 偏好选项。

### How

- 在 `section-base.ts` 中清理 `paragraph-title-style`、`subparagraph-title-style` 及其相关宏定义,将其从样式注册体系中彻底移除。
- 在 `section-article.ts`、`section-book.ts`、`section-generic.ts` 三个文档类型包中,将 paragraph/subparagraph 标题宏直接绑定到 `sectional-short-bold`,保留原有的 `vspace` 间距控制不变。
- 在 `text-menu.scm` 的 `focus-get-preferences` 分发逻辑中移除对应的两个分支,确保 Focus 菜单不再暴露已废弃的偏好项。