Maybe a bug in rst2latex

Sergio <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
If I run rst2html test.rst > test.html I obtain a file with the links
correctly setted as one can expect.

But if I run

    $ rst2latex test.rst > test.tex
    $ pdflatex test.tex

I obtain a series of warnings:

    LaTeX Warning: Hyper reference `chunk3' on page 2
    undefined on input line 150.

and the links there are not into the resultin pdf.

I can correct this behaviour adding into "test.tex" a series of macro
"\phantomsection\label{chunk1}", but I think this should be done by rst2latex.

The file "test.tex" has the corrections into a comment block.

==file test.rst=========================
=========
pipe test
=========

A little benchmark to study the behavior of noweb.

.. contents:: Table of Contents

|

The name of this program is "pipe" and has two blocks of code.

.. _chunk1:

::

  <pipe>=
    <Add two terms>
    <Say hallo>

The first block of code takes two parameters and return the sum of
them. Think of it as a ``graeting code`` between two column of beer.

.. _chunk2:

::

  <Add two terms>=
    def add(a, b):
        result = a + b
        return result

*[defines <add> used in chunk3_]*

.

then open the list and return the result.

.. _chunk3:

::

  <Add two terms>+=
        result = result - []
        return result

The second and last block of code takes one parameter, uses the add
function previously defined, and finally say hallo.

.. _chunk4:

::

  <Say hallo>=
    def sayhallo(s):
        v = add(s, s+1)
        print "Hallo %d" % (v)

*[defines <sayhallo>]*

.

So has come the end of the program.

List of chunks
--------------

| ``<pipe>``, defined at chunk1_
| ``<Add two terms>``, defined at chunk2_, used at chunk1_
| ``<Say hallo>``, defined at chunk3_, used at chunk1_

List of identifiers
-------------------

|  *add*, defined at chunk2_, used at chunk3_
|  *sayhallo*, defined at chunk3_
==end of file test.rst==================

==file test.tex=========================
\documentclass[a4paper]{article}
% generated by Docutils <http://docutils.sourceforge.net/>
\usepackage{fixltx2e} % LaTeX patches, \textsubscript
\usepackage{cmap} % fix search and cut-and-paste in Acrobat
\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{0}

%%% Custom LaTeX preamble
% PDF Standard Fonts
\usepackage{mathptmx} % Times
\usepackage[scaled=.90]{helvet}
\usepackage{courier}

%%% User specified packages and stylesheets

%%% Fallback definitions for Docutils-specific commands

% providelength (provide a length variable and set default, if it is new)
\providecommand*{\DUprovidelength}[2]{
  \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
}

% lineblock environment
\DUprovidelength{\DUlineblockindent}{2.5em}
\ifthenelse{\isundefined{\DUlineblock}}{
  \newenvironment{DUlineblock}[1]{%
    \list{}{\setlength{\partopsep}{\parskip}
            \addtolength{\partopsep}{\baselineskip}
            \setlength{\topsep}{0pt}
            \setlength{\itemsep}{0.15\baselineskip}
            \setlength{\parsep}{0pt}
            \setlength{\leftmargin}{#1}}
    \raggedright
  }
  {\endlist}
}{}

% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
  \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
  \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
}{}
\hypersetup{
  pdftitle={pipe test},
}

%%% Title Data
\title{\phantomsection%
  pipe test%
  \label{pipe-test}}
\author{}
\date{}

%%% Body
\begin{document}
\maketitle

A little benchmark to study the behavior of noweb.

\phantomsection\label{table-of-contents}
\pdfbookmark[1]{Table of Contents}{table-of-contents}
\renewcommand{\contentsname}{Table of Contents}
\tableofcontents

\begin{DUlineblock}{0em}
\item[] 
\end{DUlineblock}

The name of this program is \textquotedbl{}pipe\textquotedbl{} and has two
blocks of code.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HERE SHOULD BE THE LINE
%%
%% \phantomsection\label{chunk1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{quote}{\ttfamily \raggedright \noindent
<pipe>=\\
~~<Add~two~terms>\\
~~<Say~hallo>
}
\end{quote}

The first block of code takes two parameters and return the sum of
them. Think of it as a \texttt{graeting code} between two column of beer.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HERE SHOULD BE THE LINE
%%
%% \phantomsection\label{chunk2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{quote}{\ttfamily \raggedright \noindent
<Add~two~terms>=\\
~~def~add(a,~b):\\
~~~~~~result~=~a~+~b\\
~~~~~~return~result
}
\end{quote}

\emph{{[}defines <add> used in chunk3\_{]}}

.

then open the list and return the result.
%
\begin{quote}{\ttfamily \raggedright \noindent
<Add~two~terms>+=\\
~~~~~~result~=~result~-~{[}{]}\\
~~~~~~return~result
}
\end{quote}

The second and last block of code takes one parameter, uses the add
function previously defined, and finally say hallo.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HERE SHOULD BE THE LINE
%%
%% \phantomsection\label{chunk3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{quote}{\ttfamily \raggedright \noindent
<Say~hallo>=\\
~~def~sayhallo(s):\\
~~~~~~v~=~add(s,~s+1)\\
~~~~~~print~\textquotedbl{}Hallo~\%d\textquotedbl{}~\%~(v)
}
\end{quote}

\emph{{[}defines <sayhallo>{]}}

.

So has come the end of the program.


\section{List of chunks%
  \label{list-of-chunks}%
}

\begin{DUlineblock}{0em}
\item[] \texttt{<pipe>}, defined at \hyperref[chunk1]{chunk1}
\item[] \texttt{<Add two terms>}, defined at \hyperref[chunk2]{chunk2}, used
at \hyperref[chunk1]{chunk1}
\item[] \texttt{<Say hallo>}, defined at \hyperref[chunk3]{chunk3}, used at
\hyperref[chunk1]{chunk1}
\end{DUlineblock}


\section{List of identifiers%
  \label{list-of-identifiers}%
}

\begin{DUlineblock}{0em}
\item[] \emph{add}, defined at \hyperref[chunk2]{chunk2}, used at
\hyperref[chunk3]{chunk3}
\item[] \emph{sayhallo}, defined at \hyperref[chunk3]{chunk3}
\end{DUlineblock}

\end{document}
==end of file test.tex==================



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.