비머 헤드라인을 재설정하는 동안 `\setbox`에 대한 기호에 대한 "정의되지 않은 제어 시퀀스" 오류

비머 헤드라인을 재설정하는 동안 `\setbox`에 대한 기호에 대한 "정의되지 않은 제어 시퀀스" 오류

infolines내 비머 프레젠테이션에서는 외부 테마의 각주와 외부 테마의 헤더 라인을 갖고 싶었지만 tree첫 번째 줄에 제목 대신 부제목이 표시되도록 했습니다. 그래서 저는 infolines외부테마로 삼고 \setbeamertemplate[headline]복사를 했습니다 beamerouterthemetree.sty. 작동하고 컴파일되지만 마음에 들지 않아 다음과 같은 오류가 발생합니다.

ERROR: Undefined control sequence.

--- TeX said ---
\beamer@@tmpl@headline .../foot} \setbox \tempbox 
                                                  =\hbox {\insertsectionhead...
l.108 \begin{document}

--- HELP ---
TeX encountered an unknown command name. You probably misspelled the
name. If this message occurs when a LaTeX command is being processed,
the command is probably in the wrong place---for example, the error
can be produced by an \item command that's not inside a list-making
environment. The error can also be caused by a missing \documentclass
command.

내 (제거된/epured) 코드는 다음과 같습니다.

\documentclass{beamer}

\usepackage{ragged2e}
\usepackage{etoolbox}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,shapes}
\apptocmd{\enumerate}{\justifying}{}{}
\apptocmd{\itemize}{\justifying}{}{}
\addtobeamertemplate{block begin}{}{\justifying}

\usetheme{default}
\usecolortheme{beaver}
\useoutertheme{infolines}
\useinnertheme{default}
\setbeamertemplate{sections/subsections in toc}[square]
\setbeamercolor{titlelike}{bg=darkred,fg=gray!15!white}
\setbeamercolor{frametitle}{fg=darkred}
\setbeamercolor{item}{fg=darkred}
\setbeamercolor{author in head/foot}{bg=darkred,fg=gray!5!white}

\setbeamertemplate{headline}
{%
    \begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{upper separation line head}
    \end{beamercolorbox}
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}
      \usebeamerfont{title in head/foot}\insertshortsubtitle
    \end{beamercolorbox}
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
      \usebeamerfont{section in head/foot}
      \setbox\tempbox=\hbox{\insertsectionhead}%
      \ifdim\wd\tempbox>1pt%
        \hskip2pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
        \hskip1pt%
      \fi%
      \insertsectionhead
    \end{beamercolorbox}
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
      \usebeamerfont{subsection in head/foot}
      \setbox\tempbox=\hbox{\insertsubsectionhead}%
      \ifdim\wd\tempbox>1pt%
        \hskip9.4pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
        \hskip1pt%
      \fi%
      \insertsubsectionhead
    \end{beamercolorbox}
    \begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{lower separation line head}
    \end{beamercolorbox}
}

\title{My (short) title}
\subtitle{Yet longer and not shortable subtitle}
\institute[SIN]{Long Long Long Long Long Long Institute Name}
\author[S. Name \and S. Name]{Name \textsc{Long} \and Name \textsc{Long}}
\justifying
\begin{document}

\frame[plain]{\titlepage}

\begin{frame}
  \frametitle{Plan}
  \tableofcontents[pausesections,subsectionstyle=shaded]
\end{frame}

\end{document}

답변1

상자를 할당해야하므로 그렇게하십시오.

\newsavebox{\tempbox}

Beamer의 임시 상자 등록기를 사용하려면 다음을 수행하십시오.

\makeatletter
\setbeamertemplate{headline}
{%
    \begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{upper separation line head}
    \end{beamercolorbox}
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}
      \usebeamerfont{title in head/foot}\insertshortsubtitle
    \end{beamercolorbox}
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
      \usebeamerfont{section in head/foot}
      \sbox\beamer@tempbox{\insertsectionhead}%
      \ifdim\wd\beamer@tempbox>1pt
        \hskip2pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
        \hskip1pt
      \fi
      \insertsectionhead
    \end{beamercolorbox}
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
      \usebeamerfont{subsection in head/foot}
      \sbox\beamer@tempbox{\insertsubsectionhead}%
      \ifdim\wd\beamer@tempbox>1pt
        \hskip9.4pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
        \hskip1pt
      \fi
      \insertsubsectionhead
    \end{beamercolorbox}
    \begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{lower separation line head}
    \end{beamercolorbox}
}
\makeatother

다음을 사용하여 코드를 수정했습니다.

\sbox\beamer@tempbox{\insertsectionhead}%

\setbox\beamer@tempbox=\hbox{\insertsectionhead}이것은 "색상을 인식"하지만 그렇지 않기 때문에 올바른 명령입니다 .

따라서 어떤 방법을 선택하든 \sbox.

관련 정보