bug-texinfo
[Top][All Lists]
Advanced

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

No closing square bracket in node names


From: Robert J. Chassell
Subject: No closing square bracket in node names
Date: Sat, 22 Mar 2003 15:21:09 +0000 (UTC)

The Texinfo manual says

    (texinfo)Node Line Requirements

   * Unfortunately, you cannot use periods, commas, colons or
     parentheses within a node name; these confuse the Texinfo
     processors.

but it does not say anything about square brackets.  It turns out you
cannot use a closing square bracket in a node name for DVI output.

This is either a problem with the documentation or with texinfo.tex.

Moreover, for a project I am working on now, I would like to be able
to include a closing square bracket in a node name.

I have appended a test file that illustrates the problem.

This test file also includes an @address@hidden tex change that removes
square brackets from around

    \printednodename

as it appears in cross references, but does not do anything else.
(The problem occurs without this change, too.)

Originally, I wrote the change for my Introduction to Programming book,
replacing square brackets with ``...''.  I never had any trouble with
that, but then, I never tried writing a node name with a bracket in
it, either.

This current variation on the change does not put any characters
around the printed node name, and I am trying to write a node name
with a bracket.

Here is the change

    %%% was:
    %%% originally:     [\printednodename],\space
    %%% for intro:      ``\printednodename'',\space
        \printednodename,\space


