【问题标题】:Jupyter notebook LatexJupyter 笔记本 Latex
【发布时间】:2017-08-07 15:33:13
【问题描述】:

我需要输入一个数学公式及其符号。该公式有效,但符号格式不正确。你能帮我解决这个问题吗?谢谢。

$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times 
p\prime\times(1-p)}\\
$$


$$p$$: notation1
$$p\prime$$: notation2
$$\phi$$: notation3
$$\phi\prime$$: notation4

【问题讨论】:

  • 你想用你的符号实现什么?你能提供普通乳胶的代码,或者张贴图片吗?目前,notation 位是由 Markdown 渲染的,而不是通过 Latex 渲染的,这可能是问题的一部分。
  • 我希望符号右对齐,没有凹痕,一行一个符号。目前p在第一行,notation1在第二行,p'在第三行.....我想要(第1行:p:notation 1,row2:p':notation2.....)

标签: math latex jupyter-notebook notation


【解决方案1】:

您正在使用$$,它会在方程式周围强制换行。使用单个 $ 创建一个内联表达式,这正是您想要的。所以把代码改成:

$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times 
p\prime\times(1-p)}\\
$$


$p$: notation1

$p\prime$: notation2

$\phi$: notation3

$\phi\prime$: notation4

或者,为了更好地打破线条,您可以使用<br/> 标签

$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times 
p\prime\times(1-p)}\\
$$


$p$: notation1<br/>
$p\prime$: notation2<br/>
$\phi$: notation3<br/>
$\phi\prime$: notation4<br/>

您还提到了右对齐 - 为此您需要使用 div 并对齐它,如下所示:

$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times 
p\prime\times(1-p)}\\
$$

<div align="right">
$p$: notation1<br/>
$p\prime$: notation2<br/>
$\phi$: notation3<br/>
$\phi\prime$: notation4<br/>
</div>

请注意,后两种解决方案只能在实时笔记本中真正起作用,我认为是 HTML 输出(Markdown 也可能起作用)。如果您打算之后转换为latex/pdf,那么您将需要第一个解决方案或以下解决方案:

$$
(x)\approx\frac{\phi\prime (x)\times(1-p\prime)\times p}
{\phi\prime(x)\times(1-p\prime)\times p +(1-\phi\prime(x)\times 
p\prime\times(1-p)}\\
$$

$\begin{align}
p: notation1
\newline
p\prime: notation2
\newline
\phi: notation3
\newline
\phi\prime: notation4
\end{align}
$

使用此解决方案,您可以左对齐(在align 环境周围使用单个$)或居中对齐(在align 环境周围使用$$),但我认为您不能有右对齐结盟。另外,notations 采用数学字体而不是常规字体,这可能不是我们所希望的。

【讨论】: