我尝试在 jupyterlab 中编译 pdf。当涉及到图形引用时,pdf 仅显示(??)。
\begin{figure}[h!]
\includegraphics[width=\linewidth]{xxx.png}
\caption{Caption of image xxx.png.}
\label{fig1:xxx}
\end{figure}
(\ref{fig1:xxx})
答案1
config.py
文件夹中有一个名为的配置文件jupyterlab_latex
,可用于设置配置选项。该文件包含以下内容:
""" JupyterLab LaTex : live LaTeX editing for JupyterLab """
from traitlets import Unicode, CaselessStrEnum, Integer, Bool
from traitlets.config import Configurable
class LatexConfig(Configurable):
"""
A Configurable that declares the configuration options
for the LatexHandler.
"""
latex_command = Unicode('xelatex', config=True,
help='The LaTeX command to use when compiling ".tex" files.')
bib_command = Unicode('bibtex', config=True,
help='The BibTeX command to use when compiling ".tex" files.')
synctex_command = Unicode('synctex', config=True,
help='The synctex command to use when syncronizing between .tex and .pdf files.')
shell_escape = CaselessStrEnum(['restricted', 'allow', 'disallow'],
default_value='restricted', config=True,
help='Whether to allow shell escapes '+\
'(and by extension, arbitrary code execution). '+\
'Can be "restricted", for restricted shell escapes, '+\
'"allow", to allow all shell escapes, or "disallow", '+\
'to disallow all shell escapes')
run_times = Integer(default_value=1, config=True,
help='How many times to compile the ".tex" files.')
cleanup = Bool(default_value=True, config=True,
help='Whether to clean up ".out/.aux" files or not.')
设置run_times = Integer(default_value=1
为run_times = Integer(default_value=2
运行 LaTeX 两次。保存文件并重新启动 Jupyter Lab 以使更改生效。然后参考资料将正确显示在 pdf 中。
请注意,您不应该.bib
在同一文件夹中拥有任何文件,否则 JupyterLab LaTeX 将尝试运行 Bibtex 并失败,而不是运行 LaTeX 两次(当然,除非您想包含参考书目)。