Roberto Alsina | 30 Mar 00:37
Picon
Favicon
Gravatar

Re: Re: Alternatives for reST -> PDF

El Miércoles, 29 de Marzo de 2006 19:18, Ben Finney escribió:
> "G. Milde" <g.milde <at> web.de> writes:
> > Wanted: Alternatives for reST -> PDF
>
> Thanks for this collation of the options discussed so far.
>
> > What I would like to see is a script that does the reST2PDF
> > conversion with one command, similar to rst2html or rst2latex.
>
> Yes, that's my need as well. In my processes, LaTeX is useful only to
> the extent that it helps get to that goal.
>
> > pdflatex
> > --------
> >
> > My first suggestion was a wrapper script around pdflatex that would
> > care for the necessary preparation, run as many times as needed and
> > clean up afterwards thus bypassing the most obvious annoyances of LaTeX.
>
> Something that can:
>
>   - run as a pipeline (LaTeX on stdin, PDF on stdout) by default
>
>   - allow any specified path for input file and/or output file
>
>   - hide all the cruft that LaTeX processing creates, leaving no extra
>     files unless asked
>
>   - properly handle Unicode, standard fonts, standard filenames and
>     locations, and other conventions that seem poorly supported by
>     LaTeX
>
>   - ensure that the process ends with either an unambiguous error
>     state, or a complete PDF rendering of the input
>
> Currently pdflatex does *none* of these, and is thus a bad tool
> (largely because it fails to sufficiently abstract the underlying bad
> tools).
>
> I don't understand enough about LaTeX and associated tools to do this
> myself, nor am I interested in learning about it, which is why I'm
> looking for alternatives to avoid LaTeX altogether.

Ok, this is **not** what you want. However, it may be a starting point:

#!/bin/sh
rst2latex --tab-width=2 --use-verbatim-when-possible --table-style=booktabs 
--language=es  \
--stylesheet=style.tex \
 --graphicx-option=pdftex --use-latex-toc --documentoptions=10pt,a4paper 
--output-encoding-error-handler ignor
e docs.txt >docs.latex

sed 's/\[gray\]{0.80}/{bg}/' docs.latex > docs.tmp && mv docs.tmp docs.latex

# I have never seen pdflatex require more than 4 passes
pdflatex docs.latex
pdflatex docs.latex
pdflatex docs.latex
pdflatex docs.latex

The style.tex mentioned is this:

% donot indent first line.
\setlength{\parskip}{5pt plus 2pt minus 1pt}
%\documentclass[spanish]{article}
%\usepackage[T1]{fontenc}
%\usepackage[latin1]{inputenc}
\usepackage{a4wide}
\usepackage{fancyhdr}
\pagestyle{fancy}
%\usepackage{babel}
\setlength\parskip{\bigskipamount}
\setlength\parindent{0pt}
%\usepackage{graphics}
\def\thetitle{Manual Servidor de Correo - Intramed}
\definecolor{bg}{rgb}{1,.98,.7}
\setlength{\admonitionwidth}{0.5\textwidth}

% sloppy
% ------
% Less strict (opposite to default fussy) space size between words. Therefore
% less hyphenation.
% \sloppy

% fonts
% -----
% times for pdf generation, gives smaller pdf files.
%
% But in standard postscript fonts: courier and times/helvetica do not fit.
% Maybe use pslatex.
% \usepackage{times}

% pagestyle
%\pagestyle{headings}

\lhead{\thetitle}
%\rhead{Page \thepage}
\rhead{Section \thesubsection}

The bad side:

Doesn't work as a pipe,  assumes everything is in spanish, you can't change 
the name of the files, and it doesn't delete the temporary files.

However, those are not rst or latex problems, those are script programming 
problems. So you may find a solution.
   
--

-- 
 ("\''/").__..-''"`-. .         Roberto Alsina
 `9_ 9  )   `-. (    ).`-._.`)  ralsina <at> kde.org
 (_Y_.)' ._   ) `._`.  " -.-'   KDE Developer (MFCH)
  _..`-'_..-_/ /-'_.'
(l)-'' ((i).' ((!.'   Buenos Aires - Argentina
Imminentizing the eschaton since 1971.

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642

Gmane