bug-texinfo
[Top][All Lists]
Advanced

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

Re: @var{x_1} is funny in pdf


From: Leo Butler
Subject: Re: @var{x_1} is funny in pdf
Date: Thu, 14 Jan 2021 12:28:03 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Gavin Smith <gavinsmith0123@gmail.com> writes:

> On Wed, Dec 23, 2020 at 10:11:49AM -0600, Leo Butler wrote:
>> Gavin Smith <gavinsmith0123@gmail.com> writes:
>> 
>> > On Tue, Dec 22, 2020 at 09:11:01AM -0800, Raymond Toy wrote:
>> >> This came up recently on the maxima list where @var{x_1} shows up fine
>> >> in html but looks weird in the pdf file.  For example,
>> >> https://maxima.sourceforge.io/docs/manual/maxima.pdf, page 55,
>> >> documentation of the 'create_list'-command.  The line for the
>> >> create_list function looks fine, but the first sentence shows @var{x_1}
>> >> in a funny way.
>> >
>> > It could be a bug.  Could you try to create a minimal failing example
>> > based on the maxima manual?
>> >
>> > When I tested @var{x_1} in some short test files it came out ok.
>> 
>> Gavin, I was the person who identified the cause of the bug in the
>> output that Ray cites.
>> 
>> A MWE would be a texinfo file that includes
>> 
>> @tex
>> \def\badunderscore{...}
>> \catcode`\_=\active \let_=\badunderscore
>> @end tex
>> 
>> ... @var{x_1} ...
>> 
>> 
>> The problem, as I see it, is that the \var macro does not set up the
>> catcodes of special characters the way that \code does, and bind them to
>> macros that emit the correct characters.
>
> Why are you changing the definition of _?  This is not something that
> has to be supported by Texinfo.  It's not surprising at all that changing
> catcodes in user documents breaks something.

Fair enough.

>
> The code you sent doesn't demonstrate the issue.  It looks wrong as
> definitions inside a @tex block are local to that block unless you
> use \gdef or \global.

For posterity, the problem was caused by a macro with an obvious error
in it:

\global\def\setpdfdestname#1{%
 \turnoffactive
 \def\pdfdestname{#1}%
 \txiescapepdf\pdfdestname
}

See the bottom of:
https://sourceforge.net/p/maxima/code/ci/master/tree/doc/info/category-macros.texi

(There is no need to comment on this, I didn't write the macro and the
authors are not party to this discussion, afaik).

[snip]
>
> What is that problem?

Let me explain why, I think, that macro above and its companion (\mmref)
were written. The authors were looking for a `minimally-intrusive'
reference for our pdf manual.

I think that the problem they encountered is that \ref does not have
enough hooks in it to customize the appearance (and a second problem is
that the hooks that are there are not documented except in texinfo.tex).

By default, a reference is displayed like

[nodename], page XXX

The square brackets can be customized, as can `page', but there is no
way [*] to display a reference entirely undecorated, like

nodename

I have attached a patch to texinfo.tex that adds a simple switch
(\ifrefincludespage) to allow one to cut out the page reference. With
that,

\gdef\mmref#1{{\refincludespagefalse\def\xrefprintnodename##1{##1}\ref{#1}}}    
            

gives the desired behaviour. I have also attached a cutout of one page
from the manual using \mmref and the patch, and the same page using just
\ref, in order to show the differences.

Leo

------


[*] Well, there is a way, but I am sure you won't like it, because it
involves disembowelling xrefXXX from inside:

\gdef\mmref{\begingroup%
        % omit the usual square brackets, [ ], around reference names
        % and gobble the comma (,) and \space tokens on line 9125 of texinfo.tex
        \def\xrefprintnodename##1##2##3\space{##1}%
        % gobble the sequence of tokens following \putwordpage on line 9128 of 
texinfo.tex
        \def\putwordpage##1\if{\def\tokenafterxref{=}\if}%
        % We may need to redefine \xrefXX macro from line 8950 of texinfo.tex, 
like so:
        %        \def\xrefXX##1{\def\xrefXXarg{##1}\xrefXXX}%
        % However, it looks like using \putwordpage to forcibly reset 
\tokenafterxref works.
        % Finally, we punt to texinfo's \xrefXX macro. The \endgroup closes the 
\begingroup
        % on the first line of \mmref
        \def\maximarefX##1{\xrefXX{##1}\endgroup}%
        \maximarefX}

Attachment: texinfo.tex.diff
Description: add a refincludespage flag to texinfo.tex

Attachment: maxima-min.pdf
Description: p234 using patch

Attachment: maxima-unpatch.pdf
Description: p234(6) without patch


reply via email to

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