错误:计量单位非法(pt 插入)

错误:计量单位非法(pt 插入)

我正在使用这个模板在这里。代码如下:

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage[margin=0.5cm,bottom=2cm]{geometry}
\usepackage{kpfonts}
\usepackage{eso-pic}                
\usepackage{tcolorbox}

\tcbuselibrary{skins}

\tcbset{
    pccstyle/.style={
        enhanced,flushright upper,
        boxrule=1.4pt,
        colback=white,colframe=black!50!yellow,
        drop fuzzy midday shadow=black!50!yellow
    }
}

\AddToShipoutPicture{% from package eso-pic: put something to the background
    \AtPageCenter{% start the bar at the bottom right of the page
        \put(-\LenToUnit{.465\paperwidth},-\LenToUnit{.4\paperheight}){% move it to the middle
            %{\transparent{.5}{\includegraphics[width=20cm]{50th_mathematicsproof}}}
            \begin{tcolorbox}[pccstyle,left=0mm,top=0mm,bottom=0mm]
                \includegraphics[width=20cm]{50th_mathematicsproof}
            \end{tcolorbox}
        }%
    }%
    \AtPageLowerLeft{% start the bar at the bottom right of the page
        \put(\LenToUnit{\dimexpr\paperwidth-3cm},0){% move it to the top right
            \color{blue}\rule{3cm}{\LenToUnit\paperheight}%
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.7cm},\LenToUnit{17cm}){% move it to the top right
            \color{gray}\scalebox{8}{$\sum$}
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.5cm},\LenToUnit{12.5cm}){% move it to the top right
            \color{gray}\scalebox{8}{$\int$}
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.3cm},\LenToUnit{8.5cm}){% move it to the top right
            \color{gray}\scalebox{8}{$e$}
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.7cm},\LenToUnit{5.0cm}){% move it to the top right
            \color{gray}\scalebox{8}{$\pi$}
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.2cm},\LenToUnit{1.5cm}){% move it to the top right
            \color{gray}\scalebox{8}{$i$}
        }%
    }%
}

\pagestyle{empty}
\begin{document}

\vspace*{1cm}
\mbox{}\hfill\scalebox{2}{
    \begin{tcolorbox}[pccstyle,width=6.8cm]
        {\bfseries\LARGE {Program Review} \par}
        {\large \itshape Mathematics \par}
        {\large Portland Community College }
    \end{tcolorbox}
}

\vfill
\centering

\scalebox{2}{%
    \begin{tcolorbox}[pccstyle,width=4.8cm]
        {\scshape Fall 2008--Spring 2013}
    \end{tcolorbox}
}
\end{document}

编译时出现以下错误

Illegal unit of measure (pt inserted). \end{document} on line 72

我不明白为什么会发生这种情况。它应该可以工作。PDF 已生成,看起来符合预期。有什么线索吗?

答案1

错误是

    \put(\LenToUnit{\dimexpr\paperwidth-3cm},0){% move it to the top right
        \color{blue}\rule{3cm}{\LenToUnit\paperheight}%
    }%

精确地\LenToUnit\rule{3cm}--内\LenToUnit不适用于除\put宏之外的任何其他内容。对于需要长度值的常规宏,只需使用长度宏,即\rule{3cm}{\paperheight}

\documentclass[demo]{article}

\usepackage[margin=0.5cm,bottom=2cm]{geometry}
\usepackage{kpfonts}
\usepackage{eso-pic}                
\usepackage{tcolorbox}


\tcbuselibrary{skins}

\tcbset{
    pccstyle/.style={
        enhanced,flushright upper,
        boxrule=1.4pt,
        colback=white,colframe=black!50!yellow,
        drop fuzzy midday shadow=black!50!yellow
    }
}


\pagestyle{empty}

\AddToShipoutPicture{% from package eso-pic: put something to the background
    \AtPageCenter{% start the bar at the bottom right of the page
        \put(-\LenToUnit{.465\paperwidth},-\LenToUnit{.4\paperheight}){% move it to the middle
            %{\transparent{.5}{\includegraphics[width=20cm]{50th_mathematicsproof}}}
            \begin{tcolorbox}[pccstyle,left=0mm,top=0mm,bottom=0mm]
                \includegraphics[width=20cm]{50th_mathematicsproof}
            \end{tcolorbox}
        }%
    }%
    \AtPageLowerLeft{% start the bar at the bottom right of the page
      \put(\LenToUnit{\dimexpr\paperwidth-3cm},0){% move it to the top right
        \color{blue}\rule{3cm}{\paperheight}%
      }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.7cm},\LenToUnit{17cm}){% move it to the top right
            \color{gray}\scalebox{8}{$\sum$}
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.5cm},\LenToUnit{12.5cm}){% move it to the top right
            \color{gray}\scalebox{8}{$\int$}
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.3cm},\LenToUnit{8.5cm}){% move it to the top right
            \color{gray}\scalebox{8}{$e$}
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.7cm},\LenToUnit{5.0cm}){% move it to the top right
            \color{gray}\scalebox{8}{$\pi$}
        }%
        \put(\LenToUnit{\dimexpr\paperwidth-2.2cm},\LenToUnit{1.5cm}){% move it to the top right
            \color{gray}\scalebox{8}{$i$}
        }%
    }%
}


\begin{document}


\vspace*{1cm}
\mbox{}\hfill\scalebox{2}{%
  \begin{tcolorbox}[pccstyle,width=6.8cm]
    {\bfseries\LARGE {Program Review} \par}
    {\large \itshape Mathematics \par}
    {\large Portland Community College }
  \end{tcolorbox}
}

\vfill
\begingroup
\centering

\scalebox{2}{%
    \begin{tcolorbox}[pccstyle,width=4.8cm]
        {\scshape Fall 2008--Spring 2013}
    \end{tcolorbox}
}

\endgroup
\end{document}

在此处输入图片描述

相关内容