代码之家  ›  专栏  ›  技术社区  ›  DimKoim

避免在ipython notebook markdown单元格的表格标题中出现换行。

  •  0
  • DimKoim  · 技术社区  · 7 年前

    我想在ipython笔记本的降价单元格中创建一个表:

    | $X_{t-1}$         | $X_{t}$           | $\textbf{P} (X_{t}| X_{t-1}) $|  
    | -------------     |-------------| ----------------------------------|
    | $\textit{False}$  | $\textit{False}$  | 0.7                         |
    | $\textit{False}$  | $\textit{True}$   | 0.3                         |
    | $\textit{True}$   | $\textit{False}$  | 0.3                         |
    | $\textit{True}$   | $\textit{True}$   | 0.7                         |
    

    然而,表格的标题分为两行。结果是这样的。

    enter image description here

    我尝试使用以下命令更改对齐方式,但没有任何结果:

     :--- or --- = left align
     ---: = right align
     :---: = centered
    

    我怎样才能避免呢?

    1 回复  |  直到 7 年前
        1
  •  0
  •   skmth    7 年前

    我不知道正确的方法,但这里有一个快速修复方法。在标题开头添加选项卡

    | $X_{t-1}$         | $X_{t}$           |   $\textbf{P} (X_{t}| X_{t-1}) $       |  
    | -------------     |-------------------| --------------------------------------------|
    | $\textit{False}$  | $\textit{False}$  | 0.7                                         |
    | $\textit{False}$  | $\textit{True}$   | 0.3                                         |
    | $\textit{True}$   | $\textit{False}$  | 0.3                                         |
    | $\textit{True}$   | $\textit{True}$   | 0.7                                         |