找回密码
 快速注册
搜索
楼主: kuing

本论坛的 $\mathrm\LaTeX$ 公式的基本输入[2021-9-26更新]

[复制链接]

1

主题

10

回帖

61

积分

积分
61

显示全部楼层

周险峰 发表于 2017-5-20 09:35
本帖最后由 周险峰 于 2017-5-20 09:54 编辑 行内试试看:\(a^2=b^2+bc\)
行间试试看:\[e^x\geqslant ex+(x-1)^2\]
复杂点的试试:\[\frac c{b}+\frac b{c}=\frac {b^2+c^2-a^2}{bc}+\frac {a^2}{bc}=2\cos A+2\sin A\]
来个分段函数:\[f(x)=\begin{cases}x^2+2x+3&x\geqslant2\\e^x-x&x<0\end{cases}\]
来个换行等号:\begin{align*}
\frac c{b}+\frac b{c}&=\frac {b^2+c^2-a^2}{bc}+\frac {a^2}{bc}\\&=2\cos A+2\sin A\\&=2\sqrt2 \sin(A+\frac{\pi}{4})\end{align*}

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2017-5-20 12:43
回复 41# 周险峰

你也可以在页面下方的“草稿本”中测试。

34

主题

50

回帖

685

积分

积分
685

显示全部楼层

wanhuihua 发表于 2018-2-23 14:23
可以按照Latex格式完全复制某人的证明吗?谢谢

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2018-2-23 17:40
回复 43# wanhuihua

办法是有的,但我建议你还是先试着自己输入。

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2020-7-19 00:58
回复 46# hbghlyj

提到 dots ,我就多扯几句……

在真 LaTeX 中,不加载 amsmath 的话,\dots 和 \ldots 是一样的,就是在基线上的(与普通句点相同高度的)三点,\cdots 则是相对高一点的(与点乘号相同高度的)三点。

加载 amsmath 的话,该宏包改变了 \dots ,会视情况给出适当的三点,手册原文:
For most situations, the undifferentiated \dots can be used, and amsmath will output the most suitable form based on the immediate context; if an inappropriate form results, it can be corrected after examining the output.
google 翻译一下:
在大多数情况下,可以使用未区分的\dots,并且amsmath会根据当前上下文输出最合适的形式;如果结果不正确,则可以在检查输出后进行更正。
没说具体的判断规则,我也没细究,一向都是自己手工选择 \ldots 或 \cdots 。

闲来无事,想搞清楚,就去看 amsmath.sty 的代码,可惜太复杂了,超出我的能力范围,只好做做测试吧……

本论坛的 mathjax 是有 amsmath 的,所以可以在论坛上测试,以下省略号全是用 \dots
\begin{gather*}
a+\dots+z \\[1ex]
a,\dots,z \\[1ex]
S=a+b+\dots \\[1ex]
a+b+\dots=S \\[1ex]
a,b,\dots \\[1ex]
a,b,\dots=0 \\[1ex]
ab\dots z \\[1ex]
a,\dots\sum\dots\sum\dots \\[1ex]
a,\dots\int\dots\int\dots \\[1ex]
\end{gather*}看起来,似乎只有当 \dots 的后面是运算符或关系符的时候才会是居中的三点

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2020-7-19 01:13
回复 47# kuing

我错了,mathjax 和真 LaTeX 有区别,在真 LaTeX 里 \dots 后跟 \sum 或 \int 之类的也是会居中的。

也用 KaTeX 测试一下,看看是不是如我一向的感觉:KaTeX 总是更接近真 LaTeX
QQ截图20210926175509.png
果然如此!

830

主题

4862

回帖

3万

积分

积分
36159

显示全部楼层

isee 发表于 2020-7-20 19:02
论坛代码要求好“松”,e^x_0 都能显示出是要表达的式子

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2020-7-20 19:16
论坛代码要求好“松”,e^x_0 都能显示出是要表达的式子
isee 发表于 2020-7-20 19:02
e^x_0 get $e^x_0$,这不是正常结果吗?

830

主题

4862

回帖

3万

积分

积分
36159

显示全部楼层

isee 发表于 2020-7-20 22:38
回复 50# kuing


表达有误,应该是指这类 e^\sqrt 2

15

主题

958

回帖

1万

积分

积分
12454

显示全部楼层

色k 发表于 2020-7-20 23:09
回复 51# isee

嗯,这的确是

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2020-7-21 00:56
回复 51# isee

真 LaTeX 里,连 f_\max 都不行……

说到这个,我记得我曾经在 CTEX 论坛上问过,为啥 f_\alpha 可以但 f_\max 却不行,回答是怎样我不记得了,反正对此我现在还不太清楚。

830

主题

4862

回帖

3万

积分

积分
36159

显示全部楼层

isee 发表于 2021-8-10 00:34
整除符号 \mid  

不整除 \nmid(大小不变)

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2021-9-26 12:46
回复 33# isee

加上了。

最近有新人入坛,更新了一下置顶帖

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2022-4-15 15:29
回复 35# hbghlyj

你是怎么发现的?

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-6-2 00:00


kuing 发表于 2020-7-18 17:58 回复 46# hbghlyj 提到 dots ,我就多扯几句……
SymbolCommand
$\cdot$\cdot
$\cdotp$\cdotp
$\centerdot$\centerdot
$\bullet$\bullet
$\dots$\dots
$\cdots$\cdots
$\ldots$\ldots
$\dotsb$\dotsb
$\dotsc$\dotsc
$\dotsi$\dotsi
$\dotsm$\dotsm
$\dotso$\dotso
$\mathellipsis$\mathellipsis
$\ddots$\ddots
$\vdots$\vdots
$\iddots$\iddots
在KaTeX中提供了\mathellipsis:见KaTeX issue 596
$value[1].jpg
\iddots是由mathdots提供的,
在MathJax中,可以直接使用Unicode字符⋰或者\unicode{x22f0},参见math.meta.stackexchange.com

测试
\[1 \cdot 2 \cdotp 3 \centerdot 4 \bullet\]
\[1 \cdot 2 \cdotp 3 \centerdot 4 \bullet\]
\[1 \dots 2 \cdots 3 \ldots4\]
\[1 \dots 2 \cdots 3 \ldots4\]
\[1 \dotsb 2 \dotsc 3 \dotsi 4 \dotsm 5 \dotso 6\]
\[1 \dotsb 2 \dotsc 3 \dotsi 4 \dotsm 5 \dotso 6\]
在KaTeX中,可以看到3后面的\dotsi和3的距离非常近 Screenshot 2022-06-01 at 17-22-50 KaTeX – The fastest math typesetting library .png

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-7-13 21:12
刚发现,括号的字号呈等差数列,0.423em为公差
$\big($\big(1.2em
$\Big($\Big(1.623em
$\bigg($\bigg(2.047em
$\Bigg($\Bigg(2.470em


刚发现\bigl\langle\bigl<效果一样$$\bigl\langle$$
$$\bigl<$$
生成的MathML都是
  <mrow data-mjx-texclass="OPEN">
    <mo minsize="1.2em" maxsize="1.2em">&#x27E8;</mo>
  </mrow>




另外\big\langle\big<效果一样
$$\big<$$
$$\big\langle$$
生成的MathML都是
  <mrow data-mjx-texclass="ORD">
    <mo minsize="1.2em" maxsize="1.2em">&#x27E8;</mo>
  </mrow>



还有\left\langle\left<效果一样
$$\left<\prod^n_{i=1}\right.$$
$$\left\langle\prod^n_{i=1}\right.$$
生成的MathML都是
  <mrow data-mjx-texclass="INNER">
    <mo data-mjx-texclass="OPEN">&#x27E8;</mo>
    (⋯ nodes in the bracket ⋯)
  </mrow>




还可以把\langle>配对使用:
\left<123\right\rangle
$$\left<123\right\rangle$$

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-7-16 03:12
脚标在前面, 使用\sideset或者{}_{...}的效果不同:
$\sideset{_\mathcal{B}}{_\mathcal{B}}{[T]}$ vs ${}_\mathcal{B}[T]_\mathcal{B}$

730

主题

1万

回帖

9万

积分

积分
93593
QQ

显示全部楼层

 楼主| kuing 发表于 2022-7-16 14:40
hbghlyj 发表于 2022-7-16 03:12
脚标在前面, 使用\sideset或者{}_{...}的效果不同:
$\sideset{_\mathcal{B}}{_\mathcal{B}}{[T]}$ vs ${}_\ ...


\sideset{_\mathcal{B}}{_\mathcal{B}}{[T]}
这个写法有问题,在真 latex 里是会报错的。

\sideset 的第三个参数必须是一个 math operator,比如 \sum、\int、\max 之类。

所以如果确实需要作用于 [T] ,那就应该用 \mathop 来包住它,即
\sideset{_\mathcal{B}}{_\mathcal{B}}{\mathop{[T]}}

在真 latex 里:
  1. \documentclass{article}
  2. \usepackage{amsmath,amssymb}
  3. \begin{document}
  4. $\sideset{_\mathcal{B}}{_\mathcal{B}}{\mathop{[T]}}$
  5. vs
  6. ${}_\mathcal{B}[T]_\mathcal{B}$
  7. \end{document}
复制代码
效果是:
QQ截图20220716144131.png

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-7-16 15:22
tex.stackexchange.com/a/159308
MathML has a prescripts mechanism using <mmultiscripts> and <mprescripts> so in MathJaX you also have the possibility of directly accessing those rather than relying on conversion from some "standard" LaTeX package markup. You can generate any MathML element from the TeX MathJax syntax using \mmlToken.

蓝色字好像有错: MathJax中只能用\mmlToken生成token element,而<mmultiscripts>不是token element
3 Presentation Markup
The primary MathML token element types are identifiers (e.g. variables or function names), numbers, and operators (including fences, such as parentheses, and separators, such as commas).

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-7-16 15:26


tex.stackexchange.com/a/25978
However, for chemistry typesetting you should use one of the specialized packages, such as  mhchem . This example is taken from  mhchem  documentation: \$\$ \ce{^{227}_{90}Th+} \$\$ $$ \ce{^{227}_{90}Th+} $$

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 07:02

Powered by Discuz!

× 快速回复 返回顶部 返回列表