Beamer 类和 U3D 视图

Beamer 类和 U3D 视图

我想在演示文稿中切换 3D 视图。我在 movie15 包中读到,使用以下命令即可实现:(movie15.pdf 第 16 页中的骰子示例)

\movieref[3Dviewindex=N]{dice}{Click here}

但在这种情况下,我必须用鼠标单击按钮。是否可以将命令绑定到键上或通过键调用按钮,或者将其与命令 \pause 结合使用?

问候,

隆重。

答案1

首先,不要movie15再使用了。包装media9是为了替换它。

我们可以使用 PDF 功能子页面导航GoTo3DView动作绑定到左 <- 和 右 -->键盘按键事件。只有执行完完整的操作序列后,阅读器才会继续阅读下一个/上一个文档页面。

请注意,此功能需要全屏模式。

以下代码定义了一个命令\ThreeDPresSteps,该命令以逗号分隔的对列表{<3D label>,<number of views>}作为其参数。(对两侧必须使用括号,即使只有一对也是如此。)

\ThreeDPresSteps{...}用在包含 3D 对象的框架代码之前。命令引用的 3D 对象的视图将按照视图文件指定的顺序以及命令参数中beamer的 s 顺序进行查看。<3D label>

请记住,只有左右箭头键可让您在页面内的演示步骤之间双向导航。其他箭头键和 PgUp/PgDn 键仅可向前导航(Linux 为 AR-9)。

...

% initialise 3D presentation steps for the next frame
\ThreeDPresSteps{{3DobjA,7},{3DobjB,5}}

\begin{frame}{...}
   \includemedia[label=3DobjA,3Dviews=3DviewsA.txt,...]{...}{...}
   \includemedia[label=3DobjB,3Dviews=3DviewsB.txt,...]{...}{...}
\end{frame}

% clear 3D presentation steps before next frame
\ThreeDPresStepsReset

...

最小示例两个 3D 对象(2 xdice.u3d)在投影仪框架中:

\documentclass{beamer}
\usepackage{media9}[2015/11/02]

%write file with 7 predefined 3D views
\usepackage{filecontents}
\begin{filecontents*}{3Dviews.txt}
VIEW=Front
  ROO=27
END
VIEW=Back
  ROO=27
  C2C=0 1 0
END
VIEW=Left
  ROO=27
  C2C=-1 0 0
END
VIEW=Right
  ROO=27
  C2C=1 0 0
END
VIEW=Top
  ROO=27
  C2C=0 0 1
END
VIEW=Bottom
  ROO=27
  C2C=0 0 -1
END
VIEW=Fish Eye at Centre
  AAC=130
END
\end{filecontents*}

\ExplSyntaxOn
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% command to build presentation steps for navigating through 3D views
% Argument: comma separated list of {label,number of views} pairs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\ThreeDPresSteps[1]{
  \tl_set:Nn\l_initactn_tl{}
  \clist_map_inline:nn{#1}{\tl_if_exist:cT{ann@\clist_item:nn{##1}{1}}{
    \pbs_pdfobj:nnn{}{dict}{ %init. actions for all 3D objects -> goto 1st view
      /S/GoTo3DView/V~0/TA~\use:c{ann@\clist_item:nn{##1}{1}}
    }
    \tl_put_right:Nx\l_initactn_tl{~\pbs_pdflastobj:}
  }}
  \pbs_pdfobj:nnn{}{dict}{} %reserve pdf obj for the `Next' nav. node
  \tl_set:Nx\l_nextnode_tl{\pbs_pdflastobj:}
  %primary nav. node, initialise all 3D objects in the page
  \pbs_pdfobj:nnn{}{dict}{
    /NA<</S/Named/N/NOP/Next[\l_initactn_tl]>>/Next~\l_nextnode_tl
  }
  \tl_set:Nn\l_prevactn_tl{}\tl_set:Nx\l_prevnode_tl{/Prev~\pbs_pdflastobj:}
  \tl_set_eq:NN\l_currnode_tl\l_nextnode_tl
  %register primary navigation node of this page
  \sys_if_output_pdf:TF{
    \edef\pdfpageattrsave{\the\pdfpageattr}
    \tl_set:Nx\l_temp_tl{\pdfpageattrsave/PresSteps~\pbs_pdflastobj:}
    \immediate\pdfpageattr\exp_after:wN{\l_temp_tl}
  }{
    \bool_if:NTF\g_pbs_dvipdfmx_bool{ %dvipdfmx/XeTeX
      \special{pdf:put~@thispage <</PresSteps~\pbs_pdflastobj:>>~}
    }{
      \special{ps:~
        mark~{ThisPage}~<</PresSteps~\pbs_pdflastobj:>>/PUT~pdfmark~
      }
    }
  }
  %build doubly linked list of navigation nodes
  \clist_map_inline:nn{#1}{
    \tl_if_exist:cT{ann@\clist_item:nn{##1}{1}}{
      \int_step_inline:nnnn{1}{1}{\int_eval:n{\clist_item:nn{##1}{2}-1}}{
        \pbs_pdfobj:nnn{}{dict}{} %reserve pdf obj for the `Next' nav. node
        \tl_set:Nx\l_nextnode_tl{\pbs_pdflastobj:}
        \pbs_pdfobj:nnn{\l_currnode_tl}{dict}{ %current navigation node
          \l_prevactn_tl\l_prevnode_tl
          /NA<</S/GoTo3DView/V/N/TA~\use:c{ann@\clist_item:nn{##1}{1}}>>
          /Next~\l_nextnode_tl
        }
        \tl_set:Nx\l_prevactn_tl{
          /PA<</S/GoTo3DView/V/P/TA~\use:c{ann@\clist_item:nn{##1}{1}}>>}
        \tl_set:Nx\l_prevnode_tl{/Prev~\pbs_pdflastobj:}
        \tl_set_eq:NN\l_currnode_tl\l_nextnode_tl
      } 
    }
  }
  %final navigation node
  \pbs_pdfobj:nnn{\l_currnode_tl}{dict}{\l_prevactn_tl\l_prevnode_tl}
}
\newcommand\ThreeDPresStepsReset{ %cmd for resetting pres. steps
  \bool_if:nT{
    \sys_if_output_pdf_p: && \cs_if_exist_p:N\pdfpageattrsave}{
    \immediate\pdfpageattr\exp_after:wN{\pdfpageattrsave}}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother
\ExplSyntaxOff

\begin{document}

\begin{frame}{Intro}
  Put the Reader into \Acrobatmenu{FullScreen}{\color{blue}Full Screen Mode} first!
\end{frame}

% initialise 3D presentation steps for the next frame
\ThreeDPresSteps{{diceA,7},{diceB,7}}

\begin{frame}{Go forth and back through 3D views using $\leftarrow$ and $\rightarrow$}
\centering

  \includemedia[
    label=diceA,
    width=0.3\textheight,height=0.3\textheight,
    activate=pageopen,deactivate=pageclose,
    3Dviews=3Dviews.txt,
  ]{}{dice.U3D}
  \includemedia[
    label=diceB,
    width=0.3\textheight,height=0.3\textheight,
    activate=pageopen,deactivate=pageclose,
    3Dviews=3Dviews.txt,
  ]{}{dice.U3D}

\end{frame}

% clear 3D presentation steps
\ThreeDPresStepsReset

\begin{frame}{The End}
  \dots
\end{frame}

\end{document}

相关内容