On 2022-11-17 11:17:10 +0100, Vincent Lefevre wrote:
> On 2022-11-16 23:22:27 +0000, Gavin Smith wrote:
> > The square brackets can also be used to mark optional arguments in
> > other programming languages, so it may not be better to change the
> > font for these.
> 
> Since C (including C++) is very common (and its prototype formats
> is used for library interfaces), I think that it would be worth to
> define new commands for it.
> 
> > You can get the regular monospace font with @t:
> > 
> > @deftypefun  int f (char *t@t{[]})
> 
> Unfortunately this hack is broken, because in HTML, it is rendered
> as <tt>[]</tt>, while with @deftypefn, *all* the argument part is
> written without tt and with em (thus in italics). So this makes the
> HTML output inconsistent. However, the issue is rather that tt is
> not used at all with @deftypefn in HTML. IMHO, the style for HTML
> output should be aligned with TeX output, where tt is used.

Well, I'm now using

@iftex
@macro fptt {T}
@tt{\T\}
@end macro
@end iftex
@ifnottex
@macro fptt {T}
\T\
@end macro
@end ifnottex

and @fptt{[]} in function prototypes, but a clean solution would be
much better than this hack.

(The rendering issue for TeX output isn't even documented.)

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to