On 2022-10-25 14:42:20 +0100, Gavin Smith wrote: > On Tue, Oct 25, 2022 at 02:41:48PM +0200, Vincent Lefevre wrote: > > @w doesn't work correctly in math mode: > > > > ------------------------------------------------------------ > > \input texinfo @c -*-texinfo-*- > > @documentencoding UTF-8 > > > > @node Top > > @node Test > > > > Formatting test. > > > > zzzzzzzzzzzzzzzzzz @math{a + b} > > zzzzzzzzzzzzzzzzzz @math{a + b} > > zzzzzzzzzzzzzzzzzz @math{a + b} > > zzzzzzzzzzzzzzzzzz @math{a + b} > > zzzzzzzzzzzzzzzzzz @math{a + b} > > zzzzzzzzzzzzzzzzzz @math{a + b} > > zzzzzzzzzzzzzzzzzz @math{a + b} > > zzzzzzzzzzzzzzzzzz @math{a + b} > > > > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > > > > @bye > > ------------------------------------------------------------ > > > > One can see that with @w, spaces do not stretch. > > Yes, but I wouldn't count this as "incorrect".
Perhaps not incorrect, but this can give an inconsistent style if an author does not always use @w (and I don't think that such an author is to blame, as @w is not supposed to change the style except forbidding line breaks). > Note if you want a fair comparison, you should have the same paragraph > indent in both paragraphs, using @noindent: > > @noindent > zzzzzzzzzzzzzzzzzz @math{a + b} > zzzzzzzzzzzzzzzzzz @math{a + b} > zzzzzzzzzzzzzzzzzz @math{a + b} > zzzzzzzzzzzzzzzzzz @math{a + b} > zzzzzzzzzzzzzzzzzz @math{a + b} > zzzzzzzzzzzzzzzzzz @math{a + b} > zzzzzzzzzzzzzzzzzz @math{a + b} > zzzzzzzzzzzzzzzzzz @math{a + b} > > @noindent > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} > zzzzzzzzzzzzzzzzzz @w{@math{a + b}} Paragraphs except the first one ("Formatting test." above; did you see it?) are expected to use the same indentation rule. So the @noindent should not be necessary for the comparison. > Note it is not an issue with @math, but with @w generally, as you > can see with the following input: > > @noindent > zzzzzzzzzzzzzzzzzz @asis{a + b} > zzzzzzzzzzzzzzzzzz @asis{a + b} > zzzzzzzzzzzzzzzzzz @asis{a + b} > zzzzzzzzzzzzzzzzzz @asis{a + b} > zzzzzzzzzzzzzzzzzz @asis{a + b} > zzzzzzzzzzzzzzzzzz @asis{a + b} > zzzzzzzzzzzzzzzzzz @asis{a + b} > zzzzzzzzzzzzzzzzzz @asis{a + b} > > @noindent > zzzzzzzzzzzzzzzzzz @w{@asis{a + b}} > zzzzzzzzzzzzzzzzzz @w{@asis{a + b}} > zzzzzzzzzzzzzzzzzz @w{@asis{a + b}} > zzzzzzzzzzzzzzzzzz @w{@asis{a + b}} > zzzzzzzzzzzzzzzzzz @w{@asis{a + b}} > zzzzzzzzzzzzzzzzzz @w{@asis{a + b}} > zzzzzzzzzzzzzzzzzz @w{@asis{a + b}} > zzzzzzzzzzzzzzzzzz @w{@asis{a + b}} > > In theory, there could be better output if we could change the size > of spaces inside of @w, but I doubt that there is a good way of > achieving this in TeX. I had looked at tex.stackexchange.com and found https://tex.stackexchange.com/questions/574783/stretch-spaces-within-a-box but the accepted answer seems incorrect, or not answering the general issue. In the comments: @DonaldArseneau IMO if the only reason for wanting it to remain boxed is to prevent line breaks, then maybe one could also insert huge penalties everywhere. (Or I imagine one could do something fancy in LuaTeX with whatsits or whatever, that does a post-linebreak check to see whether there has been a line break “inside”.) – ShreevatsaR @ShreevatsaR Yes, exactly what I think. Package nolbreaks.sty does the penalties in a LaTeX context. To do literal adjustment of spaces in a box, one could reset the box in certain contexts, but paragraphs are very difficult. The only potential, I think, is with some luaTeX post-processing of the nodes. – Donald Arseneau So https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/nolbreaks/nolbreaks.sty might be a solution if applicable in the context of Texinfo (it is quite short and in the public domain, so it could be adapted if need be). > Is there actually anything wrong with the way the output looks for > your document? I don't think so, but the solution should remain valid in the future. That said, for the MPFR manual, using a macro without @w for TeX and with @w for the other outputs should not be an issue. The good thing is that TeX does not seem to introduce line breaks in math formulas if they are not really necessary. Well, I had noticed in the past that the default was not perfect, IMHO, but \binoppenalty=10000 \relpenalty=10000 solved the issue in all my LaTeX documents. However, for the Info output at least (and I assume that this is also the case for the HTML output), @w is really necessary. See the differences: @@ -1586,8 +1586,8 @@ mpfr_rnd_t RND) Set ROP to the square root of OP rounded in the direction RND. Set ROP to −0 if OP is −0, to be consistent with the IEEE 754 standard - (thus this differs from ‘mpfr_rootn_ui’ and ‘mpfr_rootn_si’ with N - = 2). Set ROP to NaN if OP is negative. + (thus this differs from ‘mpfr_rootn_ui’ and ‘mpfr_rootn_si’ with + N = 2). Set ROP to NaN if OP is negative. -- Function: int mpfr_rec_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) Set ROP to the reciprocal square root of OP rounded in the @@ -1595,8 +1595,8 @@ NaN if OP is negative. Warning! Therefore the result on −0 is different from the one of the rSqrt function recommended by the IEEE 754 standard (Section 9.2.1), which is −Inf instead of +Inf. - However, ‘mpfr_rec_sqrt’ is equivalent to ‘mpfr_rootn_si’ with N = - -2. + However, ‘mpfr_rec_sqrt’ is equivalent to ‘mpfr_rootn_si’ with + N = −2. -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) -- Function: int mpfr_rootn_ui (mpfr_t ROP, mpfr_t OP, unsigned long -- 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)