python - 如何使用 LaTeX 在 Jupyter Notebook 中水平包含两个图形,准备导出为 PDF?
问题描述
我想包括两个数字,如此处所示。
我尝试使用Markdown 语法,但是,当导出为 PDF 时,这两个图像超出了页面的范围。Pandoc 无法将 HTML 转换为 LaTeX,反之亦然,因此在 HTML 中包含图形也不是一种选择。
最后,使用Jupyter notebook 的(一些)LaTeX 环境,我能够将 LaTeX 代码包含到 Markdown 单元格中,以便它显示在笔记本本身中。但是,我现在有两个问题。这是我的代码:
\begin{figure}[ht]
\begin{subfigure}{.5\textwidth}
\centering
% include first image
\includegraphics[width=.8\linewidth]{attachments/alpha-games.jpg}
\caption{AlphaZero games}
\label{fig:games}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
% include second image
\includegraphics[width=.8\linewidth]{attachments/fb-robots.jpg}
\caption{Robots}
\label{fig:robots}
\end{subfigure}
\caption{Uses of Reinforcement learning in real life.}
\label{fig:fig1}
\end{figure}
这是 Jupyter Notebook 中的输出:
只显示一张图片,另一张没有。此外,图形标题未居中。
那是另一个问题,图形标题不在图像下方居中,而是向左对齐。即使在简单的数字(不是子图)下。
所以我需要的是让这些数字在 Jupyter Notebook 以及通过 LaTeX 将笔记本转换为 PDF 之后正确显示。
有任何想法吗?谢谢!
解决方案
推荐阅读
- r - Mutate not behaving as expected inside custom functions (variation)
- r - 根据排名和条件过滤数据
- laravel - 提交表单时未找到错误类“App\Model”
- c++ - 如何在 Visual C++ 中为 DLL 和 EXE 使用相同的堆
- javascript - MongoDB 集合返回空对象,为什么?
- matlab - Matlab:傅立叶系数
- dart - 问:“字符串”类型不是“(动态)=> 动态”类型的子类型
- f# - F#:从嵌套列表中的第一个元素创建新列表
- python - 如何在python列表中搜索存储在数据框中的整个单词字符串?
- typescript - 如何使用图形 API 将视频上传到我的 Facebook 页面?