微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Jupyter Notebook iPython 中的乳胶

如何解决Jupyter Notebook iPython 中的乳胶

我在 jupyter notebook 中有一个 python 项目,我想用 Latex 显示最终输出

x = 5
print("The number you have inputted is ",complex(x,y)," ^ 1/",n,sep = '')

我希望使用 Latex 对其进行格式化:

Input to be formatted


我阅读了很多论坛,但分数不适用于 2 位数字

n=10
from IPython.display import display,Markdown
display(Markdown(rf"""$ { complex(x,y) } ^ \frac{1}{n} $"""))

我能得到的最好的:

Input to be formatted


任何建议都会非常有帮助:)

解决方法

您可以使用 Latex 直接将其显示为 Latex。要将大括号保留为 Latex 的文字,您需要使用双 {{ }}。否则 \frac 不会获得完整的操作数。

from IPython.display import display,Latex

x=1
y=0
n=10

display(Latex(rf'$ { complex(x,y) } ^\fracconst [likes,setLikes] = useState(0);

  useEffect( async () => {

    const query = await getDevsApi();    //This returns a collection of data I can map.
    const likes = query.map(like => like.upvotes);    //The problem  here is,it returns an array of data... How do I get individual data for each user? and set it at as the current state in the setLikes() below.

    setLikes(likes)

  },[]);

{{{n}}}$'))

Jupyterlab 中的输出: enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。