Martin Gignac | 1 Sep 2009 04:45
Picon

Inline literal issue in HTML and patch...

Hi,

I recently ran into a bit of an issue when using inline literals with
spaces in combination with the custom CSS I am using for my HTML
output. I tried modifying my custom CSS to show inline literal text
with a dotted box around it and noticed an unexpected behavior:

    http://cjoint.com/data/jbevwqXxnJ_before.png

You can see that each word in the text "CLF Mass Treatment status
code" is encased in its own box. I checked out the generated HTML for
this and noticed that each word for this section was enclosed in its
own <span> tag pair.

I then made a patch in the HTML Writer to remove the separate <span>
tags for each word and adjusted the 'span.pre' property in the CSS to
keep the word-wrap behavior of these literals.

This is the end result:

    http://cjoint.com/data/jbeEa4lUkb_after.png

I don't know if this addresses bug 1938891
(http://sourceforge.net/tracker/?func=detail&atid=422030&aid=1938891&group_id=38414)
or not, but it certainly appears related to me.

There may be a good reason to use <span> tags for every word but I'm
not sure what it is. The comments in the HTML Writer do say:

    # Protect text like "--an-option" from bad line wrapping
(Continue reading)

Guenter Milde | 4 Sep 2009 14:34
Picon

Re: Inline literal issue in HTML and patch...

On 2009-09-01, Martin Gignac wrote:

> I recently ran into a bit of an issue when using inline literals with
> spaces in combination with the custom CSS I am using for my HTML
> output. I tried modifying my custom CSS to show inline literal text
> with a dotted box around it and noticed an unexpected behavior:

>     http://cjoint.com/data/jbevwqXxnJ_before.png

> You can see that each word in the text "CLF Mass Treatment status
> code" is encased in its own box.

It looks like you defined a rule for 'span.pre' instead of one for
'tt.docutils.literal'.

> I checked out the generated HTML for this and noticed that each word
> for this section was enclosed in its own <span> tag pair.
...
> I don't know if this addresses bug 1938891
> (http://sourceforge.net/tracker/?func=detail&atid=422030&aid=1938891&group_id=38414)
> or not, but it certainly appears related to me.

Thanks for the report and patch.

The bug describes the same problem, but ...

> There may be a good reason to use <span> tags for every word but I'm
> not sure what it is. The comments in the HTML Writer do say:

>     # Protect text like "--an-option" from bad line wrapping
(Continue reading)

Martin Gignac | 5 Sep 2009 15:35
Picon

Re: Inline literal issue in HTML and patch...

Hi Günter,

> It looks like you defined a rule for 'span.pre' instead of one for
> 'tt.docutils.literal'.

Damn, you're right; I was modifying the totally wrong selector. Now
that you mention it, it's obvious where I needed to add:

tt.docutils.literal {
  padding-left: 1px ;
  padding-right: 1px ;
  border: thin dotted }

instead of in 'span.pre'.

Now the output is exactly like I want it, without any dumb patches on
my part. Thanks a lot for pointing out my mistake.

And thanks for the detailed explanation on the problem with
word-wrapping on non-alphanumeric characters; I now understand better
the rationale for using <span class="pre"> tags.

-Martin

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
(Continue reading)

Ryan Krauss | 10 Sep 2009 14:39
Picon

Latex figures: captions, labels, numbers, and refs

I am trying to generate a lab procedure for my class on Friday using rst2latex.  The figures float, but I don't see how to include captions and labels.  Also, with the default settings, figure numbers don't appear.  Is there a relatively easy way to get numbered figures with captions and labels that I can reference?  I found a couple of threads on this, but the latest was January and it seemed  to raise several questions but there was no discussion of how things were resolved.


Thanks,

Ryan
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Guenter Milde | 10 Sep 2009 15:27
Picon

Re: Latex figures: captions, labels, numbers, and refs

On 2009-09-10, Ryan Krauss wrote:

> I am trying to generate a lab procedure for my class on Friday using
> rst2latex.  The figures float, but I don't see how to include captions
> and labels.  Also, with the default settings, figure numbers don't
> appear.  Is there a relatively easy way to get numbered figures with
> captions and labels that I can reference?  I found a couple of threads
> on this, but the latest was January and it seemed to raise several
> questions but there was no discussion of how things were resolved.

Figures should be labeled and captions easily possible, if you use the
``.. figure::`` directive.

After defining two custom roles and their expansion in LaTeX, its possible
to utilise LaTeX's reference mechanism.

Günter

Label and Reference via LaTeX and custom roles
===============================================

After defining two custom roles and their expansion in LaTeX, its possible
to utilise LaTeX's reference mechanism.

.. role:: ref

.. role:: label

.. raw::  latex

  \newcommand*{\docutilsroleref}{\ref}
  \newcommand*{\docutilsrolelabel}{\label}

.. figure:: mc.png
   :width: 50

   :label:`mc` Midnight Commander icon enlarged 

Figure :ref:`mc` shows the icon for the file manager `Midnight
Commander` enlarged to a width of 50 Pixel.

The LaTeX output is OK, the HTML output can be corrected with a custom style
sheet:

* Add the key ``Figure #:`` with ``:before`` pseudo class and automatic
  numbering.

* Suppress the label with ``span.label{visibility: hidden;}``  

* Replacing the reference with the correct number remains unsolved.

.. List of figures

.. _Figure 1: mcicon_

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Docutils-users mailing list
Docutils-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Ryan Krauss | 10 Sep 2009 17:20
Picon

Re: Latex figures: captions, labels, numbers, and refs

Thanks for your reply.  I think I am close (and I think I followed your directions).

Here is the tail end of the output from pdflatex:
("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hpdftex.def")
(labview_tutorial.aux
! Missing \endcsname inserted.
<to be read again>
                   \protect
l.23 ... Automation Explorer)\relax }{figure.1}{}}

