help-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-texinfo] trying to make a unicode math char appear in all form


From: Gavin Smith
Subject: Re: [help-texinfo] trying to make a unicode math char appear in all formats
Date: Thu, 10 Dec 2015 19:08:15 +0000

On 10 December 2015 at 13:25, Paul Jakma <address@hidden> wrote:
> Hi,
>
> I want to use the unicode 'precedes' math symbol, ≺, 0x227A, in a TeXinfo
> document. If I type @math{\prec} it will appear in PDF, but I get \prec in
> most other output formats. If I type @math{≺} then I get it in at least the
> text format, but not in the PDF - presumably because texinfo is using the
> non-UTF8 capable pdftex (??).
>
> So I tried to create a macro to conditionally use the appropriate method.
> However, I couldn't get that work either.
>
> @macro prec{}
> @iftex
> @math{\prec}
> @end iftex
> @ifnottex
>
> @end ifnottex
> @end macro

The following works

\input texinfo

@c @tracingmacros=1

@iftex
@macro precb{}
@math{\\prec}
@end macro
@end iftex
@ifnottex
@macro precb{}
≺
@end macro
@end ifnottex

address@hidden


@bye

Note the backslash before prec in the macro body has to be escaped
with another backslash. I inverted the nesting of the macro and
conditional here.

Note also that you can't do @macro prec because @prec is already
defined as a control sequence.

Doing it the other way around:

@macro precb{}
@iftex
@math{\\prec}
@end iftex
@ifnottex
≺
@end ifnottex
@end macro

address@hidden

Has two problems:
* When processed with TeX, there is a space at the end from the
newline inside the conditional blocks
* When processed with texi2any, there are errors:
prec-2:14: warning: @iftex should only appear at a line beginning
(possibly involving @precb)
prec-2:14: warning: unknown @end ifnottexb (possibly involving @precb)
prec-2:17: expected @end ifnottex

It might be possible to use inline conditionals inside a macro, but I
didn't try.

>
> I also tried to define a macro as follows:
>
> @macro precb{}
> @inlinefmtifelse{tex,@tex \ensuremath{\prec} @end tex, ≺}
> @end macro
>
> but that fails to compile (and trying to escape the \ in various ways didn't
> fix it).

The "@tex" and "@end tex" lines have to be on lines by themselves. Any
backslashes in a macro body should be doubled, as well.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]