Discussion:
[Docutils-users] Equation numbering in LaTeX writer
Eduard Bopp
2014-06-26 11:40:12 UTC
Permalink
Hello,

I've been using docutils and reStructuredText to write a scientific
document. While I'm fairly happy with the results so far, I have some
trouble enumerating and referencing equations. It appears that docutils
supports this in principle, as the signature of
utils.math.pick_math_environment suggests. However, the LaTeX does not
make use of this feature, as far as I can see.

My current workaround is to change line 2529 of
writers/latex2e/__init__.py from

math_env = pick_math_environment(node.astext())

to

math_env = pick_math_environment(node.astext(), numbered=True)

This enables enumeration and allows me to label and reference my
equations using raw LaTeX. While this solves my practical issue, I think
it's not exactly an elegant solution. Is there a more straightforward
and perhaps target-independent way to achieve this?

Cheers,
Eduard.
Guenter Milde
2014-07-03 20:25:12 UTC
Permalink
Post by Eduard Bopp
My current workaround is to change line 2529 of
writers/latex2e/__init__.py from
math_env = pick_math_environment(node.astext())
to
math_env = pick_math_environment(node.astext(), numbered=True)
This enables enumeration and allows me to label and reference my
equations using raw LaTeX. While this solves my practical issue, I think
it's not exactly an elegant solution. Is there a more straightforward
and perhaps target-independent way to achieve this?
Not yet. Numbered equations are on the TODO list.¹ However, as there are
more objects that may/can/should be numbered (formal tables, figures) this
should become a generic solution which requires some thoughts and efforts.

Günter


¹ http://docutils.sourceforge.net/docs/dev/todo.html
Andre-Patrick Bubel
2015-02-11 13:29:55 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,
Post by Guenter Milde
Post by Eduard Bopp
This enables enumeration and allows me to label and reference my
equations using raw LaTeX. While this solves my practical issue,
I think it's not exactly an elegant solution. Is there a more
straightforward and perhaps target-independent way to achieve
this?
Not yet. Numbered equations are on the TODO list.¹ However, as
there are more objects that may/can/should be numbered (formal
tables, figures) this should become a generic solution which
requires some thoughts and efforts.
¹ http://docutils.sourceforge.net/docs/dev/todo.html
has there been made any progress on this?

Andre Bubel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQQcBAEBCAAGBQJU21lTAAoJEBGM58QktFcoh+8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aPSSUnJ8n0O62qcJ/1WUD5Oi+bFn1jEbBZoJ7Yy78xOQEzkimXhyYoDrxrt
XofswIT3h2Qlh9j3jp1NAm5Kjb3zBI3NH6CKTS6arySm4IsxEODCD2yCydCffVDW
lxNq7iGXsIsOji/42Bvcch1ZcJdECbupKrIcqQT48bwx//C1O1gTs+GddAPvBxAI
/9sH0L+8mRo9ozWihGqWAU85tiGVrab8QJpO49ndUk1yyy6wXj/CeecGe8nHglc6
O4BpNRNij5MIl4eKNPS8isSI04ZRQDDUJQ76v+Xg9RckAu1gb0lQj9Ra4jMG2/M=
=iYzd
-----END PGP SIGNATURE-----


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "
engelbert gruber
2015-02-12 13:52:12 UTC
Permalink
no advance made sorry

my problem is

1. as reST to me still is a document format not a markup
2. i do not need it

so the question is how to get the number information into the tree ?

maybe:

* add numbering of things into docutils internally for all types/classes
* and let these numbers be accessible

example::

.. figure:: picture.png
:scale: 50 %
:alt: map to buried treasure

Fig.# This is the caption of the figure (a simple paragraph).


* "#" would be replaced by docutils internal figure counter
* how writers handle captions is their business
* to get numbered equations would require :class: equations
* to get unnumbered equations, use :class: unnumbered.
as long as the caption does not contain "#" the numbering would not
do any harm
* a table-of-... would be necessary too

AND BEFORE discussion a check of the sandboy latex-variant etal and
sphinx is mandatory