?

>>> Here is the beginning of the rst file:

===================================
Lab 03: Introduction to LabVIEW DAQ
===================================

ME 458
~~~~~~~~

.. role:: ref

.. role:: label

.. raw::  latex

    \newcommand*{\docutilsroleref}{\ref}
    \newcommand*{\docutilsrolelabel}{\label}


Overview
========

This lab will introduce you to the basics of LabVIEW data acquistion


>>> Here is the rst code around the figure:

Automation as shown in the screen shot below.

.. figure:: screenshots/launch_NI_Max.jpg
    :width: 4.0in

    :label:`launchmax` Screen shot for launching NI-MAX (National
    Instruments Measurement and Automation Explorer)
   


When the NI-MAX window comes up, expand the "Device and Interfaces"
folder in the top left and then also expand "NI-DAQmx Devices".  Under



>> and here is the generated tex for the figure

\begin{figure}[htbp]
\centering

\includegraphics[width=4.0in]{screenshots/launch_NI_Max.jpg}
\caption{\docutilsrolelabel{launchmax} Screen shot for launching NI-MAX (National
Instruments Measurement and Automation Explorer)}\end{figure}



What am I doing wrong?

Thanks,

Ryan

On Thu, Sep 10, 2009 at 8:27 AM, Guenter Milde <milde <at> users.berlios.de> wrote:
On 2009-09-10, Ryan Krauss wrote:


> I am trying to generate a lab procedure for my class on Friday using
> rst2latex.  The figures float, but I don't see how to include captions
> and labels.  Also, with the default settings, figure numbers don't
> appear.  Is there a relatively easy way to get numbered figures with
> captions and labels that I can reference?  I found a couple of threads
> on this, but the latest was January and it seemed to raise several
> questions but there was no discussion of how things were resolved.

Figures should be labeled and captions easily possible, if you use the
``.. figure::`` directive.

After defining two custom roles and their expansion in LaTeX, its possible
to utilise LaTeX's reference mechanism.

Günter

Label and Reference via LaTeX and custom roles
===============================================

After defining two custom roles and their expansion in LaTeX, its possible
to utilise LaTeX's reference mechanism.

.. role:: ref

.. role:: label

.. raw::  latex

 \newcommand*{\docutilsroleref}{\ref}
 \newcommand*{\docutilsrolelabel}{\label}


.. figure:: mc.png
  :width: 50

  :label:`mc` Midnight Commander icon enlarged

Figure :ref:`mc` shows the icon for the file manager `Midnight
Commander` enlarged to a width of 50 Pixel.

The LaTeX output is OK, the HTML output can be corrected with a custom style
sheet:

* Add the key ``Figure #:`` with ``:before`` pseudo class and automatic
 numbering.

* Suppress the label with ``span.label{visibility: hidden;}``

* Replacing the reference with the correct number remains unsolved.

.. List of figures

.. _Figure 1: mcicon_




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Docutils-users mailing list
Docutils-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Guenter Milde | 11 Sep 2009 09:54
Picon

Re: Latex figures: captions, labels, numbers, and refs

On 2009-09-10, Ryan Krauss wrote:

> Thanks for your reply.  I think I am close (and I think I followed your
> directions).

> Here is the tail end of the output from pdflatex:
> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hpdftex.def")
> (labview_tutorial.aux
> ! Missing \endcsname inserted.
><to be read again>
>                    \protect
> l.23 ... Automation Explorer)\relax }{figure.1}{}}

> ?

>>>> Here is the beginning of the rst file:

>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Lab 03: Introduction to LabVIEW DAQ
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

...

