On Wed, Aug 10, 2022 at 2:49 AM Gavin Smith <gavinsmith0...@gmail.com> wrote:
> > If I do > > > > @inlinefmt{tex, {\rm Ai}(x)} > > > > The output is "\rm Ai(x)" in a normal roman font. > > A workaround is to use a block conditional instead: > > @iftex > @math{{\rm Ai}(x) > @end iftex > > This appears to produces good results but you would have to try it in > your document to be sure. If you don't want an extra space to appear then > you need to use > > @iftex > @math{{\rm Ai}(x)@c > @end iftex > > to comment out the newline. > Ah, this is great! I'd previously been using block conditionals, but there was always an extra space, which meant the inline formulas followed by a period had an extra space. That's why I was thinking of using @inlinefmt for this. And previously I was also doing @tex ${\rm Ai}(x)$ @end tex but @iftex seems nicer. since I can add @math{} around it. > > The reason that the texinfo.tex implementation is flawed is that when > @inlinefmt reads its arguments, \ is not an escape character, and it > is not reinterpreted after checking the conditional. This shows > a possible fix: > > --- a/doc/texinfo.tex > +++ b/doc/texinfo.tex > @@ -3343,7 +3343,7 @@ $$% > \long\def\inlinefmt#1{\doinlinefmt #1,\finish} > \long\def\doinlinefmt#1,#2,\finish{% > \def\inlinefmtname{#1}% > - \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi > + \ifx\inlinefmtname\outfmtnametex \ignorespaces \scantokens{#2}\fi > } > % > % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if > > although I would rather not touch this code if possible. It might be > better just to document the limitation and workaround in the manual. > I think it would be nice if inlinefmt(tex,...) worked, but I'll leave that to you. I have a workaround that is perfectly fine and AFAICT, would work just as well as inlinefmt. -- Ray