lualatex texlive 2016 tcolorbox

lualatex texlive 2016 tcolorbox

如果你使用 tl2016 lualatex 编译这个 MWE

    \documentclass[10pt, xcolor=svgnames, x11names,  t]{beamer} 

    \usepackage{etoolbox}
    \usepackage{ifluatex}

\ifluatex
    \usepackage[no-math]{fontspec}
    \usepackage[EU2]{fontenc}
    \usepackage{lualatex-math}
\else
    \usepackage[utf8]{inputenc}  
    \usepackage[T1]{fontenc}
\fi

    \usepackage{mathtools}
    \usepackage{amsfonts}
    \usepackage{amssymb}
    \usepackage{bm}
\ifluatex
    \setsansfont[Ligatures=TeX,
    ItalicFont={MyriadPro-SemiCnIt.otf},
    BoldFont={MyriadPro-BoldSemiCn.otf},
    BoldItalicFont={MyriadPro-BoldSemiCnIt.otf},
    SmallCapsFont={Delicious-SmallCaps.otf}
    ]{MyriadPro-SemiCn.otf}                                 

\else
    \usefonttheme{professionalfonts}
    \usepackage[condensed, scale]{tgheros}
\fi 
\normalfont

\usepackage[listings,theorems,skins, raster, breakable]{tcolorbox}

\ifluatex
\newtcblisting{mydocument}{%
  left skip=-4.2pt,width=1.01\linewidth, sharp corners,%
  beforeafter skip=0.5\baselineskip,%
  leftlower=0pt,rightlower=0pt,%
  lower separated=false,middle=0pt,%
  colframe=blue, enhanced, %
  interior style={top color=yellow!5!white,bottom color=yellow!5!white},%
  righthand width=4cm,halign=left,%
  pdf comment,%
  listing side comment,%
  compilable listing,%
  run lualatex}
\else
\newtcblisting{mydocument}{%
  left skip=-4.2pt,width=1.01\linewidth, sharp corners,%
  beforeafter skip=0.5\baselineskip,%
  leftlower=0pt,rightlower=0pt,%
  lower separated=false,middle=0pt,%
  colframe=blue, enhanced, %
  interior style={top color=yellow!5!white,bottom color=yellow!5!white},%
  righthand width=4cm,halign=left,%
  pdf comment,%
  listing side comment,%
  compilable listing,%
  run pdflatex}
\fi


\begin{document}
\begin{frame}[fragile]{TCB}
\begin{mydocument}
\documentclass[border=10pt]{standalone}
\begin{document}
Hello%
world.

Hello
world.
\end{document}
\end{mydocument}
\end{frame}
\end{document}

你有这个错误:

    Package tcolorbox Error: PDF file `mwebeamersans-listin
g-1.pdf' not found.

文件名是 mewbeamersans.tex。使用 pdflatex 编译没问题。使用 TL2015 和 lualatex 编译也没问题。有什么帮助吗?

答案1

最好将示例最小化。

错误也出现在

\documentclass[10pt, xcolor=svgnames, x11names,  t]{beamer} 

\usepackage{fontspec}

\usepackage[listings,theorems,skins, raster, breakable]{tcolorbox}

\newtcblisting{mydocument}{%
  left skip=-4.2pt,width=1.01\linewidth, sharp corners,%
  beforeafter skip=0.5\baselineskip,%
  leftlower=0pt,rightlower=0pt,%
  lower separated=false,middle=0pt,%
  colframe=blue, enhanced, %
  interior style={top color=yellow!5!white,bottom color=yellow!5!white},%
  righthand width=4cm,halign=left,%
  pdf comment,%
  listing side comment,%
  compilable listing,%
  run lualatex}

\begin{document}
\begin{frame}[fragile]{TCB}
\begin{mydocument}
\documentclass[border=10pt]{standalone}
\begin{document}
Hello%
world.

Hello
world.
\end{document}
\end{mydocument}
\end{frame}
\end{document}

如果使用 进行编译lualatex -shell-escape,则需要添加\usepackage{shellesc},但您还需要对 进行一些调整standalone,因为尚未更新以考虑到\pdfpagewidth\pdfpageheight已重命名为\pagewidth\pageheight

standalone.cfg可以通过使用与主文件位于同一目录中的文件来解决这个问题,该文件包含

\ifdefined\pdfpagewidth
\else
  \let\pdfpagewidth\pagewidth
  \let\pdfpageheight\pageheight
\fi

你可以使用以下命令自动生成它filecontents

\begin{filecontents}{standalone.cfg}
\ifdefined\pdfpagewidth
\else
  \let\pdfpagewidth\pagewidth
  \let\pdfpageheight\pageheight
\fi
\end{filecontents}

\documentclass[10pt, xcolor=svgnames, x11names,  t]{beamer} 

\usepackage{shellesc}
\usepackage{fontspec}

\usepackage[listings,theorems,skins, raster, breakable]{tcolorbox}

\newtcblisting{mydocument}{%
  left skip=-4.2pt,width=1.01\linewidth, sharp corners,%
  beforeafter skip=0.5\baselineskip,%
  leftlower=0pt,rightlower=0pt,%
  lower separated=false,middle=0pt,%
  colframe=blue, enhanced, %
  interior style={top color=yellow!5!white,bottom color=yellow!5!white},%
  righthand width=4cm,halign=left,%
  pdf comment,%
  listing side comment,%
  compilable listing,%
  run lualatex}

\begin{document}
\begin{frame}[fragile]{TCB}
\begin{mydocument}
\documentclass[border=10pt]{standalone}
\begin{document}
Hello%
world.

Hello
world.
\end{document}
\end{mydocument}
\end{frame}
\end{document}

在此处输入图片描述

另一种方法standalone.cfg是添加

\RequirePackage{luatex85}

到要编译的文档

\begin{mydocument}
\RequirePackage{luatex85}
\documentclass[border=10pt]{standalone}
\begin{document}
Hello%
world.

Hello
world.
\end{document}
\end{mydocument}

相关内容