如何使用 LaTeX 在 Jupyter Notebook 中水平包含两个数字,准备导出为 PDF?

Peh*_*ehy 5 python latex pandoc jupyter-notebook nbconvert

我想包括两个图所示这里。

我尝试使用Markdown 语法,但是,在导出为 PDF 时,这两个图像超出了页面范围。Pandoc 无法将 HTML 转换为 LaTeX,反之亦然,因此在 HTML 中包含数字也不是一个选项。

最后,为 Jupyter 笔记本使用(一些)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}
Run Code Online (Sandbox Code Playgroud)

这是 Jupyter Notebook 中的输出:

Jupyter Notebook 输出

只显示一张图片,另一张不显示。此外,图形标题未居中。

那是另一个问题,图形标题不在图像下方居中,而是向左对齐。即使在简单的数字(不是子图)下。

所以我需要的是在 Jupyter Notebook 以及通过 LaTeX 将笔记本转换为 PDF 之后正确显示数字。

有任何想法吗?谢谢!