\writecontentsline 미스터리를 풀어보세요

\writecontentsline 미스터리를 풀어보세요

\adcontentsline다음 과 유사한 매크로를 프로그래밍하려고 합니다 \immediate\write.

\frameEntry{\insertframenumber}{\inserframetitle \}{\thepage} 

잘못된 페이지 번호를 기록합니다. 반대로 \write페이지가 발송되는 시점으로 미루면 오답 \insertpagenumber과 오답이 \insertpagetitle기록됩니다.

article추가 내용: 저는 모드 에서 수백 개의 슬라이드 세트 에디션을 생성할 목적으로 목차에 대한 작은 매크로 세트를 작성하는 작업을 하고 있습니다. 문제는 목차 스타일로 각 프레임 바로 뒤에 프레임 목록을 생성하는 것입니다 \subsection.

minitoc및 같은 패키지가 titletoc작동하지 않았습니다. 전자는 목차 작성을 거부하기 때문이고 후자는 hyperref.

답변1

패키지에톡클래스 와 호환되지 않습니다 beamer.

그러나 모드, 즉 클래스 및 패키지와 함께 beamer사용되는 경우에는 적용 가능합니다.articlearticlebeamerarticleetoc

\documentclass{article}
\usepackage{beamerarticle}
\usepackage{etoc}
% section=1, subsection=2, subsubsection=3
\etocsetlevel {beamerframe}{6}% dummy, a priori invisible, level
\etocsettocdepth {all}

% Earlier provisory code by jfbu
% \let\oldframetitle \frametitle
% \renewcommand\frametitle [1]{%
%              \etoctoccontentsline{beamerframe}{#1}%
%              \oldframetitle {#1}%
% }
%%%%

% Better code by Yossi Gil
% Override action when frame title is encountered:
\setbeamertemplate{frametitle}{%
   \paragraph{\insertframenumber.~\insertframetitle}\\
   \noindent\emph{\insertframesubtitle}\par
   \etoctoccontentsline{beamerframe}{\insertframenumber.~\insertframetitle}%
} 
%%%%

% Command to list frames in a sub-section:
\newcommand\listofframesinsubsection {\begingroup
  % we are going to list one frame per line, with dots up to the page number,
  % this is the default etoc design for subsections, we thus need to set the
  % level of a beamerframe to 2. But then we need to artificially move up the
  % leve of subsection so that \localtableofcontents does see the beamerframes
  % as sub levels of a subsection
    \etocsetlevel {subsection}{1}% artificially pretending subsections are
                                % sections  one up the level
    \etocsetlevel {beamerframe}{2}% pretending beamerframes are subsections
    \etoctoclines % use the styles defined by \etocsetstyle, or here, as we
                  % didn't make any use of \etocsetstyle, just defaults
                  % to the package default styles (which are convenient for
                  % us here.)
    \etocsettocstyle {\noindent Frames in this subsection:\par}{}%
    \etocsetnexttocdepth {beamerframe}%
    \localtableofcontents
\endgroup % clean up all our mess for the next \localtableofcontents  not to
          % be affected and proceed in compatibility mode with the same
          % default design as in article class
}

\begin{document}

\etocsetnexttocdepth {subsection}
\tableofcontents

  \section{Some frames}

%\etocsettocstyle{\subsection*{Local contents:}}{}
\etocsettocstyle {}{}
\etocsetnexttocdepth {subsection}
 \localtableofcontents 

\subsection {first subsection}
\listofframesinsubsection

\begin{frame}\frametitle{AHK}
  Ah Ah 
\end{frame}

\begin{frame}\frametitle{AHJ}
  Oh Oh
\end{frame}

\subsection {second subsection}
\listofframesinsubsection

\begin{frame}\frametitle{HBZ}
  Ah Ah 
\end{frame}

\begin{frame}\frametitle{HBW}
  Oh Oh
\end{frame}

  \section{More frames}

%\etocsettocstyle{\subsection*{Local contents:}}{}
\etocsettocstyle {}{}
\etocsetnexttocdepth {subsection}
 \localtableofcontents 


\subsection {third subsection}
\listofframesinsubsection

\begin{frame}\frametitle{BHK}
  Ah Ah 
\end{frame}

\begin{frame}\frametitle{BHJ}
  Oh Oh
\end{frame}

\subsection {fourth subsection}
\listofframesinsubsection


\begin{frame}\frametitle{BBZ}
  Ah Ah 
\end{frame}

\begin{frame}\frametitle{BBW}
  Oh Oh
\end{frame}

\end{document}

(업데이트된 코드에 추가된 프레임 번호 삽입을 반영하기 위해 이미지가 다시 생성되었습니다.)

참고: 위 코드에서 프레임은 단락을 선언합니다. 하위 섹션에서 만나는 유일한 단락이 프레임과 이러한 방식으로 연관되어 있는 경우 서문을 단순화할 수 있으므로 beamerframe에 대한 섹션화 수준을 정의할 필요가 없습니다 etoc. 다음은 간소화된 서문입니다(문서가 이미 이전 서문으로 컴파일된 경우 보조 파일을 삭제하거나 첫 번째 컴파일 시 오류를 무시하고 두 번만 컴파일해야 합니다).

\documentclass{article}
\usepackage{beamerarticle}
\usepackage{etoc}
% section=1, subsection=2, subsubsection=3
\etocsettocdepth {all}

\setbeamertemplate{frametitle}{%
   \paragraph{\insertframenumber.~\insertframetitle}\\
   \noindent\emph{\insertframesubtitle}\par
} 

% Command to list frames in a sub-section:
\newcommand\listofframesinsubsection {\begingroup
    \etocsetlevel {subsection}{1}% pretending subsections are sections
    \etocsetlevel {paragraph}{2}% pretending paragraphs are subsections
    \etoctoclines % allows to use the package default styles for subsections
    \etocsettocstyle {\noindent Frames in this subsection:\par}{}%
    \etocsetnexttocdepth {paragraph}%
    \localtableofcontents
\endgroup 
}

Beamer를 사용한 etoc기사 페이지 1 Beamer를 사용한 etoc기사 페이지 2


[YG:]

위의 명령은 가 아닌 다른 모드에서는 작동하지 않습니다 article. 이러한 이유로 \mode{위의 대부분의 전문 에서 위의 내용을 보호하는 것이 가장 좋습니다 }.

또 다른 모범 사례는 기사와 슬라이드 모드에 대해 두 개의 별도 포함 파일을 사용하는 것입니다. 이 두 파일 모두 \input실제 프레임이 있는 파일이어야 합니다. 이것이 당신이 하는 일이라면 그러한 보호가 필요하지 않습니다.

관련 정보