On Sun, Dec 07, 2025 at 02:06:08PM +0100, Patrice Dumas wrote:
> On Sat, Dec 06, 2025 at 11:28:53PM +0000, Gavin Smith wrote:
> > One page 6 of the output from running "pdflatex test-part.tex", you can
> > see the problem with the heading. The \\ inserts hfill glue or similar
> > which
> > creates a huge space between "Part I" and "One". "Part I One" is supposed
> > to be aligned to the right of the page but there is so much space that
> > "Part I" ends up being centred.
> >
> > I fixed this in texinfo.tex by using an \ifinner conditional:
> >
> > % @* forces a line break.
> >
> > % In internal horizontal or vertical mode, convert explicit line breaks
> >
> > % from @* into spaces. For instance, if the user gives these in long
> >
> > % section titles, this may occur in the table of contents, or the page
> >
> > % heading line.
> >
> > \def\*{%
> >
> > \ifinner\unskip\space\ignorespaces
> >
> > \else\unskip\hfil\break\hbox{}\ignorespaces\fi}
> >
> > The same might work for LaTeX output.
>
> I used something like that, but keeping the same end of line as
> previously. It seems to work well for me for your test and I also
> checked the output of other @* tests, which looks ok to me.
With the current git master (commit 4530b19e606c56410), there is no change
to the output. The '\texorpdfstring ...' output is still used. It appears
from the code that this would always be used inside the argument to @part.
} elsif ($self->{'formatting_context'}->[-1]
->{'in_sectioning_command_heading'}) {
# add command to substitute a space in table of contents
# if in heading command.
$result .= "\\texorpdfstring{\\leavevmode{}\\\\}{ }";
} else {
# In internal horizontal or vertical mode, convert explicit line
# breaks from @* into spaces for page heading lines. The
# code is based on Texinfo TeX code, but with a different
# code for the case where an end of line is output.
# NOTE \leavevmode{} is added to avoid
# ! LaTeX Error: There's no line here to end.
$result .= "\\ifinner\\unskip\\space\\ignorespaces".
"\\else\\leavevmode{}\\\\\\fi%\n";
}