all the best
Post by Andre-Patrick Bubel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi,
Post by Guenter Milde
Post by Eduard Bopp
This enables enumeration and allows me to label and reference my
equations using raw LaTeX. While this solves my practical issue,
I think it's not exactly an elegant solution. Is there a more
straightforward and perhaps target-independent way to achieve
this?
Not yet. Numbered equations are on the TODO list.¹ However, as
there are more objects that may/can/should be numbered (formal
tables, figures) this should become a generic solution which
requires some thoughts and efforts.
¹ http://docutils.sourceforge.net/docs/dev/todo.html
has there been made any progress on this?
Andre Bubel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQQcBAEBCAAGBQJU21lTAAoJEBGM58QktFcoh+8f/0TpqStHxW2XDTLlaDEe0gec
azaB8diYOqVlE+wSTDFAOUIIDkpYpXVqLeXnaEHwZ7L7KyBJ2dEVj30qkTlAj53m
ORWqQSH1Mp5derylHJbE3R8yiD8CIUK+BiNQ/oc88b1EZtF6D+SEcpAKkYtkPSsa
1Qa7w33vZZcjSACRpZjagkGRT8NwhPDjsLgpEFJ986HnnRCaLwQNmb8Bt9fcWtOt
UEuDGQUScvHpfh0RrfADg5uF2vlabONQCjZ4EpXbRe66nKH82n5iDmVK0OI7lpZ7
9fKwWU2biAeqH7m88138/u+HX8lGI/9AflkzawO8O0Cw6xEYDGnbk/dMRFiUPvYh
9fLPewqhu+xtIfkH7Z3HEWhz29zdqmIv/pzIGcjgak5IMat8KxGmzqXCtSr3r9Zc
Xf865npm4CxmSJO1qomZZ+kY/WZYf/0yJsmnDxuGeYmSyzOWVNKLmGqRgC+ihyuY
CZ1VBaanjtIllepSz4Is6PEG1WO5nh3ipcwC17X1SLVyzlj4mK/yTGQHsofVGlfh
YVZ/Q1zspow0IivYPzG3p7nSYud5VSMHAK2CYPg7vLlpc54YESUqRlDwqNIDj1Lz
jTg/dMQiZJCbrmmE7YfsKrTv4vaRicd9I+NEYhzcAWv3s7ybX8I58pw8LgBnUgv0
RI09vdEn51GHPuRcja2kRbram71S7+LahjdGZGkl30Of6gZqNoKYqV+Y2hwNzp+O
mOvg200B0zWpbjGbmPWT1cYKWb7geFOCsfVbyL1tai4Ybu2FdbDgUm8V85lzgcKQ
hkyii5mT0JhJ5DqHpwO8SSoVtrInS7G7AdBcYycvhsapfo6Y7ZcfMoD4Vzwt0J5P
z1Stvv41BA2m4kmgDkJmxiUTPMrYQXYX7c5+GU3aUOpnQDCTfmox+cGk7Y29zoCN
u3aq0LE4Biee8Fl7pQwFmqlHA6kFQtzeFTbau5d0DYWAPjqeyFU0bv+9N82mRk5Z
245yXp/vMiscTdQ2wUAtCwMUz9POY6REp3Vn3lIHwSZBh1FOb9lVD0CcNPXbrz7W
il3oLaPSSUnJ8n0O62qcJ/1WUD5Oi+bFn1jEbBZoJ7Yy78xOQEzkimXhyYoDrxrt
XofswIT3h2Qlh9j3jp1NAm5Kjb3zBI3NH6CKTS6arySm4IsxEODCD2yCydCffVDW
lxNq7iGXsIsOji/42Bvcch1ZcJdECbupKrIcqQT48bwx//C1O1gTs+GddAPvBxAI
/9sH0L+8mRo9ozWihGqWAU85tiGVrab8QJpO49ndUk1yyy6wXj/CeecGe8nHglc6
O4BpNRNij5MIl4eKNPS8isSI04ZRQDDUJQ76v+Xg9RckAu1gb0lQj9Ra4jMG2/M=
=iYzd
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Docutils-users mailing list
https://lists.sourceforge.net/lists/listinfo/docutils-users
Please use "Reply All" to reply to the list.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All
Brecht Machiels
2015-02-13 21:10:52 UTC
Permalink
Hello,

I've also been thinking about figure and table numbering. Note that
there's already the numfig Sphinx package that could prove useful:
http://sourceforge.net/p/numfig/wiki/Home/
Post by engelbert gruber
* add numbering of things into docutils internally for all types/classes
* and let these numbers be accessible
The builder should also have access to the element ID's, in case it
wants to take care of numbering itself. This is already working well
for section numbers.
Post by engelbert gruber
.. figure:: picture.png
:scale: 50 %
:alt: map to buried treasure
Fig.# This is the caption of the figure (a simple paragraph).
I would not include "Fig. #". The backend should add also the "Fig." part.

Best regards,
Brecht



------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
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.

Loading...