使用 Pandoc 编译纯 LaTeX(或 beamer)需要超过 30 分钟

使用 Pandoc 编译纯 LaTeX(或 beamer)需要超过 30 分钟

我正在使用 WSL 2(Ubuntu 20.04)和 Windows 终端设置将 markdown 文件编译到 beamer 演示文稿中。不幸的是,如果我尝试使用 pandoc 2.5 来编译它,编译时间会超过 30 分钟(无论是通过 pdfLaTeX、XeLaTeX 还是 LuaLaTeX)。在编译过程中会占用大量内存(有时超过 7 Gb)和 CPU。我现在正在使用完整的 texlive 安装,如果我编译最小的 LaTeX 文件,在 pdfLaTeX 上大约需要 7 秒,在 XeLaTeX 上大约需要 11 秒。我试图检查在 /mnt/c 和虚拟分区中的编译是否存在差异,但我没有看到任何差异。

当我跑步时,--verbose它往往会在那里停留很长时间:

[makePDF] temp dir:
./tex2pdf.-e12d1f709f7253a6
[makePDF] Command line:
pdflatex "-halt-on-error" "-interaction" "nonstopmode" "-output-directory" "./tex2pdf.-e12d1f709f7253a6" "./tex2pdf.-e12d1f709f7253a6/input.tex"

[makePDF] Environment:
("TEXINPUTS","./tex2pdf.-e12d1f709f7253a6:")
("SHELL","/bin/bash")
("TBBROOT","/opt/intel/compilers_and_libraries_2020.4.304/linux/tbb")
("PSTLROOT","/opt/intel/compilers_and_libraries_2020.4.304/linux/pstl")
("LIBGL_ALWAYS_INDIRECT","1")
("WSL_DISTRO_NAME","Ubuntu")
("PKG_CONFIG_PATH","/opt/intel/compilers_and_libraries_2020.4.304/linux/mkl/bin/pkgconfig")
("WT_SESSION","a85cfba4-d3cd-4767-a4ea-eb71304ea2fa")
("I_MPI_ROOT","/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi")
("HOMEBREW_PREFIX","/home/linuxbrew/.linuxbrew")
("FI_PROVIDER_PATH","/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/libfabric/lib/prov:/usr/lib64/libfabric")
("NAME","DESKTOP-D00B1T9")
("PWD","/mnt/c/Users/Acer/Desktop/Linux/Home/Notes/Studies/Seminars/Dirac_Physical_Interpretation_of_QM")
("LOGNAME","qsiek")
("MANPATH","/home/linuxbrew/.linuxbrew/share/man:/opt/intel/man/common:/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/man:/opt/intel/documentation_2020/en/debugger/gdb-ia/man/:/usr/local/man:/usr/local/share/man:/usr/share/man::")
("CUDADIR","/usr/local/cuda")
("HOME","/mnt/c/Users/Acer/Desktop/Linux")
("LANG","C.UTF-8")
("WSL_INTEROP","/run/WSL/25516_interop")
("LS_COLORS","rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:")
("INFOPATH","/home/linuxbrew/.linuxbrew/share/info:/opt/intel/documentation_2020/en/debugger/gdb-ia/info/")
("IPPROOT","/opt/intel/compilers_and_libraries_2020.4.304/linux/ipp")
("LESSCLOSE","/usr/bin/lesspipe %s %s")
("TERM","xterm-256color")
("LESSOPEN","| /usr/bin/lesspipe %s")
("USER","qsiek")
("LIBRARY_PATH","/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/libfabric/lib:/opt/intel/compilers_and_libraries_2020.4.304/linux/ipp/lib/intel64:/opt/intel/compilers_and_libraries_2020.4.304/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2020.4.304/linux/mkl/lib/intel64_lin:/opt/intel/compilers_and_libraries_2020.4.304/linux/tbb/lib/intel64/gcc4.8:/opt/intel/compilers_and_libraries_2020.4.304/linux/tbb/lib/intel64/gcc4.8")
("HOMEBREW_CELLAR","/home/linuxbrew/.linuxbrew/Cellar")
("DISPLAY","172.29.96.1:0")
("SHLVL","1")
("HOMEBREW_REPOSITORY","/home/linuxbrew/.linuxbrew/Homebrew")
("CLASSPATH","/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/lib/mpi.jar")
("LD_LIBRARY_PATH","/opt/intel/compilers_and_libraries_2020.4.304/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/libfabric/lib:/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/lib/release:/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2020.4.304/linux/ipp/lib/intel64:/opt/intel/compilers_and_libraries_2020.4.304/linux/mkl/lib/intel64_lin:/opt/intel/compilers_and_libraries_2020.4.304/linux/tbb/lib/intel64/gcc4.8:/opt/intel/debugger_2020/python/intel64/lib:/opt/intel/debugger_2020/libipt/intel64/lib:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64")
("XDG_RUNTIME_DIR","/tmp/runtime-qsiek")
("MKLROOT","/opt/intel/compilers_and_libraries_2020.4.304/linux/mkl")
("WSLENV","WT_SESSION::WT_PROFILE_ID")
("GCC_COLORS","error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01")
("XDG_DATA_DIRS","/usr/local/share:/usr/share:/var/lib/snapd/desktop")
("NLSPATH","/opt/intel/compilers_and_libraries_2020.4.304/linux/compiler/lib/intel64/locale/%l_%t/%N:/opt/intel/compilers_and_libraries_2020.4.304/linux/mkl/lib/intel64_lin/locale/%l_%t/%N:/opt/intel/debugger_2020/gdb/intel64/share/locale/%l_%t/%N")
("PATH","/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/opt/intel/compilers_and_libraries_2020.4.304/linux/bin/intel64:/opt/intel/compilers_and_libraries_2020.4.304/linux/bin:/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/libfabric/bin:/opt/intel/compilers_and_libraries_2020.4.304/linux/mpi/intel64/bin:/opt/intel/debugger_2020/gdb/intel64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda/bin")
("INTEL_PYTHONHOME","/opt/intel/debugger_2020/python/intel64/")
("HOSTTYPE","x86_64")
("INTEL_LICENSE_FILE","/opt/intel/compilers_and_libraries_2020.4.304/linux/licenses:/opt/intel/licenses:/mnt/c/Users/Acer/Desktop/Linux/intel/licenses")
("CPATH","/opt/intel/compilers_and_libraries_2020.4.304/linux/ipp/include:/opt/intel/compilers_and_libraries_2020.4.304/linux/mkl/include:/opt/intel/compilers_and_libraries_2020.4.304/linux/pstl/include:/opt/intel/compilers_and_libraries_2020.4.304/linux/pstl/stdlib:/opt/intel/compilers_and_libraries_2020.4.304/linux/tbb/include:/opt/intel/compilers_and_libraries_2020.4.304/linux/tbb/include")
("WT_PROFILE_ID","{2c4de342-38b7-51cf-b940-2309a097f518}")
("OLDPWD","/mnt/c/Users/Acer/Desktop/Linux/Home/Notes/Studies/Seminars")
("_","/usr/bin/pandoc")

[makePDF] Contents of ./tex2pdf.-e12d1f709f7253a6/input.tex:
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provides euro and other symbols
\else % if luatex or xelatex
  \usepackage{unicode-math}
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\usepackage{hyperref}
\hypersetup{
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

% set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother


\date{}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.

\end{document}

markdown 文件只是:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.

我使用这个命令作为最小示例(这个特定示例持续不到 4 分钟,但我认为它不应该花费这么长时间,稍微大一点的 YAML 标头可能需要超过 30 分钟):

pandoc -t latex test.md -o test.pdf

相关内容