Correct `\mathbf` Rendering to Regular Fonts
Closed this issue · 5 comments
Hi, I found that that both \mathbf .
and \mathbf{...}
cannot be correctly rendered in desired form as in LaTeX (bold AND regular). For example,
#import "@preview/mitex:0.2.2": *
#mitext(`Reciprocal vector is $\mathbf G$ or $\mathbf{G}$`)
NOTE:
\bm
(as well as\boldsymbol
(please also add support for this command)) behaves different from\mathbf
!
And here is one more tricky thing:
See https://tex.stackexchange.com/questions/294561/using-textbf-vs-mathbf-in-math-mode. Precisely, \mathbf{...}
and \textbf{...}
are different in LaTeX, in that \mathbf{...}
will remove ALL blank spaces within its arguments. So probably a more correct rendering is to parse, for example, for the LaTeX code:
$\sum_{i\in\mathcal I}\mathbf{Op With Space}=\text{blablabla}$
as the Typst code:
$ sum_(i in cal(I))bold(#"Op With Spaces".replace(" ", ""))="blablabla" $
I think this clearly demonstrate how to fix the \mathbf
rendering problem : )
Thanks for your help!
in that \mathbf{...} with remove ALL blank spaces within its arguments.
This is tricky. How about other spaces in unicode? Blindly removing all spaces might be wrong in some cases. I wonder where can we get a spec describing the behavior of mathbf
For now we can first fix the font variant problem and deal with spaces later
mitex/packages/mitex/specs/latex/standard.typ
Line 124 in 9193362
in that \mathbf{...} with remove ALL blank spaces within its arguments.
This is tricky. How about other spaces in unicode? Blindly removing all spaces might be wrong in some cases. I wonder where can we get a spec describing the behavior of mathbf
Math isn't whitespace dependent in LaTeX. The difference here is that \textbf{}
typesets as regular bold text (which does take whitespace into account, but only a single one if there are consecutive ones), while \mathbf{}
is for typesetting with bold math symbols.
\[
|\mathbf{ Hello World }| |\textbf{ Hello World }|
\]
Fixed in 0.2.3