Discussion:
[Docutils-users] Define Latex packages in reST file
Masood Azizi
2015-09-01 07:43:09 UTC
Permalink
Hello,

We used |Docutils| to produce reST document, and then make a TeX file
via |rst2latex|.

In the |rst| file, we have added a lot of LaTeX code like:

|.. raw:: latex ~\\ \rule{\textwidth}{1pt} ~\\ |

But I do not know where to add packages like |\usepackage{tabulary}|.

If I add it in the |rst| file like I've shown above, even in the very
beginning, this |\usepackage| line is automatically added
after |\begin{document}| in the tex output file. This obviously
generates an error.

Any idea where can I add |\usepackage| commands in reST?

Thanks
engelbert gruber
2015-09-01 14:55:58 UTC
Permalink
hmm maybe latex_preamble or stylesheet
Post by Masood Azizi
Hello,
We used Docutils to produce reST document, and then make a TeX file via
rst2latex.
.. raw:: latex
~\\
\rule{\textwidth}{1pt}
~\\
But I do not know where to add packages like \usepackage{tabulary}.
If I add it in the rst file like I've shown above, even in the very
beginning, this \usepackage line is automatically added after
\begin{document} in the tex output file. This obviously generates an error.
Any idea where can I add \usepackage commands in reST?
Thanks
------------------------------------------------------------------------------
_______________________________________________
Docutils-users mailing list
https://lists.sourceforge.net/lists/listinfo/docutils-users
Please use "Reply All" to reply to the list.
Guenter Milde
2015-09-01 16:52:09 UTC
Permalink
...
Post by engelbert gruber
Post by Masood Azizi
But I do not know where to add packages like \usepackage{tabulary}.
If I add it in the rst file like I've shown above, even in the very
beginning, this \usepackage line is automatically added after
\begin{document} in the tex output file. This obviously generates an error.
Any idea where can I add \usepackage commands in reST?
Currently, preamble code must be added in a configuration file or command
line option.

See http://docutils.sourceforge.net/docs/user/config.html
and look for
Post by engelbert gruber
latex_preamble or stylesheet
(BTW: there is a long-standing issue/discussion about allowing preamble code
in an rST document, see http://docutils.sourceforge.net/docs/dev/todo.html

misc.raw: add a "destination" option to the "raw" directive?

.. raw:: html
:destination: head

<link ...>

It needs thought & discussion though, to come up with a consistent set of
destination labels and consistent behavior.


Günter

Loading...