
총 페이지 수에 대한 라텍스 수를 설정하려고 합니다.
\newcount\mypagecount
\mypagecount=\insertpresentationendpage
하지만 이렇게 할 때마다 페이지 수를 카운트로 입력하는 대신 총 페이지 수를 자동으로 "인쇄"합니다. 카운트로 설정하는 방법이 있나요?
내가하려는 일이 더 정확하게는 다음과 같습니다.
\newcount\mypagenum
\newcount\mypagecount
\newdimen\barwidth
\mypagenum=\insertpagenumber
\mypagecount=\insertpresentationendpage
\barwidth=\paperwidth
\multiply\barwidth by \mypagenum
\divide\barwidth by \mypagecount
카운터로 시도했지만 오류도 발생했습니다.
\newcounter{mypagecount}
\setcounter{mypagecount}{\insertpresentationendpage}
이 숫자를 사용할 수 없는 경우 마지막에 나눗셈을 수행할 수 있는 방법 및/또는 이 숫자를 실제로 사용하는 방법에 대한 아이디어가 있습니까?
답변1
다음은 기본적으로 의 현재 버전과 동일 하지만 인쇄 \insertpresentationendpage
된 beamer
결과 대신 카운터가 설정되는 방식입니다. 또한 개념 증명 진행률 표시줄 출력도 포함했습니다.
\documentclass[]{beamer}
\newlength\barwidth
\newlength\tmpbarwidth
\newcount\mypagecount
\makeatletter
\newcommand*\progressbar
{%
\ifnum\mypagecount=0
\ifx\beamer@startpageofappendix\@empty
\mypagecount=\beamer@endpageofdocument\relax
\else
\mypagecount=\beamer@startpageofappendix\relax
\advance\mypagecount\m@ne
\fi
\ifnum\mypagecount=0
\global\mypagecount=1
\else
\global\mypagecount=\mypagecount
\fi
\fi
\begingroup
\tmpbarwidth\insertpagenumber\barwidth
\divide\tmpbarwidth\mypagecount
\rule{\tmpbarwidth}{5pt}%
\advance\barwidth-\tmpbarwidth
\textcolor{gray}{\rule{\barwidth}{5pt}}%
\endgroup
}
\makeatother
\setlength\barwidth{5cm}
\begin{document}
\begin{frame}
\progressbar
\end{frame}
\begin{frame}
\progressbar
\end{frame}
\begin{frame}
\progressbar
\end{frame}
\begin{frame}
\progressbar
\end{frame}
\end{document}