小编Peh*_*ehy的帖子

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

我想包括两个图所示这里

我尝试使用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 之后正确显示数字。

有任何想法吗?谢谢!

python latex pandoc jupyter-notebook nbconvert

5
推荐指数
0
解决办法
335
查看次数

Jupyter Book,如何更改字体或间距(文本格式)

有什么方法可以配置通过 LaTeX 最终的 HTML 和 PDF 输出的外观吗?例如,我想更改行距。一直无法弄清楚这一点。先感谢您。

python pdf formatting text jupyter

5
推荐指数
0
解决办法
422
查看次数

标签 统计

python ×2

formatting ×1

jupyter ×1

jupyter-notebook ×1

latex ×1

nbconvert ×1

pandoc ×1

pdf ×1

text ×1