I writing some Texinfo to handle `the structural classification of
proteins'.  It looks that a node name such as

    56871 [f.2.1.1]

will be best.  (The five digit number is an ID code for the protein
and the characters in the square brackets are the protein's class.)

The test file below does not include any cross references; however the
Texinfo classification file contains many, of the form:

    Fold:        Membrane all-alpha. @xref{56868 address@hidden

What should I do?

Here is the test file:


\input texinfo.tex   @c -*-texinfo-*-
@comment %**start of header
@setfilename test-node-name-bracket.info
@settitle Texinfo Test square bracket in node names
@smallbook
@comment %**end of header

@ignore
 ## Summary of shell commands to create various output formats:

    ## Info output
    makeinfo --force --fill-column=70 --no-split --paragraph-indent=0 \
    --verbose test-node-name-bracket.texi

    ## DVI output
    texi2dvi test-node-name-bracket.texi

    ## View DVI output
    xdvi test-node-name-bracket.dvi &

    ## Plain text output
    makeinfo --fill-column=70 --no-split --paragraph-indent=0 \
    --verbose --no-headers --output=test-node-name-bracket.txt  \
    test-node-name-bracket.texi

    ## HTML output
    makeinfo --no-split --html test-node-name-bracket.texi

    ## DocBook output
    makeinfo --docbook --no-split --paragraph-indent=0 \
    --verbose test-node-name-bracket.texi

    ## XML output
    makeinfo --xml --no-split --paragraph-indent=0 \
    --verbose test-node-name-bracket.texi

@end ignore

@c ----------------------------------------------------

@c Print within-book cross references without square brackets

@tex
% Need following so comma appears after section numbers.
\global\def\Ypagenumber{\folio}
\def\Ytitle{\thissection}
\def\Ynothing{}
\def\Ysectionnumberandtype{%
  \ifnum\secno=0
    address@hidden \the\chapno
  \else \ifnum\subsecno=0
    address@hidden \the\chapno.\the\secno
  \else \ifnum\subsubsecno=0
    address@hidden \the\chapno.\the\secno.\the\subsecno
  \else
    address@hidden \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  \fi\fi\fi
}

\global\def\Yappendixletterandtype{%
  \ifnum\secno=0
     address@hidden @char\the\appendixno{}%
  \else \ifnum\subsecno=0
     address@hidden @char\the\appendixno.\the\secno
  \else \ifnum\subsubsecno=0
    address@hidden @char\the\appendixno.\the\secno.\the\subsecno
  \else
    address@hidden
      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  \fi\fi\fi
}


\global\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  \unsepspaces
  \def\printedmanual{\ignorespaces #5}%
  \def\printednodename{\ignorespaces #3}%
  \setbox1=\hbox{\printedmanual}%
  \setbox0=\hbox{\printednodename}%
  \ifdim \wd0 = 0pt
    % No printed node name was explicitly given.
    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
      % Use the node name inside the square brackets.
      \def\printednodename{\ignorespaces #1}%
    \else
      % Use the actual chapter/section title appear inside
      % the square brackets.  Use the real section title if we have it.
      \ifdim \wd1 > 0pt
        % It is in another manual, so we don't have it.
        \def\printednodename{\ignorespaces #1}%
      \else
        \ifhavexrefs
          % We know the real title if we have the xref values.
          \def\printednodename{\refx{#1-title}{}}%
        \else
          % Otherwise just copy the Info node name.
          \def\printednodename{\ignorespaces #1}%
        \fi%
      \fi
    \fi
  \fi
  %
  % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
  % insert empty discretionaries after hyphens, which means that it will
  % not find a line break at a hyphen in a node names.  Since some manuals
  % are best written with fairly long node names, containing hyphens, this
  % is a loss.  Therefore, we give the text of the node name again, so it
  % is as if TeX is seeing it for the first time.
  \ifpdf
    \leavevmode
    \getfilename{#4}%
    {\turnoffactive \otherbackslash
     \ifnum\filenamelength>0
       \startlink attr{/Border [0 0 0]}%
         goto file{\the\filename.pdf} name{#1}%
     \else
       \startlink attr{/Border [0 0 0]}%
         goto name{#1}%
     \fi
    }%
    \linkcolor
  \fi
  %
  \ifdim \wd1 > 0pt
    \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
  \else
    % _ (for example) has to be the character _ for the purposes of the
    % control sequence corresponding to the node, but it has to expand
    % into the usual \leavevmode...\vrule stuff for purposes of
    % printing. So we \turnoffactive for the \refx-snt, back on for the
    % printing, back off for the \refx-pg.
    {\turnoffactive \otherbackslash
     % Only output a following space if the -snt ref is nonempty; for
     % @unnumbered and @anchor, it won't be.
     \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
     \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
    }%
    % [mynode],
%%% was:
%%% originally:     [\printednodename],\space
%%% for intro:      ``\printednodename'',\space
    \printednodename,\space
    % page 3
    \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
  \fi
  \endlink
\endgroup}

@end tex

@c ----------------------------------------------------


@copying
Copyright @copyright{} 2002 Free Software Foundation, Inc.

This document tests a square bracket in node names.

@quotation
Verbatim copying and distribution of this document are
permitted without royalty in any medium provided this
notice is preserved.

@c    The remainder of this paragraph applies to and
@c    should appear in the Texinfo source.
@c Permission is granted to process this file through
@c a converter, such as TeX, to create a different
@c output format and to publish the results, provided
@c the published document carries a copying permission
@c notice identical to this one except for the removal
@c of this paragraph (this paragraph not being

@c relevant to the published document).

Permission is granted to copy and distribute
translations of this document without royalty in any
medium in another language provided this notice is
preserved in its original language.
@end quotation
@end copying

@titlepage
@sp 6
@center @titlefont{Texinfo Test square bracket}
@center @titlefont{in node names}
@sp 4
@center by Robert J. Chassell

@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage

@contents

@ifnottex
@node Top, Chapter One], (dir), (dir)
@top Top: Test square bracket in node names
@insertcopying
@end ifnottex

@menu
* Chapter One]::
* Chapter Two::
@end menu

@node Chapter One], Chapter Two, Top, Top
@comment node, next, prev, up
@chapter Chapter One

Has problem when node name is @@node Chapter One]

Note that this file does not use square brackets in
within-book cross references.


Contents of chapter 1.

The quick brown fox jumps over the lazy dog.

Here is an bulleted list:

@itemize @bullet

@item
First item.

@item
Second item.
@end itemize

@node Chapter Two,  , Chapter One], Top
@chapter Chapter Two

Contents of chapter 2
@cindex bar

The lazy dog opened an eye.

@bye




reply via email to

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