I would like to use the following luacode (follow-up from this post):
\usepackage{luacode}
\begin{luacode*}
function replace_punc ( buff )
if string.find ( buff , "\\gla" ) then
buff = string.gsub ( buff , " (``)" ,
"\\nogloss{%1} @ " )
buff = string.gsub ( buff, "([:.,;'!?]+)( )" ,
" @ \\nogloss{%1}%2" )
end
return ( buff )
end
luatexbase.add_to_callback ( "process_input_buffer", replace_punc, "replace_punc" )
\end{luacode*}
Its purpose is to automate \nogloss.
It works with LuaLaTeX, but my whole document is set up with polyglossia, which is incompatible with LuaLaTeX. @alanmunn mentioned that the above code could work with XeLaTeX if I use the luabidi package. I have played around with luabidi without success.
I would like the above code to work in XeLaTex with the following MWE:
\documentclass{book}
\usepackage{expex}
\usepackage{polyglossia}
\usepackage{fontenc}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{FrankRuehl}
\newfontfamily\englishfont{Linux Libertine O}
\lingset{everygla=\Large,glwordalign=center}
\begin{document}
\begin{hebrew}
\begingl
\gla "שלום {קוראים לי} דוד." //
\glb shalom \textenglish{korim li} david//
\glc Hello \textenglish{my name is} David//
\endgl
\begingl
\gla "מה נשמע דוד?" //
\glb ma nishma david //
\glc what \textenglish{is heard} David //
\endgl
\begingl
\gla "יום טוב!" //
\glb yom tov //
\glc day good //
\endgl
\end{hebrew}
\end{document}
luabidi. That package is a designed to allow RTL typesetting with LuaTeX; it has nothing to do with allowing lua code to be used in XeTeX (which will not happen). So the question really is "How do I useluabidias a replacement for thebidipackage as loaded withpolyglossiaso that I can compile RTL documents with LuaTeX". – Alan Munn Jul 31 '17 at 13:34polyglossiainto usingluabidiinstead. – Alan Munn Jul 31 '17 at 13:43luabidicomment and my inability to get @ulrikefischer's code to work, I'm not sure this question is worth keeping around. Feel free to delete. Thanks all for your effort. – AML Aug 01 '17 at 12:05