![](/img/trans.png)
[英]Cannot execute code in some of Jupyiter ipython notebook cells
[英]IPython notebook put code cells into columns
有沒有辦法以列格式組織代碼單元? 我想在IPython Notebook中編寫導數,但是每個輔助方程似乎都破壞了我的導數。 我正在使用一個模塊編寫方程式並將方程式輸入到代碼單元中,因此無法在markdown內使用簡單的html對齊方式。 任何幫助是極大的贊賞!
我的意思是,我希望代碼單元看起來像這樣...
而不是規則的垂直對齊的單元格...
經過一番摸索,我發現了通過修改筆記本css的解決方案。 這適用於IPython 2.0,但可能不適用於1.x! 要測試這種方法,只需在筆記本中執行以下命令
%%HTML
<style>
div#notebook-container.container {
/* This acts as a spacer between cells, that is outside the border */
margin: 2px 0px 2px 0px;
list-style: none;
padding: 0;
margin: 0;
-ms-box-orient: horizontal;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -moz-flex;
display: -webkit-flex;
display: flex;
justify-content: space-around;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-flex-direction: row;
flex-direction: row;
}
div.cell {
width:550px
}
</style>
這樣,您可以獲得靈活的盒子布局,因此可以並排放置兩個單元格。 因為我不是CSS專家,所以這肯定是一個相當弱的hack,但是它似乎是合理的。 要更認真地使用此方法,您可以創建一個新的配置文件,然后將css添加到custom.css。
我在這里找到了一些靈感。
結果看起來像這樣
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.