1

It appears that there is a problem with the placement of media buttons in RTL text. Consider this MWE:

\documentclass{article}
\usepackage{libertine,media9,polyglossia}
\setdefaultlanguage[variant=british]{english}
\setotherlanguage[]{hebrew}

\begin{document}
\marginpar{\includemedia[
  label=song49,
  activate=pagevisible,
  deactivate=pageinvisible,
  noplaybutton,
  flashvars={source=http://www.kfeuerherm.ca/IntHeb/BBE.mp3&hidebar=true},
  transparent
]{\makebox[1cm]{x}}{APlayer.swf}\mediabutton[mediacommand=song49:playPause,tooltip={Play/Pause}]{(P)}\mediabutton[mediacommand=song49:play[(0.0)],tooltip={Reset}]{(R)}} 
%\begin{RTL}
\mediabutton[
  mediacommand=song49:play[(0.65)],
  mediacommand=song49:pause[(1.45)],
  overface=ONE
]{בראשׁית}
\mediabutton[
  mediacommand=song49:play[(1.8)],
  mediacommand=song49:pause[(2.45)],
  overface=TWO
]{ברא}
\mediabutton[
  mediacommand=song49:play[(2.8)],
  mediacommand=song49:pause[(3.8)],
  overface=THREE
]{אלהים}
%\end{RTL}
\end{document}

This example compiles fine, with or without \texthebrew in the media button label. However, trying to place \texthebrew around the buttons so that the labels will typeset in the correct order, or uncommenting the lines \begin{RTL} and \end{RTL} results in the error "xdvipdfmx:fatal: A pending form XObject at the end of page.”

Can anyone advise on the root of the problem and/or how to get around it?

1

LuaTeX is probably the better option. However, polyglossia loads bidi.sty which is not compatible with LuaTeX.

Fortunately, there is luabidi.sty.

We will have to cheat polyglossia somewhat to load luabidi.sty instead of bidi.sty:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{bidi.sty}
  \ProvidesPackage{bidi}
  \RequirePackage{luabidi}
\end{filecontents*}

\usepackage{libertine,media9,polyglossia}
\setdefaultlanguage[variant=british]{english}
\setotherlanguage[]{hebrew}

\begin{document}
...
\end{document}

Compiling the document with the lualatex command produces a valid PDF, as far as I can judge.

  • Activated LuaTeXmk and I had to use `\texthebrew{}' for the labels. I get a <cr> before the Hebrew, but that may be a matter of tinkering. A greater concern is this new message: "Package polyglossia Warning: Hebrew is not supported with LuaTeX. (polyglossia) I will proceed with the compilation, but (polyglossia) the output is not guaranteed to be correct (polyglossia) and may look very wrong. on input line 6." I will try this on my real file soon and see what happens and report back. @AlexG – K.G. Feuerherm Jul 15 '14 at 15:03
  • @K.G.Feuerherm: At first sight, the output looked ok (I am hebrew illiterate). I didn't use \texthebrew{}, but enabled the RTL environment in the code you provided. – AlexG Jul 15 '14 at 15:14
  • Fair enough, I expected that. Not a big deal ;) I will see how I get on with LuaTex, though the manual warns against using it in a production environment, for now. @AlexG (when I put this at the front, it seems to vanish) – K.G. Feuerherm Jul 15 '14 at 23:17
  • I have attempted this trick with my large production file. @Alex Initally, lualatexmk went into a loop, but using Libertine OTF fonts rather than TTF solved that. I have checked the output, and so far, it seems to work. I will call this tentatively solved. – K.G. Feuerherm Jul 29 '14 at 23:35
  • Additional note: the last was a red herring; infinite loop happened again since. I determined that having \usepackage{libertine} was incompatible with later having \setmainfont or \setsansfontto Libertine fonts. This did not happen with XeTeX compiles. – K.G. Feuerherm Aug 6 '14 at 18:25
0

The solution proposed above by @AlexG broke in early October 2014. In response to a request on the XeTeX list, @David Carlisle has offered a correction to the original code which solves the problem without resorting to a tricky kludge. The relevant section of code is replaced by the following:

\begin{hebrew}
\textenglish{\mediabutton[
  mediacommand=song49:play[(0.65)],
  mediacommand=song49:pause[(1.45)],
  overface=ONE
]{\texthebrew{בראשׁית}}}
\textenglish{\mediabutton[
  mediacommand=song49:play[(1.8)],
  mediacommand=song49:pause[(2.45)],
  overface=TWO
]{\texthebrew{ברא}}}
\textenglish{\mediabutton[
  mediacommand=song49:play[(2.8)],
  mediacommand=song49:pause[(3.8)],
  overface=THREE
]{\texthebrew{אלהים}}}
\end{hebrew}

This isolates the RTL to the actual Hebrew text while maintaining LTR for the purpose of the media button commands.

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.