Re: rst2latex and (un)numbered sections

Guenter Milde via Docutils-users <[email protected]> Mon, 11 Nov 2019 12:31:12 -0000 (UTC)
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
On 2019-11-09, Martin Koutecký wrote:

> [-- Type: text/plain, Encoding:  --]

> In LaTeX, one may write \section{...} for a numbered section and
> \section*{...} for an unnumbered section. This seems impossible with rST.
> Is this correct?

> I have a large document which I'm translating into LaTeX using rst2latex
> and (because of specific styling needs) I would like to have both numbered
> and unnumbered sections. Does anyone know a hack to do this?

How about something like the appended?

Günter


.. sectnum:: 

Section
=======

for an unnumbered section, use one of the "aside" objects, e.g.:

.. rubric:: A Rubric

The “rubric” directive inserts a “rubric_” element into the document tree. A
rubric is like an informal heading that doesn’t correspond to the
document’s structure.

.. _rubric: http://docutils.sourceforge.net/docs/user/latex.html#rubric


.. topic:: A Topic

  A topic_ is like a block quote with a title, or a self-contained section
  with no subsections.
  
.. _topic: http://docutils.sourceforge.net/docs/user/latex.html#topic-element


.. sidebar:: A Sidebar

  Sidebars_ are like miniature, parallel documents that occur inside other
  documents, providing related or reference material. 

.. _sidebars: http://docutils.sourceforge.net/docs/user/latex.html#sidebar


See also http://docutils.sourceforge.net/docs/ref/rst/directives.html


Styling
=======

All of these objects can by styled to look like a "normal" unnumbered
section of any level by re-defining the ``\DU...`` LaTeX commands in the
preamble or stylesheet.

Example styling (in style-sheet or latex-preamble_)::

  % rubrics as unnumbered section headings
  \newcommand{\DUrubric}[1]{\subsection*{#1}}%
  \newcommand{\DUsidebar}{}
  \newcommand{\DUtitletopic}[1]{\subsection*{#1}}
  \newcommand{\DUCLASStopic}{\renewenvironment{quote}{}{}}
  \newcommand{\DUtitlesidebar}[1]{\subsubsection*{#1}}

.. _latex-preamble:
   http://docutils.sourceforge.net/docs/user/latex.html#latex-preamble





_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users

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