>>> and here is the generated tex for the figure

> \begin{figure}[htbp]
> \centering

> \includegraphics[width=3D4.0in]{screenshots/launch_NI_Max.jpg}
> \caption{\docutilsrolelabel{launchmax} Screen shot for launching NI-MAX
> (National
> Instruments Measurement and Automation Explorer)}\end{figure}

> What am I doing wrong?

I don't know and cannot tell from the given info. 

* In the LaTeX file, try replacing "\docutilsrolelabel" with "\label"
  and "\docutilsroleref" with "\ref".

* Provide a `minimal example`: the smallest possible (but complete!) 
  rst file that exhibits the problem.

Günter

PS: no TOFU (text oben (above) full quote unten (below)) please.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Docutils-users mailing list
Docutils-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Ryan Krauss | 11 Sep 2009 14:24
Picon

Re: Latex figures: captions, labels, numbers, and refs


On Fri, Sep 11, 2009 at 2:54 AM, Guenter Milde <milde <at> users.berlios.de> wrote:
On 2009-09-10, Ryan Krauss wrote:

> Thanks for your reply.  I think I am close (and I think I followed your
> directions).

> Here is the tail end of the output from pdflatex:
> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hpdftex.def")
> (labview_tutorial.aux
> ! Missing \endcsname inserted.
><to be read again>
>                    \protect
> l.23 ... Automation Explorer)\relax }{figure.1}{}}

> ?

>>>> Here is the beginning of the rst file:

>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Lab 03: Introduction to LabVIEW DAQ
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

...

>>> and here is the generated tex for the figure

> \begin{figure}[htbp]
> \centering

> \includegraphics[width=3D4.0in]{screenshots/launch_NI_Max.jpg}
> \caption{\docutilsrolelabel{launchmax} Screen shot for launching NI-MAX
> (National
> Instruments Measurement and Automation Explorer)}\end{figure}



> What am I doing wrong?

I don't know and cannot tell from the given info.

* In the LaTeX file, try replacing "\docutilsrolelabel" with "\label"
 and "\docutilsroleref" with "\ref".

* Provide a `minimal example`: the smallest possible (but complete!)
 rst file that exhibits the problem.

Günter


PS: no TOFU (text oben (above) full quote unten (below)) please.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Docutils-users mailing list
Docutils-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.

A new day and all my problems go away.  I didn't intentionally change anything, but I can't recreate my problem.  Everything works perfectly.  Thanks for your help.

Ryan

PS I am used to doing Figure~\ref{fig1} in latex to prevent figure numbers from appearing on lines by themselves.  Figure~:ref:`fig1` and Figure\~:ref:`fig1` both ended up with {\textasciitilde}.  Is there a way to get Figure~\ref{} into the output tex?
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Guenter Milde | 11 Sep 2009 16:32
Picon

Re: Latex figures: captions, labels, numbers, and refs

On 2009-09-11, Ryan Krauss wrote:

> PS I am used to doing Figure~\ref{fig1} in latex to prevent figure
> numbers from appearing on lines by themselves.  Figure~:ref:`fig1` and
> Figure\~:ref:`fig1` both ended up with {\textasciitilde}.  Is there a
> way t= o get Figure~\ref{} into the output tex?

Insert a real non-break space: Character ' ' (160, 0xA0)
00A0	NO-BREAK SPACE

(How to do this, depends on your Editor (its Ctrl-<Space> on mine).

Günter

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Docutils-users mailing list
Docutils-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
daniel rocco | 18 Sep 2009 17:36

reST, LaTeX, and UTF-8

Hi everyone,

I'm using reST on Windows 7, Python 2.6, the latest docutils snapshot, 
MikTex 2.8, and rst2latex. Installed as is, this setup did not give me a 
complete reST to PDF toolchain for documents encoded in UTF-8. Snooping 
around, it appeared that docutils was doing the right thing, since the 
generated .tex file was correctly encoded as UTF-8 and included a 
seemingly correct input encoding declaration

\usepackage[utf8]{inputenc}

However, when fed these documents, LaTeX complained about illegal 
characters in the input. With some further digging, I discovered that 
changing the encoding option in the generated LaTeX document to

\usepackage[utf8x]{inputenc}

solved the problem beautifully. To make the change permanent and 
automatic, I have edited …\docutils\writers\latex2e\__init__.py, adding 
the following encoding pair to the method to_latex_encoding's tr dict:

'us-ascii': 'ascii', # ASCII (US)
+ 'utf-8': 'utf8x',

Is this solution reasonable, i.e. does it solve the problem without 
creating subtle problems elsewhere? Is there a better solution that I 
have overlooked? Could the same thing be accomplished without editing 
the python file, e.g. with command line switches?

Thanks,
dan

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

Gmane