Will Robertson wrote: > On 2010-09-25 09:33:20 +0930, Gareth Hughes <garzoh...@gmail.com> said: > >> Will Robertson wrote: >>> It doesn't seem to. In that case I'd write something like >>> >>> \let\oldemph\emph >>> \renewcommand\emph{% >>> \...@rtl \expandafter\aemph \else \expandafter\oldelse \fi >>> } >> >> I still can't figure out how to do this for \eminnershape as defined in >> fixltx2e. Any suggestions how to do that? > > Do you mean so that you can write > > \aemph{ ... \aemph{ ...} ... } > > and have the inner \aemph not put the overline on top? In this case, you > can write (and this might be a reasonable addition to polyglossia) > > \documentclass{article} > \makeatletter > \def\aemph#1{% > \begingroup > \let\aemph\inneraemph > $\overline{\hbox{#1}}$% > \endgroup > } > \def\inneraemph#1{% > \egroup% close \hbox > \egroup% close \overline > $% close math > {\eminnershape #1}% inner emphasis! > $% "reopen" math > \expandafter\overline\bgroup % "reopen" \overline > \hbox\bgroup % "reopen" \hbox > } > \makeatother > \begin{document} > hello there \aemph{foo \aemph{oof rab} bar} baz black > \end{document} > > Modulo checks for bidi and using \hboxR instead of \hbox and a "correct" > definition for \eminnershape in this context, and so on. But this has > nothing to do with the idea of \eminnershape: if you want to tie the two > together, fontspec actually overrides fixltx2e's emph/eminnershape code: > > \ExplSynaxOn > \DeclareRobustCommand \em { > \...@nomath\em > \tl_if_eq:xxTF \...@shape \itdefault \eminnershape > { > \tl_if_eq:xxTF \...@shape \sldefault \eminnershape \emshape > } > } > \DeclareTextFontCommand{\emph}{\em} > \cs_set_eq:NN \emshape \itshape > \cs_set_eq:NN \eminnershape \upshape > \ExplSyntaxOff > > Not sure if that helps directly... > > Will
That is really interesting. My understanding of plain TeX is getting better, but still rudimentary. The Expl3 stuff is beyond me at the moment. I'm trying to write a package for writing Syriac under XeLaTeX, and part of it is to allow the end user some simple commands to redefine emphasis and inner emphasis for Syriac text. These might be changing text colour (common in manuscripts), putting dots around text, overlining (\aemph), changing the font style (using a Syriac style called Estrangelo) etc. I think I'm trying to do too much, but I think it's possible. My muddled and messy code is shown below. Any help greatly appreciated. Thanks, Gareth. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{Emphasis styles} % \begin{macro}{\emphcolour} % \begin{macro}{\emphstyle} % Define commands for changing emphasis. % \begin{macrocode} \newcommand\emphcolour{\crimson} \newcommand\...@emphestr{\ifdef{\estrfont}{\renewcommand\emshape{\estrfont}}% {\renewcommand\emshape{\syriacfont}}} \newcommand\...@emphaemph{% \let\oldemph\emph \renewcommand\emph{% \...@rtl \expandafter\aemph \else \expandafter\oldemph \fi}} \newcommand\...@emphred{\let\oldemph\emph \renewcommand\emph{...@rtl \expandafter\emphcolour % \else \expandafter\oldemph \fi}} \newlength{\...@dashwidth}\setlength{\dashdash}{.075em}\setlength{\fboxsep}{.15em} \newcommand\...@dashbox[1]{\settowidth{\xsy@dashwidth}{#1}% \addtolength{\...@dashwidth}{.15em}\dashbox[\xsy@dashwidth][c]{#1}} \newcommand\...@emphdash{\let\oldemph\emph \renewcommand\emph{...@rtl \expandafter\...@dashbox % \else \expandafter\oldemph \fi}} \newcommand\emphstyle[1]{% \ifstrequal{#1}{italic}{\renewcommand\emshape{\itshape}}{}% \ifstrequal{#1}{overline}{\...@emphaemph}{}% \ifstrequal{#1}{red}{\...@emphred}{}% \ifstrequal{#1}{estr}{\...@emphestr}{}% \ifstrequal{#1}{estrangelo}{\...@emphestr}{}% \ifstrequal{#1}{estrangela}{\...@emphestr}{}% \ifstrequal{#1}{slanted}{% \renewcommand\emshape{\addfontfeature{AutoFakeSlant=-0.3}\slshape}}{}% \ifstrequal{#1}{outline}{\renewcommand\emshape{\outlshape}}{}% \ifstrequal{#1}{dotted}{\...@emphdash}{}} % \end{macrocode} % \end{macro}\end{macro} % \begin{macro}{\inneremphcolour} % \begin{macro}{\inneremphstyle} % Define commands for changing inner emphasis. % \begin{macrocode} \newcommand\inneremphcolour{\gold} \newcommand\...@inneremphestr{\ifdef{\estrfont}% {\renewcommand\eminnershape{\estrfont}}% {\renewcommand\eminnershape{\syriacfont}}} \newcommand\...@inneremphaemph{% \let\oldeminnershape\eminnershape \renewcommand\eminnershape{% \...@rtl \expandafter\aemph \else \oldeminnershape \fi}} \newcommand\...@inneremphred{\let\oldeminnershape\eminnershape \renewcommand\eminnershape{...@rtl \inneremphcolour % \else \oldeminnershape \fi}} \newcommand\...@inneremphdash{\let\oldemph\emph \renewcommand\emph{...@rtl \expandafter\...@dashbox % \else \expandafter\oldemph \fi}} \newcommand\inneremphstyle[1]{% \ifstrequal{#1}{italic}{\renewcommand\eminnershape{\itshape}}{}% \ifstrequal{#1}{overline}{\...@inneremphaemph}{}% \ifstrequal{#1}{red}{\...@inneremphred}{}% \ifstrequal{#1}{estr}{\...@inneremphestr}{}% \ifstrequal{#1}{estrangelo}{\...@inneremphestr}{}% \ifstrequal{#1}{estrangela}{\...@inneremphestr}{}% \ifstrequal{#1}{slanted}{% \renewcommand\eminnershape{\addfontfeature{AutoFakeSlant=-0.3}\slshape}}{}% \ifstrequal{#1}{outline}{\renewcommand\eminnershape{\outlshape}}{}% \ifstrequal{#1}{dotted}{\...@inneremphdash}{}} % \end{macrocode} % \end{macro}\end{macro} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex