1

I try to enable / disable some options for my 3D view with \ifthenelse.

\documentclass[fontsize=12pt,paper=a4]{scrbook}
\usepackage{media9}
\usepackage{graphicx}
\usepackage{ifthen}

\begin{document}
\begin{figure}[H]
\scalebox{.5}{
\includemedia[
width=1\linewidth,
height=0.56\linewidth,
3Daac=60.000001669652114,
3Droll=-37.47084467351308,
3Dc2c=-0.012050606310367584 -0.0156868789345026 0.9998043775558472,
3Dcoo=38.000003814697266 21.499998092651367 -0.7999938726425171,
3Droo=59.6515823704357,
{\ifthenelse{\boolean{myDraft}}{3Dmenu}{}}]
{\includegraphics{./_Images/Transceiver.png}}{./_CAD/TransceiverMC.prc}}
\end{figure}
\end{document}

But I got the error: Unknown option \ifthenelse

How can I enable / disable the 3Dmenu option depending on the myDraft variable? Is there a possibility to set the option outside of the \includemedia call?

EDIT:

I found this question, but I can not handle it in my case.

2

As too long for a comment: The problem probably is that \ifthenelse is not fully expandable.

What might work is to execute the test, storing the new option in a macro, and then adding the option in an \edef:

\def\myopt{}
\ifthenelse{\boolean{myDraft}}{\def\myopt{3Dmenu}}{}
\edef\temp{\unexpanded{
    \includemedia[
    width=1\linewidth,
    height=0.56\linewidth,
    3Daac=60.000001669652114,
    3Droll=-37.47084467351308,
    3Dc2c=-0.012050606310367584 -0.0156868789345026 0.9998043775558472,
    3Dcoo=38.000003814697266 21.499998092651367 -0.7999938726425171,
    3Droo=59.6515823704357,}
    \myopt]
}\temp{\includegraphics{./_Images/Transceiver.png}}{./_CAD/TransceiverMC.prc}
  • Thanks for your reply but it doesn't work 'Paragraph ended before includemedia was complete'. After setting '\expandafter\temp\expandafter{\myopt}' two bracket layers up, it compiles but doesn't create an output. – Passe Jul 16 at 19:47
  • Perfect! Now it works like expected! – Passe Jul 17 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.