Author: milde
Date: 2009-05-18 12:09:22 +0200 (Mon, 18 May 2009)
New Revision: 5950
Modified:
trunk/docutils/HISTORY.txt
trunk/docutils/RELEASE-NOTES.txt
trunk/docutils/docs/dev/todo.txt
trunk/docutils/docs/user/docutils-05-compat.sty.txt
trunk/docutils/docs/user/latex.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/docutils/writers/latex2e/docutils-05-compat.sty
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
Log:
Use default font in admonitions and sidebar.
New custom commands for sidebar title and subtitle.
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2009-05-18 09:40:42 UTC (rev 5949)
+++ trunk/docutils/HISTORY.txt 2009-05-18 10:09:22 UTC (rev 5950)
@@ -88,6 +88,7 @@
- New custom macros.
- Simpler LaTeX encoding, e.g. "\%" instead of "{\%}".
- Local tocs with `minitoc` (if 'use-latex-toc' is True).
+ - Use default font in admonitions and sidebar.
* docs/ref/rst/restructuredtext.txt:
Modified: trunk/docutils/RELEASE-NOTES.txt
===================================================================
--- trunk/docutils/RELEASE-NOTES.txt 2009-05-18 09:40:42 UTC (rev 5949)
+++ trunk/docutils/RELEASE-NOTES.txt 2009-05-18 10:09:22 UTC (rev 5950)
@@ -41,8 +41,8 @@
- Load packages and define macros only if required in the document.
- Docutils specific LaTeX objects are now all prefixed with ``DU``.
- Local tocs with `minitoc` (if 'use-latex-toc' is True).
+ - Use default font in admonitions and sidebar.
-
Release 0.5 (2008-06-25)
========================
Modified: trunk/docutils/docs/dev/todo.txt
===================================================================
--- trunk/docutils/docs/dev/todo.txt 2009-05-18 09:40:42 UTC (rev 5949)
+++ trunk/docutils/docs/dev/todo.txt 2009-05-18 10:09:22 UTC (rev 5950)
@@ -1919,7 +1919,8 @@
* An image directive with target URI does not start a new paragraph
(see first two image examples in standalone_rst_latex.tex).
-* Too deeply nested lists fail: generate an error or provide a workaround.
+* Too deeply nested lists fail: generate an error, a warning or provide
+ a workaround?
Generate clean and configurable LaTeX source
@@ -1937,9 +1938,29 @@
:subtitle: Is there a native construct?
-:admonitions: Provide separate commands for specific admonitions (error,
- note, ...)?
+:admonitions: optional "type" argument::
+ \providecommand{\DUadmonition}[2][]{%
+ \ifcsname DU#1\endcsname%
+ \csname DU#1\endcsname{#2}%
+ \else
+ \begin{center}
+ \fbox{\parbox{0.9\textwidth}{#2}}
+ \end{center}
+ \fi%
+ }
+
+ Would allow individual restyling of e.g. Notes,
+ e.g. with pdfcomment.sty__ or todonotes.sty.
+
+ Use a "type" argument also for ``\DUtopictitle``?
+ (would allow red error etc.)
+
+:floats: Placement of figure and table floats with a new
+ ``\DUfloatplacement`` parameter (currently hard-coded ``htbp``)?
+
+__ http://dante.ctan.org/CTAN/help/Catalogue/entries/pdfcomment.html
+
LaTeX constructs and packages in stead of re-implementations
````````````````````````````````````````````````````````````
@@ -1951,8 +1972,12 @@
LaTeX installation like the `texlive-latex-recommended` Debian package,
say):
- + no "fancy" or "exotic" requirements
+ + No "fancy" or "exotic" requirements.
+ Or provide fallback solutions in case the required packages do not exist
+ on the target system? (Can be done with ``\@ifpackageloaded{}`` or
+ ``\IfPackageExists{}``.)
+
+ pointers to advanced packages and their use in the `latex writer
documentation`_.
@@ -2074,9 +2099,6 @@
Should be possible with ``--literal-block-env==lstlistings`` and some
configuration...
-* Use default font in admonitions and sidebar? (HTML does not switch
- the font either, users can change this redefining \DUadmonition)
-
* Configurable `classifier` in description list?
\emph instead of bold as default?
@@ -2148,10 +2170,6 @@
* better citation support
-* bibliography directive: If ``use-latex-citations`` is used a bibliography
- is inserted right at the end of the document. *This should be
- customizable*.
-
* Document errors are also too silent. (Use admonition/error?)
No link to system errors.
@@ -2166,6 +2184,17 @@
--> Pass the right option to ``\hypersetup``
+
+bibliography directive
+``````````````````````
+
+If ``use-latex-citations`` is used a bibliography is inserted right at the
+end of the document. *This should be customizable*.
+
+Alan suggested a `bibliography` directive so that BibTeX references are not
+automatically placed at the end (and bibtex for HTML via ... can be supported)
+
+
template file
`````````````
Modified: trunk/docutils/docs/user/docutils-05-compat.sty.txt
===================================================================
--- trunk/docutils/docs/user/docutils-05-compat.sty.txt 2009-05-18 09:40:42 UTC (rev 5949)
+++ trunk/docutils/docs/user/docutils-05-compat.sty.txt 2009-05-18 10:09:22 UTC (rev 5950)
@@ -19,7 +19,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{docutils-05-compat}
[2009/03/26 v0.1 compatibility with rst2latex from Docutils 0.5]
-
+
.. contents::
:depth: 3
@@ -103,13 +103,13 @@
* ``px`` is a valid unit in pdftex since version 1.3.0 released on
2005-02-04:
- 1px defaults to 1bp (or 72dpi), but can be changed with the \pdfpxdimen
- primitive::
+ 1px defaults to 1bp (or 72dpi), but can be changed with the
+ ``\pdfpxdimen`` primitive.::
- \pdfpxdimen=1in % 1 dpi
- \divide\pdfpxdimen by 96 % 96 dpi
+ \pdfpxdimen=1in % 1 dpi
+ \divide\pdfpxdimen by 96 % 96 dpi
- -- http://www.tug.org/applications/pdftex/NEWS
+ -- http://www.tug.org/applications/pdftex/NEWS
* Modern TeX distributions use pdftex also for dvi generation
(i.e. ``latex`` actually calls ``pdftex`` with some options).
@@ -267,7 +267,17 @@
Disable the creation of local ToCs (ignoring all special commands) by
replacing ``\usepackage{minitoc} with ``\usepackage{mtcoff}``.
+Default font in admonitions and sidebar
+---------------------------------------
+New feature:
+ Use default font in admonitions and sidebar.
+
+Backward compatibility:
+ See the fallback definitions for admonitions_, `topic title`_ and
+ `sidebar`_.
+
+
Shorter preamble
----------------
@@ -283,7 +293,7 @@
\usepackage{shortvrb}
\usepackage{amsmath}
-
+
Packages that are conditionally loaded
``````````````````````````````````````
@@ -296,36 +306,36 @@
Standard package for tables across several pages::
\usepackage{longtable}
-
+
Extra space between text in tables and the line above them
('array' is implicitely loaded by 'tabularx', see below)::
\usepackage{array}
\setlength{\extrarowheight}{2pt}
-
+
Table cells spanning multiple rows::
\usepackage{multirow}
-
+
Docinfo
^^^^^^^
One-page tables with auto-width columns::
\usepackage{tabularx}
-
+
Images
^^^^^^
Include graphic files::
\usepackage{graphicx}
-
+
Problematic, Sidebar
^^^^^^^^^^^^^^^^^^^^
Set text and/or background colour, coloured boxes with ``\colorbox``::
\usepackage{color}
-
+
Floats for footnotes settings
`````````````````````````````
@@ -347,8 +357,8 @@
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}
% end floats for footnotes
-
-
+
+
Special lengths, commands, and environments
-------------------------------------------
@@ -358,12 +368,12 @@
admonition width
^^^^^^^^^^^^^^^^
The ``admonitionwith`` lenght is replaced by the more powerful
-``\DUadmonition`` (see `New Definitions`_)::
+``\DUadmonition`` command (see `New Definitions`_)::
\newlength{\admonitionwidth}
\setlength{\admonitionwidth}{0.9\textwidth}
-
-
+
+
Renamed definitions (now conditional)
`````````````````````````````````````
@@ -386,10 +396,10 @@
\newlength{\docinfowidth}
\setlength{\docinfowidth}{0.9\textwidth}
-
+
\newlength{\DUdocinfowidth}
\AtBeginDocument{\setlength{\DUdocinfowidth}{\docinfowidth}}
-
+
line block
^^^^^^^^^^
::
@@ -404,13 +414,13 @@
\leftmargin#1}
\raggedright}
{\end{list}}
-
+
\newlength{\DUlineblockindent}
\AtBeginDocument{\setlength{\DUlineblockindent}{\lineblockindentation}}
\newenvironment{DUlineblock}[1]
{\begin{lineblock}{#1}}
{\end{lineblock}}
-
+
local line width
^^^^^^^^^^^^^^^^
@@ -418,7 +428,7 @@
by ``\DUtablewidth``. It was never intended for customization::
\newlength{\locallinewidth}
-
+
option lists
^^^^^^^^^^^^
::
@@ -433,39 +443,41 @@
\addtolength{\leftmargin}{\labelsep}
\renewcommand{\makelabel}{\optionlistlabel}}
}{\end{list}}
-
+
\newcommand{\DUoptionlistlabel}{\optionlistlabel}
\newenvironment{DUoptionlist}
{\begin{optionlist}{3cm}}
{\end{optionlist}}
-
+
rubric
^^^^^^
::
\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}}
-
+
\newcommand{\DUrubric}[1]{\rubric{#1}}
-
+
title reference role
^^^^^^^^^^^^^^^^^^^^
::
\newcommand{\titlereference}[1]{\textsl{#1}}
-
+
\newcommand{\DUroletitlereference}[1]{\titlereference{#1}}
-
-
+
+
New definitions
```````````````
New Feature:
Enable customization of some more Docutils elements with special commands
- :sidebar: ``DUsidebar`` command
- :transition: ``\DUtransition`` command
- :admonition: ``DUadmonition`` environment (replacing ``\admonitionwidth``)
- :field list: ``DUfieldlist`` environment
+ :admonition: ``DUadmonition`` environment (replacing ``\admonitionwidth``),
+ :field list: ``DUfieldlist`` environment,
+ :sidebar: ``\DUsidebar``, ``\DUsidebartitle``, and ``DUsidebarsubtitle``
+ commands,
+ :topic: ``\DUtopictitle`` command,
+ :transition: ``\DUtransition`` command.
Backwards compatibility:
In most cases, the default definition corresponds to the previously used
@@ -474,10 +486,35 @@
admonitions
^^^^^^^^^^^
-Use the old variable for `admonition width`_::
+Use sans-serif fonts and the old variable for `admonition width`_::
\newcommand{\DUadmonition}[1]{%
\begin{center}
\fbox{\parbox{\admonitionwidth}{\sffamily #1}}
\end{center}
}
+
+
+topic title
+^^^^^^^^^^^
+Title for "topics" (admonitions, sidebar).
+
+Larger font size::
+
+ \providecommand*{\DUtopictitle}[1]{\textbf{\large #1}\smallskip}
+
+sidebar
+^^^^^^^
+Use sans-serif fonts and a darker shade of grey::
+
+ \providecommand{\DUsidebar}[1]{%
+ \begin{center}
+ \sffamily
+ \fbox{\colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#1}}}
+ \end{center}
+ }
+
+Bold sub-title::
+
+ \providecommand*{\DUsidebarsubtitle}[1]{\hspace*{\fill}\\
+ \textbf{#1}\smallskip}
Modified: trunk/docutils/docs/user/latex.txt
===================================================================
--- trunk/docutils/docs/user/latex.txt 2009-05-18 09:40:42 UTC (rev 5949)
+++ trunk/docutils/docs/user/latex.txt 2009-05-18 10:09:22 UTC (rev 5950)
@@ -234,14 +234,14 @@
``\DUadmonition``
Default:
- Typeset in a frame (90 % of text width) using a sans-serif font.
+ Typeset in a frame (90 % of text width).
Example:
- use standard document font and 95 % of text widht::
+ use sans-serif font and 95 % of text widht::
\newcommand{\DUadmonition}[1]{%
\begin{center}
- \fbox{\parbox{0.95\textwidth}{#1}}
+ \fbox{\parbox{0.95\textwidth}{\textsf{#1}}}
\end{center}
}
@@ -1072,25 +1072,17 @@
Default:
Box (similar to admonition) with grey background.
- Sans-serif fonts.
-Examples:
- Use a lighter background and standard document fonts::
+Example:
+ Use margin notes ::
- \newcommand{\DUsidebar}[1]{%
- \begin{center}
- \fbox{\colorbox[gray]{0.95}{\parbox{0.9\textwidth}{#1}}}
- \end{center}
- }
+ \newcommand{\DUsidebar}{\marginpar}
- Use margin notes with package marginnote_::
+ * Make sure the margin is wide enough to hold the note.
+ * This might fail with some constructs inside the `side bar` and where
+ \marginpar cannot be used, e.g., inside floats, footnotes, or in frames
+ made with the framed package (see marginnote_).
- \usepackage{marginnote}
- \newcommand{\DUsidebar}{\marginnote}
-
- * Make sure the margin is wide enought to hold the note.
- * This might fail with some constructs inside the `side bar`.
-
__ http://docutils.sf.net/docutils/docs/ref/rst/directives.html#sidebar
.. _marginnote:
http://dante.ctan.org/CTAN/macros/latex/contrib/marginnote/marginnote.pdf
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2009-05-18 09:40:42 UTC (rev 5949)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2009-05-18 10:09:22 UTC (rev 5950)
@@ -323,7 +323,7 @@
PreambleCmds.admonition = r"""% admonitions (specially marked "topics")
\providecommand{\DUadmonition}[1]{%
\begin{center}
- \fbox{\parbox{0.9\textwidth}{\sffamily #1}}
+ \fbox{\parbox{0.9\textwidth}{#1}}
\end{center}
}"""
@@ -414,16 +414,23 @@
}"""
PreambleCmds.rubric = r"""% rubric (an informal heading):
-\providecommand*{\DUrubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}}"""
+\providecommand*{\DUrubric}[1]{%
+ \subsection*{\centering\textit{\textmd{#1}}}%
+}"""
PreambleCmds.sidebar = r"""% sidebar (text outside the main text flow)
\providecommand{\DUsidebar}[1]{%
\begin{center}
- \sffamily
\fbox{\colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#1}}}
\end{center}
}"""
+PreambleCmds.sidebartitle = r"""% sidebar title
+\providecommand*{\DUsidebartitle}{\DUtopictitle}"""
+
+PreambleCmds.sidebarsubtitle = r"""% sidebar sub-title
+\providecommand*{\DUsidebarsubtitle}[1]{\hspace*{\fill}\\\emph{#1}\smallskip}"""
+
PreambleCmds.table = r"""\usepackage{longtable}
\usepackage{array}
\setlength{\extrarowheight}{2pt}
@@ -439,7 +446,7 @@
\providecommand*{\DUroletitlereference}[1]{\textsl{#1}}"""
PreambleCmds.topictitle = r"""% title for "topics" (admonitions, sidebar)
-\providecommand*{\DUtopictitle}[1]{\textbf{\large #1}\smallskip}"""
+\providecommand*{\DUtopictitle}[1]{\textbf{#1}\smallskip}"""
PreambleCmds.transition = r"""% transition ([fancy]break, anonymous section)
\providecommand*{\DUtransition}{\hspace*{\fill}\hrulefill\hspace*{\fill}}"""
@@ -2135,8 +2142,9 @@
def visit_subtitle(self, node):
if isinstance(node.parent, nodes.sidebar):
- self.body.append('~\\\\\n\\textbf{')
- self.context.append('}\n\\smallskip\n')
+ self.fallbacks['sidebarsubtitle'] = PreambleCmds.sidebarsubtitle
+ self.body.append('\\DUsidebarsubtitle{')
+ self.context.append('}\n')
elif isinstance(node.parent, nodes.document):
self.title += '\\\\\n\\large{%s}\n' % self.encode(node.astext())
raise nodes.SkipNode
@@ -2279,11 +2287,14 @@
self.context.append('\\hfill ~}\n')
# TODO: for admonition titles before the first section
# either specify every possible node or ... ?
- elif (isinstance(node.parent, nodes.sidebar) or
- isinstance(node.parent, nodes.admonition)):
+ elif isinstance(node.parent, nodes.admonition):
self.fallbacks['topictitle'] = PreambleCmds.topictitle
self.body.append('\\DUtopictitle{')
self.context.append('}\n')
+ elif isinstance(node.parent, nodes.sidebar):
+ self.fallbacks['sidebartitle'] = PreambleCmds.sidebartitle
+ self.body.append('\\DUsidebartitle{')
+ self.context.append('}\n')
elif isinstance(node.parent, nodes.table):
# caption must be written after column spec
self.active_table.caption = self.encode(node.astext())
Modified: trunk/docutils/docutils/writers/latex2e/docutils-05-compat.sty
===================================================================
--- trunk/docutils/docutils/writers/latex2e/docutils-05-compat.sty 2009-05-18 09:40:42 UTC (rev 5949)
+++ trunk/docutils/docutils/writers/latex2e/docutils-05-compat.sty 2009-05-18 10:09:22 UTC (rev 5950)
@@ -4,12 +4,15 @@
%
% :Author: Guenter Milde
% :Contact: milde@...
-% :Revision: $Revision: 5934 $
+% :Revision: $Revision: 5948 $
% :Date: $Date: 2009-02-24$
% :Copyright: © 2009 G. Milde,
% Released without warranties or conditions of any kind
% under the terms of the Apache License, Version 2.0
% http://www.apache.org/licenses/LICENSE-2.0
+% :Abstract: This file documents changes and provides a style for best
+% possible compatibility to the behaviour of the `latex2e`
+% writer of Doctutils release 0.5.
%
% ::
@@ -17,10 +20,6 @@
\ProvidesPackage{docutils-05-compat}
[2009/03/26 v0.1 compatibility with rst2latex from Docutils 0.5]
-% This file documents changes and provides a style for best possible
-% compatibility to the behaviour of the `latex2e` writer of Doctutils
-% release 0.5
-%
% .. contents::
% :depth: 3
%
@@ -68,7 +67,7 @@
% be a LaTeX package (``*.sty``) and referenced with the ``\usepackage``
% command.
%
-% .. tip::
+% .. important::
% Always specify the extension if you want the style sheet to be
% ``\input`` by LaTeX.
%
@@ -87,11 +86,10 @@
% class arguments to the node.
%
% Backwards compatibility:
-% SVN versions 5742 to 5861 contained an implementation that did not work
-% with commands expecting an argument. The implementation from version 5862
-% is fully backwards compatible.
+% The implementation is fully backwards compatible. (SVN versions 5742 to
+% 5861 contained an implementation that did not work with commands expecting
+% an argument.)
%
-%
% Length units
% ------------
%
@@ -105,14 +103,14 @@
% * ``px`` is a valid unit in pdftex since version 1.3.0 released on
% 2005-02-04:
%
-% 1px defaults to 1bp (or 72dpi), but can be changed with the \pdfpxdimen
-% primitive::
+% 1px defaults to 1bp (or 72dpi), but can be changed with the
+% ``\pdfpxdimen`` primitive.::
-% \pdfpxdimen=1in % 1 dpi
-% \divide\pdfpxdimen by 96 % 96 dpi
+ \pdfpxdimen=1in % 1 dpi
+ \divide\pdfpxdimen by 96 % 96 dpi
+
+% -- http://www.tug.org/applications/pdftex/NEWS
%
-% -- http://www.tug.org/applications/pdftex/NEWS
-%
% * Modern TeX distributions use pdftex also for dvi generation
% (i.e. ``latex`` actually calls ``pdftex`` with some options).
%
@@ -123,8 +121,8 @@
%
% This can be reset with ::
-% \pdfpxdimen=1pt
-%
+ \pdfpxdimen=1pt
+
% .. caution:: It is impossible to revert the change of lengths specified
% without unit in a style sheet, however the 0.3 % change will be
% imperceptible in most cases.
@@ -167,10 +165,10 @@
% Backwards compatibility:
% Load the ae and aeguill packages if fontenc is not used::
-% \@ifundefined{@ifl@...@@}
-% {\RequirePackage{ae,aeguill}}
-% {}
-%
+ \@ifundefined{@ifl@...@@}
+ {\RequirePackage{ae,aeguill}}
+ {}
+
% .. Why not ``\@ifpackageloaded{fontenc}``?
%
% 'fontenc' disables the test to enable loading more than once with
@@ -185,16 +183,16 @@
% Cleaner LaTeX source
% --------------------
%
-% * Remove redundant "double protection" from the encoding of the "special
-% printing characters" and square brackets, e.g. ``\%`` instead of ``{\%}``
-% and ::
-
-% \item {} -> \item % as '[' is already escaped
-% \item[{Term}] -> \item[Term]
-% \item [what:] -> \item[what:]
+% New feature:
+% * Remove redundant "double protection" from the encoding of the "special
+% printing characters" and square brackets, e.g. ``\%`` instead of
+% ``{\%}``.
+% * Remove some spurious whitespace, e.g. ``\item [what:] -> \item[what:]``.
+% * Use conventional style for "named" macros, e.g. ``\dots{}`` instead of
+% ``{\dots}``
%
-% * Use conventional style for "named" macros, e.g. ``\dots{}`` instead of
-% ``{\dots}``
+% Backwards compatibility:
+% Changes do not affect the output.
%
% Sub- and superscript as text
% ----------------------------
@@ -209,7 +207,7 @@
%
% * whitespace is ignored,
% * a different command set and font setting scheme is active,
-% * Latin letters are typeset italic but numbers upright
+% * Latin letters are typeset italic but numbers upright.
%
% Although it is possible to redefine ``\textsubscript`` and
% ``\textsuperscript`` to typeset the content in math-mode, this can lead to
@@ -219,17 +217,17 @@
% `custom roles`_ like ``.. role:: sub(subscript)`` and
% ``.. role:: super(superscript)`` and define the "role commands"::
-% \newcommand{\docutilsrolesub}{\itshape}
-% \newcommand{\docutilsrolesuper}{\itshape}
-%
+ \newcommand{\docutilsrolesub}{\itshape}
+ \newcommand{\docutilsrolesuper}{\itshape}
+
% Alternatively, if you want all sub- and superscripts in italic, redefine
% the macros::
-% %% \let\DUsup\textsubscript
-% %% \let\DUsuper\textsuperscript
-% %% \renewcommand*{\textsubscript}{\DUsub\itshape}
-% %% \renewcommand*{\textsuperscript}{\DUsuper\itshape}
-%
+ %% \let\DUsup\textsubscript
+ %% \let\DUsuper\textsuperscript
+ %% \renewcommand*{\textsubscript}{\DUsub\itshape}
+ %% \renewcommand*{\textsuperscript}{\DUsuper\itshape}
+
% This is not fully backwards compatible, as it will also set numbers in
% italic shape and not ignore whitespace.
%
@@ -250,14 +248,36 @@
% Up to version 0.5, use of `typearea` and a DIV setting of 12 were
% hard-coded into the latex2e writer ::
-% \usepackage{typearea}
-% \typearea{12}
-%
+ \usepackage{typearea}
+ \typearea{12}
+
% and the vertical alignment of lower boundary of the text area in book
% classes disabled via ::
-% \raggedbottom
+ \raggedbottom
+
+% Local tocs with `minitoc`
+% `````````````````````````
%
+% New feature:
+% If 'use-latex-toc' is set, local tables of content are typeset using the
+% 'minitoc' package (instead of being ignored).
+%
+% Backwards compatibility:
+% Disable the creation of local ToCs (ignoring all special commands) by
+% replacing ``\usepackage{minitoc} with ``\usepackage{mtcoff}``.
+%
+% Default font in admonitions and sidebar
+% ---------------------------------------
+%
+% New feature:
+% Use default font in admonitions and sidebar.
+%
+% Backward compatibility:
+% See the fallback definitions for admonitions_, `topic title`_ and
+% `sidebar`_.
+%
+%
% Shorter preamble
% ----------------
%
@@ -300,19 +320,19 @@
% Docinfo
% ^^^^^^^
%
-% Tables with automatic width of columns, always on one page::
+% One-page tables with auto-width columns::
\usepackage{tabularx}
% Images
% ^^^^^^
-% ::
+% Include graphic files::
\usepackage{graphicx}
% Problematic, Sidebar
% ^^^^^^^^^^^^^^^^^^^^
-% Set text and/or background colour, provide ``\colorbox``::
+% Set text and/or background colour, coloured boxes with ``\colorbox``::
\usepackage{color}
@@ -348,7 +368,7 @@
% admonition width
% ^^^^^^^^^^^^^^^^
% The ``admonitionwith`` lenght is replaced by the more powerful
-% ``\DUadmonition`` (see `New Definitions`_)::
+% ``\DUadmonition`` command (see `New Definitions`_)::
\newlength{\admonitionwidth}
\setlength{\admonitionwidth}{0.9\textwidth}
@@ -452,10 +472,12 @@
% New Feature:
% Enable customization of some more Docutils elements with special commands
%
-% :sidebar: ``DUsidebar`` command
-% :transition: ``\DUtransition`` command
-% :admonition: ``DUadmonition`` environment (replacing ``\admonitionwidth``)
-% :field list: ``DUfieldlist`` environment
+% :admonition: ``DUadmonition`` environment (replacing ``\admonitionwidth``),
+% :field list: ``DUfieldlist`` environment,
+% :sidebar: ``\DUsidebar``, ``\DUsidebartitle``, and ``DUsidebarsubtitle``
+% commands,
+% :topic: ``\DUtopictitle`` command,
+% :transition: ``\DUtransition`` command.
%
% Backwards compatibility:
% In most cases, the default definition corresponds to the previously used
@@ -464,10 +486,35 @@
%
% admonitions
% ^^^^^^^^^^^
-% Use the old variable for `admonition width`_::
+% Use sans-serif fonts and the old variable for `admonition width`_::
\newcommand{\DUadmonition}[1]{%
\begin{center}
\fbox{\parbox{\admonitionwidth}{\sffamily #1}}
\end{center}
}
+
+
+% topic title
+% ^^^^^^^^^^^
+% Title for "topics" (admonitions, sidebar).
+%
+% Larger font size::
+
+\providecommand*{\DUtopictitle}[1]{\textbf{\large #1}\smallskip}
+
+% sidebar
+% ^^^^^^^
+% Use sans-serif fonts and a darker shade of grey::
+
+\providecommand{\DUsidebar}[1]{%
+ \begin{center}
+ \sffamily
+ \fbox{\colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#1}}}
+ \end{center}
+}
+
+% Bold sub-title::
+
+\providecommand*{\DUsidebarsubtitle}[1]{\hspace*{\fill}\\
+ \textbf{#1}\smallskip}
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2009-05-18 09:40:42 UTC (rev 5949)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2009-05-18 10:09:22 UTC (rev 5950)
@@ -35,7 +35,7 @@
% admonitions (specially marked "topics")
\providecommand{\DUadmonition}[1]{%
\begin{center}
- \fbox{\parbox{0.9\textwidth}{\sffamily #1}}
+ \fbox{\parbox{0.9\textwidth}{#1}}
\end{center}
}
% width of docinfo table:
@@ -84,18 +84,23 @@
{\endlist}
}{}
% rubric (an informal heading):
-\providecommand*{\DUrubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}}
+\providecommand*{\DUrubric}[1]{%
+ \subsection*{\centering\textit{\textmd{#1}}}%
+}
% sidebar (text outside the main text flow)
\providecommand{\DUsidebar}[1]{%
\begin{center}
- \sffamily
\fbox{\colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#1}}}
\end{center}
}
+% sidebar sub-title
+\providecommand*{\DUsidebarsubtitle}[1]{\hspace*{\fill}\\\emph{#1}\smallskip}
+% sidebar title
+\providecommand*{\DUsidebartitle}{\DUtopictitle}
% title reference role:
\providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
% title for "topics" (admonitions, sidebar)
-\providecommand*{\DUtopictitle}[1]{\textbf{\large #1}\smallskip}
+\providecommand*{\DUtopictitle}[1]{\textbf{#1}\smallskip}
% transition ([fancy]break, anonymous section)
\providecommand*{\DUtransition}{\hspace*{\fill}\hrulefill\hspace*{\fill}}
% hyperref (PDF hyperlinks):
@@ -945,14 +950,16 @@
{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
This paragraph might flow around the image.
-If it does or not, depends on the output format and the viewer.
+The specific behavior depends upon the style sheet and
+the browser or rendering software used.
A right-aligned image:
{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
This paragraph might flow around the image.
-If it does or not, depends on the output format and the viewer.
+The specific behavior depends upon the style sheet and
+the browser or rendering software used.
For inline images see \href{\#substitution-definitions}{Substitution Definitions}.
@@ -1019,8 +1026,8 @@
The legend may consist of several paragraphs.
}\end{flushleft}\end{figure}
-This paragraph might flow around the figure if the \texttt{figwidth}
-argument is set and smaller than the text width.
+This paragraph might flow around the figure. The specific behavior depends
+upon the style sheet and the browser or rendering software used.
A centered figure:
\begin{figure}[htbp]
@@ -1033,8 +1040,8 @@
The legend may consist of several paragraphs.
}\end{figure}
-This paragraph might flow around the figure if the \texttt{figwidth}
-argument is set and smaller than the text width.
+This paragraph might flow around the figure. The specific behavior depends
+upon the style sheet and the browser or rendering software used.
A right-aligned figure:
\begin{figure}[htbp]\begin{flushright}
@@ -1046,8 +1053,8 @@
The legend may consist of several paragraphs.
}\end{flushright}\end{figure}
-This paragraph might flow around the figure if the \texttt{figwidth}
-argument is set and smaller than the text width.
+This paragraph might flow around the figure. The specific behavior depends
+upon the style sheet and the browser or rendering software used.
%___________________________________________________________________________
@@ -1119,10 +1126,8 @@
\label{topics-sidebars-and-rubrics}
\DUsidebar{
-\DUtopictitle{Sidebar Title}
-~\\
-\textbf{Optional Subtitle}
-\smallskip
+\DUsidebartitle{Sidebar Title}
+\DUsidebarsubtitle{Optional Subtitle}
This is a sidebar. It is for text outside the flow of the main
text.
|