Skip to content

Commit a0024cf

Browse files
authored
[203_2827] support \bold command (#2835)
1 parent f536ff7 commit a0024cf

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

TeXmacs/plugins/latex/progs/convert/latex/latex-command-drd.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
(logic-group latex-modifier-1%
255255
textnormalfont
256256
textrm texttt textsf textmd textbf textup textit textsl textsc emph
257-
mathrm mathtt mathsf mathmd mathbf mathup mathit mathsl mathnormal
257+
mathrm mathtt mathsf mathmd mathbf mathup mathit mathsl mathnormal bold
258258
mathcal mathfrak mathbb mathbbm mathscr operatorname boldsymbol
259259
lowercase MakeLowercase uppercase MakeUppercase selectlanguage)
260260

TeXmacs/plugins/latex/progs/convert/latex/tmtex.scm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,8 @@
16121612

16131613
(define (post-process-math-text t)
16141614
(cond ((or (nlist? t) (!= (length t) 2)) t)
1615-
((nin? (car t) '(mathrm mathbf mathsf mathit mathsl mathtt tmop)) t)
1615+
((nin? (car t) '(mathrm mathbf mathsf mathit mathsl mathtt tmop bold)) t)
1616+
((func? t 'bold 1) (post-process-math-text (list 'mathbf (cadr t))))
16161617
((and (string? (cadr t)) (string-alpha? (cadr t))) t)
16171618
((func? t 'mathrm 1) `(textrm ,(cadr t)))
16181619
((func? t 'mathbf 1) `(textbf ,(cadr t)))
@@ -1641,7 +1642,7 @@
16411642
(let ((w (tmtex-get-with-cmd var val))
16421643
(a (tmtex-get-assign-cmd var val)))
16431644
(cond ((and w (tm-func? arg w 1)) arg)
1644-
((in? w '(mathrm mathbf mathsf mathit mathtt mathsl))
1645+
((in? w '(mathrm mathbf mathsf mathit mathtt mathsl bold))
16451646
(post-process-math-text (list w arg)))
16461647
(w (list w arg))
16471648
(a (list '!group (tex-concat (list (list a) " " arg))))

devel/203_2827.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 203_2827 Support \bold command
2+
3+
## How to test
4+
1. Create a LaTeX file containing `\bold{test}`.
5+
2. Import the file into `.tm` format.
6+
3. Verify that the imported document correctly renders "test" in bold text, identical to how `\mathbf{test}` is normally handled, instead of showing a raw red `\bold` tag.
7+
8+
## 2026/02/21 Support \bold command
9+
### What
10+
Added support for the `\bold` command within the LaTeX plugin's import logic.
11+
12+
### Why
13+
To resolve issue #2827. The original LaTeX parser treated `\bold` as an undefined macro during import. This resulted in an unsupported red tag appearing in the Mogan editor.
14+
15+
### How
16+
1. In `TeXmacs/plugins/latex/progs/convert/latex/latex-command-drd.scm`, registered `bold` in the `latex-modifier-1%` logic group so the parser recognizes it as a standard single-argument formatting macro.
17+
2. In `TeXmacs/plugins/latex/progs/convert/latex/tmtex.scm`, added a proxy translation rule inside `post-process-math-text`: `((func? t 'bold 1) (post-process-math-text (list 'mathbf (cadr t))))`. This intercepts `\bold` and delegates it to `\mathbf`, ensuring that it inherits all necessary logic for properly rendering both text and math content into bold.

0 commit comments

Comments
 (0)