Beamer:华沙主题中框架标题框左侧出现垂直白线

Beamer:华沙主题中框架标题框左侧出现垂直白线

使用时华沙主题,我总是看到左侧有一条恼人的白色条纹框架标题每张幻灯片上都有方框:

Beamer 中华沙主题的白线

以下是导致我出现该问题的完整演示代码:

\documentclass{beamer}

\usepackage[english]{babel}

\usetheme{Warsaw}

\begin{document}

  \begin{frame}
    \frametitle{Vertical line to the left of the title}

    \begin{itemize}
        \item This slide has a problem
    \end{itemize}

  \end{frame}

\end{document}

这不是预期的行为,对吗?我该如何修复它?

答案1

渐变背景的那部分基本上是由以下代码生成的(beamerouterthemeshadow.sty第 23-25 行)

\pgfdeclarehorizontalshading[frametitle.bg,frametitle right.bg]{beamer@frametitleshade}{\paperheight}{%
  color(0pt)=(frametitle.bg);
  color(\paperwidth)=(frametitle right.bg)}

并在此处应用(第 42-83 行)(参见\pgfuseshading{beamer@frametitleshade}?)

\defbeamertemplate*{frametitle}{shadow theme}
{%
  \nointerlineskip%
  \vskip-2pt%
  \hbox{\leavevmode
    \advance\beamer@leftmargin by -12bp%
    \advance\beamer@rightmargin by -12bp%
    \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by \beamer@leftmargin%
    \advance\beamer@tempdim by \beamer@rightmargin%
    \hskip-\Gm@lmargin\hbox{%
      \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
          \vbox{}\vskip-.75ex%
          \leftskip0.3cm%
          \rightskip0.3cm plus1fil\leavevmode
          \insertframetitle%
          \ifx\insertframesubtitle\@empty%
            \strut\par%
          \else
            \par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
          \fi%
          \nointerlineskip
          \vbox{}%
          \end{minipage}}%
      \beamer@tempdim=\ht\beamer@tempbox%
      \advance\beamer@tempdim by 2pt%
      \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
        \usebeamercolor{frametitle right}
        \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
        \pgfusepath{clip}
        \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
      \end{pgfpicture}
      \hskip-\paperwidth%
      \box\beamer@tempbox%
    }%
    \hskip-\Gm@rmargin%
  }%
  \nointerlineskip
    \vskip-0.2pt
    \hbox to\textwidth{\hskip-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
    \vskip-2pt
}

如您所见,此阴影的宽度与纸张完全相同。同时,它被一个宽度相同的矩形裁剪。虽然从逻辑上讲它足够宽以覆盖白色背景,但这会让 PDF 渲染器非常困惑。

因此,你们都可以扩大阴影

\pgfdeclarehorizontalshading[frametitle.bg,frametitle right.bg]{beamer@frametitleshade}{\paperheight}{%
  color(1pt)=(frametitle.bg);
  color(\paperwidth+1pt)=(frametitle right.bg)}

并注释掉该行\pgfusepath{clip}。现在阴影超出了 PDF 的边界,应该没有问题了。即使问题仍然存在,我也不认为与 TeX 有任何关系。

相关内容