bug-texinfo
[Top][All Lists]

Re: incorrect @math spacing for PDF output with an empty macro

 From: Vincent Lefevre Subject: Re: incorrect @math spacing for PDF output with an empty macro Date: Wed, 26 Oct 2022 11:59:59 +0200 User-agent: Mutt/2.2.7+51 (a318ca5a) vl-149028 (2022-10-21)

On 2022-10-26 09:44:05 +0100, Gavin Smith wrote:
> On Wed, Oct 26, 2022 at 02:44:17AM +0200, Vincent Lefevre wrote:
> > > 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
>
> That is asking the same question as you.  As you noted, there isn't
> a solution.

No, it just says that *boxes* are not a solution.

> > but the accepted answer seems incorrect, or not answering the
> > general issue.
>
> Unfair criticism IMHO.

In the accepted answer, line breaks are re-enabled, which is
incorrect if the goal of \hbox was to disable line breaks in
the first place.

> > 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).
>
> Great, now can you explain how it all works?!  Not worth the trouble
> in my opinion.

Instead of using a box (which is not a solution, see above), it
locally changes the settings to prevent any cause of line break.
But not everything might be necessary here, and I'm wondering why
\linepenalty is not used by nolbreaks.sty (though I don't know
much about TeX internals). I can see in texinfo.tex for \entry:

\linepenalty=1000  % Discourage line breaks.
\hyphenpenalty=5000  % Discourage hyphenation.

This might be sufficient. BTW, while a method to prevent all
line breaks in the Info and HTML output seems necessary because
they do not have a good line-breaking algorithm, this is not
the case in TeX.

> > but
> >
> >   \binoppenalty=10000
> >   \relpenalty=10000
> >
> > solved the issue in all my LaTeX documents.
>
> Good idea.  You could do the same in Texinfo:
>
> @tex
> \globaldefs=1
> \binoppenalty=10000
> \relpenalty=10000
> @end tex

This doesn't seem to be necessary at the moment (I will see later).

--
Vincent Lefèvre <vincent@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)