Discussion:
[Docutils-users] broken ..epigraph in XeTeX?
Matěj Cepl
2017-02-04 16:51:05 UTC
Permalink
So, I have a document which should start like this:


Druhý život Petunie Dursleyové
##############################

.. epigraph::

Co je nejvyšším cílem člověka?

Nejvyšším cílem člověka je oslavovat Boha a věčně se
z Něj radovat.

-- Westminsterský katechismus, 1647

Na cizinecké policii
--------------------

Hustě sněžilo, obloha byla zatažená a cítila se mizerně.
Její náladě ani nepřidalo to, že budova cizinecké policie

This works perfectly with rst2html (or rst2html5 for that
matter, which seems a way cooler ... thank you for that!), but
it completely breaks rst2xetex. I get this LaTeX code for the
epigraph:

\begin{quote}
\DUrole{epigraph}{
Co je nejvyšším cílem člověka?

Nejvyšším cílem člověka je oslavovat Boha a věčně se z Něj
radovat.
\nopagebreak

\raggedleft —Westminsterský katechismus, 1647
}
\end{quote}

And this error when run through xelatex:

Runaway argument?
{ Co je nejvyšším cílem člověka?
! Paragraph ended before \DUrole was complete.
<to be read again>
\par
l.71

How can I have a paragraph break inside of ..epigraph?

Best,

Matěj
--
https://matej.ceplovi.cz/blog/, Jabber: ***@ceplovi.cz
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8

Always make new mistakes
-- Esther Dyson
Alan G. Isaac
2017-02-04 20:26:33 UTC
Permalink
Post by Matěj Cepl
\begin{quote}
\DUrole{epigraph}{
Co je nejvyšším cílem člověka?
Nejvyšším cílem člověka je oslavovat Boha a věčně se z Něj
radovat.
\nopagebreak
\raggedleft —Westminsterský katechismus, 1647
}
\end{quote}
Is this another abuse of the ``quote`` environment
to accomplish indentation? If so, this again
compromises the ability to separately style
quotes and other content (in this case, epigraphs).

Note that the ``changepage`` package provides ``adjustwidth``.
E.g., one could define
\newenvironment{DUepigraph}%
{\begin{adjustwidth}{2cm}{}}%
{\end{adjustwidth}}

Other default formatting could be added as desired.
This approach would allow authors to readily modify
the ``epigraph`` environment (with ``renewenvironment``)
without interfering with other environments.

The ``quote`` environment is for (one paragraph) quotes.
It is not a general indentation facility.
https://en.wikibooks.org/wiki/LaTeX/Paragraph_Formatting#Quoting_text

Cheers,
Alan Isaac

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All"
Guenter Milde
2017-02-04 21:41:24 UTC
Permalink
Post by Alan G. Isaac
Post by Matěj Cepl
\begin{quote}
\DUrole{epigraph}{
Co je nejvyšším cílem člověka?
Nejvyšším cílem člověka je oslavovat Boha a věčně se z Něj
radovat.
\nopagebreak
\raggedleft —Westminsterský katechismus, 1647
}
\end{quote}
Is this another abuse of the ``quote`` environment
to accomplish indentation?
No. See the description of the "epigraph" directive.

Docutils converts it to

<block_quote classes="epigraph">

and currently handling of block-quotes and some other environments with
classes is broken.

This will be fixed soon.
Post by Alan G. Isaac
If so, this again compromises the ability to separately style quotes
and other content (in this case, epigraphs).
Not if the class arguments are handled correctly.
Post by Alan G. Isaac
Note that the ``changepage`` package provides ``adjustwidth``.
E.g., one could define
\newenvironment{DUepigraph}%
{\begin{adjustwidth}{2cm}{}}%
{\end{adjustwidth}}
Other default formatting could be added as desired.
This approach would allow authors to readily modify
the ``epigraph`` environment (with ``renewenvironment``)
without interfering with other environments.
The ``quote`` environment is for (one paragraph) quotes.
It is not a general indentation facility.
https://en.wikibooks.org/wiki/LaTeX/Paragraph_Formatting#Quoting_text
Both "quote" and "quotation" provide for multiple paragraphs.
(Just try it.)

The error originates in the \DUrole definition with \providecommand*,
the star makes this check for paragraph breaks in the argument.


Patch attached.

Günter

Dir: docutils-svn/docutils/docutils/writers/latex2e/

Index: __init__.py
===================================================================
--- __init__.py (Revision 8020)
+++ __init__.py (Arbeitskopie)
@@ -494,6 +494,7 @@
PreambleCmds.align_center = r"""
\makeatletter
\@namedef{DUrolealign-center}{\centering}
+\@namedef{DUclassalign-center}{\centering}
\makeatother
"""

@@ -512,6 +513,15 @@
% dedication topic
\providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}}"""

+PreambleCmds.DUclass = r"""
+% class handling for environments (block-level elements)
+% \DUclass{#1} tries \DUrole#1
+\providecommand{\DUclass}[1]{%
+ \ifcsname DUclass#1\endcsname%
+ \csname DUclass#1\endcsname%
+ \fi%
+}"""
+
PreambleCmds.error = r"""
% error admonition title
\providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}"""
@@ -1568,6 +1578,19 @@
labels.insert(0, '\\phantomsection')
return labels

+ def insert_DUclass_macros(self, node):
+ for cls in node['classes']:
+ if cls == 'align-center':
+ self.fallbacks['align-center'] = PreambleCmds.align_center
+ if cls.startswith('language-'):
+ language = self.babel.language_name(cls[9:])
+ if language:
+ self.babel.otherlanguages[language] = True
+ self.out.append('\\selectlanguage{%s}%\n' % language)
+ else:
+ self.fallbacks['DUclass'] = PreambleCmds.DUclass
+ self.out.append('\\DUclass{%s}%%\n' % cls)
+
def push_output_collector(self, new_out):
self.out_stack.append(self.out)
self.out = new_out
@@ -1631,12 +1654,9 @@

def visit_block_quote(self, node):
self.out.append( '%\n\\begin{quote}\n')
- if node['classes']:
- self.visit_inline(node)
+ self.insert_DUclass_macros(node)

def depart_block_quote(self, node):
- if node['classes']:
- self.depart_inline(node)
self.out.append( '\n\\end{quote}\n')

def visit_bullet_list(self, node):
@@ -1644,12 +1664,9 @@
self.out.append( '%\n\\begin{list}{}{}\n' )
else:
self.out.append( '%\n\\begin{itemize}\n' )
- # if node['classes']:
- # self.visit_inline(node)
+ self.insert_DUclass_macros(node)

def depart_bullet_list(self, node):
- # if node['classes']:
- # self.depart_inline(node)
if self.is_toc_list:
self.out.append( '\n\\end{list}\n' )
else:
@@ -1813,6 +1830,7 @@

def visit_definition_list(self, node):
self.out.append( '%\n\\begin{description}\n' )
+ self.insert_DUclass_macros(node)

def depart_definition_list(self, node):
self.out.append( '\\end{description}\n' )
@@ -2093,11 +2111,11 @@
if 'start' in node:
self.out.append('\\setcounter{%s}{%d}\n' %
(counter_name,node['start']-1))
+ self.insert_DUclass_macros(node)
# ## set rightmargin equal to leftmargin
# self.out.append('\\setlength{\\rightmargin}{\\leftmargin}\n')


-
def depart_enumerated_list(self, node):
if len(self._enumeration_counters) <= 4:
self.out.append('\\end{enumerate}\n')
@@ -2130,6 +2148,7 @@
if self.out is not self.docinfo:
self.fallbacks['fieldlist'] = PreambleCmds.fieldlist
self.out.append('%\n\\begin{DUfieldlist}\n')
+ self.insert_DUclass_macros(node)

def depart_field_list(self, node):
if self.out is not self.docinfo:
@@ -2163,6 +2182,7 @@
self.out.append('\n\\begin{figure}\n')
if node.get('ids'):
self.out += self.ids_to_labels(node) + ['\n']
+ self.insert_DUclass_macros(node)

def depart_figure(self, node):
self.out.append('\\end{figure}\n')
@@ -2391,14 +2411,9 @@
'\\begin{DUlineblock}{\\DUlineblockindent}\n')
else:
self.out.append('\n\\begin{DUlineblock}{0em}\n')
- if node['classes']:
- self.visit_inline(node)
- self.out.append('\n')
+ self.insert_DUclass_macros(node)

def depart_line_block(self, node):
- if node['classes']:
- self.depart_inline(node)
- self.out.append('\n')
self.out.append('\\end{DUlineblock}\n')

def visit_list_item(self, node):
@@ -2576,6 +2591,7 @@
self.fallbacks['_providelength'] = PreambleCmds.providelength
self.fallbacks['optionlist'] = PreambleCmds.optionlist
self.out.append('%\n\\begin{DUoptionlist}\n')
+ self.insert_DUclass_macros(node)

def depart_option_list(self, node):
self.out.append('\n\\end{DUoptionlist}\n')
@@ -2731,6 +2747,7 @@
self.requirements['color'] = PreambleCmds.color
self.fallbacks['sidebar'] = PreambleCmds.sidebar
self.out.append('\n\\DUsidebar{\n')
+ self.insert_DUclass_macros(node)

def depart_sidebar(self, node):
self.out.append('}\n')


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Pleas
Matěj Cepl
2017-02-04 22:21:15 UTC
Permalink
Post by Guenter Milde
Patch attached.
When reapplying this patch to my Fedora package (and I got
http://paste.fedoraproject.org/546590/62467941/) I get these
errors in the testsuite
(https://paste.fedoraproject.org/546589/14862467/).

Any thoughts?

Matěj
--
https://matej.ceplovi.cz/blog/, Jabber: ***@ceplovi.cz
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8

How many Bavarian Illuminati does it take to screw in a light
bulb?
Three: one to screw it in, and one to confuse the issue.
Matěj Cepl
2017-02-04 23:38:18 UTC
Permalink
Post by Matěj Cepl
Post by Guenter Milde
Patch attached.
When reapplying this patch to my Fedora package (and I got
http://paste.fedoraproject.org/546590/62467941/) I get these
errors in the testsuite
(https://paste.fedoraproject.org/546589/14862467/).
And yes, when I switch of the checking of the testsuite (which
I would rather not), then the patch really helps to solve the
problem.

Thanks,

Matěj
--
https://matej.ceplovi.cz/blog/, Jabber: ***@ceplovi.cz
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8

Reality is merely an illusion, albeit a very persistent one.
-- Albert Einstein


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Rep
Guenter Milde
2017-02-05 08:20:35 UTC
Permalink
Post by Matěj Cepl
Post by Matěj Cepl
Post by Guenter Milde
Patch attached.
When reapplying this patch to my Fedora package (and I got
http://paste.fedoraproject.org/546590/62467941/) I get these
errors in the testsuite
(https://paste.fedoraproject.org/546589/14862467/).
The proposed patch to the LaTeX writer changed the output of the test samples.
This was expected. Now I have to check if these changes are as intended and
don't break other parts.

The complete patch will also contain an update of the testsuite and
documentation, of course.
Post by Matěj Cepl
And yes, when I switch of the checking of the testsuite (which
I would rather not), then the patch really helps to solve the
problem.
Glad to hear this.


Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please
Guenter Milde
2017-02-09 14:12:52 UTC
Permalink
Post by Matěj Cepl
Post by Guenter Milde
Patch attached.
When reapplying this patch to my Fedora package (and I got
http://paste.fedoraproject.org/546590/62467941/) I get these
errors in the testsuite
(https://paste.fedoraproject.org/546589/14862467/).
Any thoughts?
A (temporary) complete patch is now available under
https://sourceforge.net/p/docutils/patches/99/#be1e

It will be discussed in docutils-devel and eventually a version of this or
some other solution be included in the repo.

Thanks,

Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply A

Alan G. Isaac
2017-02-04 22:50:38 UTC
Permalink
Post by Guenter Milde
Both "quote" and "quotation" provide for multiple paragraphs.
I did not mean to call that into question
Indeed, this is addressed at the link I provided:
https://en.wikibooks.org/wiki/LaTeX/Paragraph_Formatting#Quoting_text

My point was rather that these are **quotation** environments,
not general indentation environments. To use a quotation
environment whenever indentation is needed is to disregard
its intended use (semantics). That is my point.
Post by Guenter Milde
Post by Alan G. Isaac
this again compromises the ability to separately style quotes
and other content (in this case, epigraphs).
Not if the class arguments are handled correctly.
I thought that this makes it impossible to change the
formatting of actual quotes without having that spilling
over to other environments (such as epigraph).
Your response seems to suggest otherwise. How for example
would I style quotes to have an extra one inch margin on the left
and right but epigraphs to have an extra two inches on the left only?
(I am assuming that epigraphs continue to be wrapped in a ``quote``
environment.) Am I overlooking something obvious?

Thanks,
Alan

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Guenter Milde
2017-02-05 08:40:30 UTC
Permalink
Post by Alan G. Isaac
Post by Guenter Milde
Both "quote" and "quotation" provide for multiple paragraphs.
I did not mean to call that into question
https://en.wikibooks.org/wiki/LaTeX/Paragraph_Formatting#Quoting_text
My point was rather that these are **quotation** environments,
not general indentation environments. To use a quotation
environment whenever indentation is needed is to disregard
its intended use (semantics). That is my point.
However, according to the wiktionary, an epigraph is

1. an inscription, especially one on a building.
2. a literary quotation placed at the beginning of a book or other
text.
3. (mathematics, of a function) the set of all points lying on or above
the function's graph.

For Docutils, 2. is relevant and hence it defines the "epigraph" directive:

Epigraph

Directive Type
“epigraph”

Doctree Element
block_quote

Directive Arguments
None.

Directive Options
None.

Directive Content
Interpreted as the body of the block quote.

An epigraph is an apposite (suitable, apt, or pertinent) short
inscription, often a quotation or poem, at the beginning of a document
or section.

The “epigraph” directive produces an “epigraph”-class block quote. For
example, this input:

.. epigraph::

No matter where you go, there you are.

-- Buckaroo Banzai

becomes this document tree fragment:

<block_quote classes="epigraph">
<paragraph>
No matter where you go, there you are.
<attribution>
Buckaroo Banzai
Post by Alan G. Isaac
Post by Guenter Milde
Post by Alan G. Isaac
this again compromises the ability to separately style quotes
and other content (in this case, epigraphs).
Not if the class arguments are handled correctly.
I thought that this makes it impossible to change the
formatting of actual quotes without having that spilling
over to other environments (such as epigraph).
Formatting block quotes will "spill over" to epigraphs by default.
*This is intended*, as an epigraph is a special quote.

It can be offset by styling the quote environments with class value epigraph
(in HTML you use CSS rules, in LaTeX by defining a function \DUclassepigraph).
Post by Alan G. Isaac
Your response seems to suggest otherwise. How for example
would I style quotes to have an extra one inch margin on the left
and right but epigraphs to have an extra two inches on the left only?
(I am assuming that epigraphs continue to be wrapped in a ``quote``
environment.) Am I overlooking something obvious?
I LaTeX, the above epigraph becomes

\begin{quote}
\DUclass{epigraph}%

No matter where you go, there you are.
\nopagebreak

\raggedleft —Buckaroo Banzai

\end{quote}


I don't know the details of margin changing off by heart, but the idea is
to use the "class macro" to style the environments with the given class, e.g.
to set the epigraph in italics, you can write

\newcommand{\DUclassepigraph}{\em}

in the preamble.

Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Alan G. Isaac
2017-02-05 16:22:04 UTC
Permalink
Post by Guenter Milde
LaTeX, the above epigraph becomes
\begin{quote}
\DUclass{epigraph}%
No matter where you go, there you are.
\nopagebreak
\raggedleft —Buckaroo Banzai
\end{quote}
1. Did things very recently change, or is that \DUrole not \DUclass?
I cannot update at the moment, but I suppose this changed in
response to Matěj.
2. Fixing that, this does not compile, because of the paragraph break.
3. That failure is linked to this ongoing discussion. I.e., it
illustrates why environments should be used.
(Perhaps the change in response to Matěj fixes this.)
4. Also related, note that this structure makes no allowance for
separate formatting of the author (in contrast to the HTML output).
E.g., suppose I want the text in italic but not the author name?
(Easy in HTML+CSS. Would be easy here too if environments were used...)

Thanks,
Alan Isaac
Guenter Milde
2017-02-05 18:49:55 UTC
Permalink
Post by Alan G. Isaac
Post by Guenter Milde
LaTeX, the above epigraph becomes
\begin{quote}
\DUclass{epigraph}%
No matter where you go, there you are.
\nopagebreak
\raggedleft —Buckaroo Banzai
\end{quote}
1. Did things very recently change, or is that \DUrole not \DUclass?
I cannot update at the moment, but I suppose this changed in
response to Matěj.
It is \DUrole, a new function introduced in the patch I posted in my
first response.
Post by Alan G. Isaac
2. Fixing that, this does not compile, because of the paragraph break.
This is what the OP reported.
Post by Alan G. Isaac
3. That failure is linked to this ongoing discussion. I.e., it
illustrates why environments should be used.
(Perhaps the change in response to Matěj fixes this.)
Yes, the change fixed this.
Post by Alan G. Isaac
4. Also related, note that this structure makes no allowance for
separate formatting of the author (in contrast to the HTML output).
Just like in "normal" quotes and many other instances.
Post by Alan G. Isaac
E.g., suppose I want the text in italic but not the author name?
(Easy in HTML+CSS.
Yes, HTML/CSS works with the classes a lot better than LaTeX. The \DUrole
and \DUclass functions are a attempt to bring at least some of this
functionality to LaTeX.

OTOH, I can define something like ::

\let\origraggedleft\raggedleft
\newcommand{\DUclassepigraph}{%
\em%
\renewcommand{\raggedleft}{\origraggedleft\rm}
}

Untested.
Post by Alan G. Isaac
Would be easy here too if environments were used...)
I agree that the possibilities are limited, but I don't see how replacing
{quote} with another environment would help.

Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All
Alan G. Isaac
2017-02-05 16:26:42 UTC
Permalink
Post by Guenter Milde
Formatting block quotes will "spill over" to epigraphs by default.
*This is intended*, as an epigraph is a special quote.
As you say: *by default*.
But my question is:
how can the *user* readily decouple them?

In HTML+CSS this is trivial.
My question is:
how can this be made trivial with LaTeX output?

The problem is the different model in LaTeX:
environments cannot truly be arbitrarily classed.

I assume we agree that epigraphs are often
indented differently in a document than
regular block quotes. For example, in a book
I am now reading, the epigraphs have no indentation.

Your proposal (if I understand it) is that LaTeX
users somehow try to style the environment content
rather than the environment. Your example was::

\newcommand{\DUclassepigraph}{\em}

I do not see how a user can discard the surrounding
quote environment with this approach (e.g., to
achieve the formatting in the book mentioned above).
Again, if this were done with environments, the use
could just use ``\renewenvironment``. Would such
an approach create implementation difficulties?

Thanks,
Alan

PS Since I seem to quickly wear out my welcome on this
list (for reasons I do not quite understand), I will not
say anything more about this.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Guenter Milde
2017-02-05 19:01:39 UTC
Permalink
Post by Alan G. Isaac
Post by Guenter Milde
Formatting block quotes will "spill over" to epigraphs by default.
*This is intended*, as an epigraph is a special quote.
As you say: *by default*.
how can the *user* readily decouple them?
In HTML+CSS this is trivial.
how can this be made trivial with LaTeX output?
It cannot be made trivial, unfortunately.
Post by Alan G. Isaac
environments cannot truly be arbitrarily classed.
Nothing can be arbitrarily classed in LaTeX.
And "epigraph" is just one example. A user could set any class value to any
object -- is it unfeasable to have special environments and functions
prepared for all of them.
Post by Alan G. Isaac
I assume we agree that epigraphs are often
indented differently in a document than
regular block quotes. For example, in a book
I am now reading, the epigraphs have no indentation.
Your proposal (if I understand it) is that LaTeX
users somehow try to style the environment content
\newcommand{\DUclassepigraph}{\em}
Yes.
Post by Alan G. Isaac
I do not see how a user can discard the surrounding
quote environment with this approach (e.g., to
achieve the formatting in the book mentioned above).
In most cases, there is no need to "swap" the complete environment. E.g.
changing margins (your above example) is relatively simple also "from
inside" an environment.
Post by Alan G. Isaac
Again, if this were done with environments, the use
could just use ``\renewenvironment``. Would such
an approach create implementation difficulties?
The idea is to keep the LaTeX source as simple as possible while still
allowing customization.

With ::

\begin{something}
\DUclass{classvalue}

content
\end{something}

the redefintions by \DUclassclassvalue are confined to the environment
without further effort.
Alternatively, one could use an additional wrapper ::

{
\DUclass{classvalue}
\begin{something}

content
\end{something}
}

or a 2-arg class macro:

\DUclass{classvalue}{%
\begin{something}

content
\end{something}%
}

This would allow a complete redefinition of the environments
in the \DUclass function at the cost of additional nesting.

Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the
Matěj Cepl
2017-02-04 21:52:46 UTC
Permalink
Post by Alan G. Isaac
Is this another abuse of the ``quote`` environment
to accomplish indentation? If so, this again
compromises the ability to separately style
quotes and other content (in this case, epigraphs).
OK, so what should I do?
Post by Alan G. Isaac
Note that the ``changepage`` package provides ``adjustwidth``.
E.g., one could define
\newenvironment{DUepigraph}%
{\begin{adjustwidth}{2cm}{}}%
{\end{adjustwidth}}
How can I redefine already existing environment? In
docutils.conf?

Matěj
--
https://matej.ceplovi.cz/blog/, Jabber: ***@ceplovi.cz
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8

It is the mark of an educated mind to be able to entertain
a thought without accepting it.
-- Aristotle


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

P
Guenter Milde
2017-02-06 09:33:32 UTC
Permalink
Post by Matěj Cepl
Druhý život Petunie Dursleyové
##############################
Co je nejvyšším cílem člověka?
Nejvyšším cílem člověka je oslavovat Boha a věčně se
z Něj radovat.
-- Westminsterský katechismus, 1647
Na cizinecké policii
--------------------
Hustě sněžilo, obloha byla zatažená a cítila se mizerně.
Její náladě ani nepřidalo to, že budova cizinecké policie
This works perfectly with rst2html (or rst2html5 for that
matter, which seems a way cooler ... thank you for that!), but
it completely breaks rst2xetex.
I get this LaTeX code for the
Post by Matěj Cepl
\begin{quote}
\DUrole{epigraph}{
Co je nejvyšším cílem člověka?
Nejvyšším cílem člověka je oslavovat Boha a věčně se z Něj
radovat.
\nopagebreak
\raggedleft —Westminsterský katechismus, 1647
}
\end{quote}
Runaway argument?
{ Co je nejvyšším cílem člověka?
! Paragraph ended before \DUrole was complete.
<to be read again>
\par
l.71
The reason for the error is a bug in the LaTeX writer:

\DUrole is a LaTeX macro to give some sort of support for styling via
class arguments in inline markup (Docutils roles).
See http://docutils.sourceforge.net/docs/user/latex.html#custom-interpreted-text-roles

It is defined with \providecommand* -- the starred version does not allow
paragraph breaks withing the argument to allow better error reporting.
This is good for inline markup.

Unfortunatly, this limitation was not accounted for when the "ersatz class
mechnism" was used for some block-level objects (e.g. "quote").
Post by Matěj Cepl
How can I have a paragraph break inside of ..epigraph?
Unless you intend a special styling for epigraphs, using a standard quote
is the most simple workaround.

E.g. by removing the "directive dots"::

.. epigraph (currently the LaTeX writer fails with epigraph)

Co je nejvyšším cílem člověka?

...

Explanation:

The `epigraph` directive is just syntactic sugar for::

.. class:: epigraph

..

The epigraph text

i.e. the content is converted to a quote element with class argument
"epigraph" by Docutils during the parsing.


A fix will follow, but needs some more discussion and thougts about the
optimal approach.

Günter


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "
Loading...