On Wed, Aug 10, 2022 at 7:43 AM Raymond Toy <[email protected]> wrote:
>
> 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.
>
Ah, not quite. With the @c, any following spaces get swallowed. What I
have is something like
The Airy functions
@ifhtml
@math{{\rm Ai}(x)}@c
@end ifhtml
@ifinfo
@math{Ai(x)}@c
@end ifinfo
@iftex
@math{{\rm Ai}(x)}@c
@end iftex
and
This gets rendered in the pdf as "y = Ai(x)and". No space between the
function and "and". The block for the formula is generated by an m4 macro.
(I couldn't get a texinfo macro to do what I wanted. Maybe because I was
too stupid or because I was using a fairly old version when I tried.)
Anyway, this is a nice path forward and I know how I can swallow the
trailing space if needed when the formula is followed by a period or other
punctuation.
> 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
>
--
Ray