LaTeX format

24 views
Skip to first unread message

Andrew Davison

unread,
Apr 22, 2013, 4:39:49 PM4/22/13
to sumatr...@googlegroups.com
Hi everyone,

In the development branch ('default' in the Mercurial repository), I've just added the ability to export project records in LaTeX format.

e.g.

  smt list -l -f latex > my_project.tex               # all records
  smt list -l -f latex mytag1 > my_project.tex   # records tagged with 'mytag1'


Note that this is different from the `publishing` module, which allows you to embed provenance information into your own LaTeX documents. This is more like exporting the entire contents of the database (or only those records with a particular tag) as a single document, for archival purposes or for a little light reading :-)

The default formatting can be overwritten by placing a file called `latex_template.tex` in your `.smt` directory (I suggest copying the default template from `src/formatting/latex_template.tex` and modifying that).

The default template looks ok with a few of my projects I've tried it out with, but I'd like to get feedback on how it looks with your projects, and I'd be especially happy to receive ideas from people with better LaTeX and graphic design skills than me!

(if you're not currently using the development branch and would like to, first make sure you back up your ".smt" directories, then see the instructions at http://pythonhosted.org/Sumatra/developers_guide.html#getting-the-source-code followed by http://pythonhosted.org/Sumatra/upgrading.html)

Cheers,

Andrew

Laurent Perrinet

unread,
Apr 24, 2013, 4:36:01 AM4/24/13
to sumatr...@googlegroups.com
Hi list,

On Mon, Apr 22, 2013 at 10:39 PM, Andrew Davison <andrew....@unic.cnrs-gif.fr> wrote:
smt list -l -f latex > my_project.tex  

trying out this new feature (using a 'python setup.py install' command, I had an issue with formatting missing, so I added this

$ hg diff
diff -r 8b6e0ffce4a7 setup.py
--- a/setup.py    Mon Apr 22 22:12:16 2013 +0200
+++ b/setup.py    Wed Apr 24 10:23:11 2013 +0200
@@ -34,12 +34,13 @@
                 'sumatra.external.NeuroTools',
                 'sumatra.recordstore', 'sumatra.recordstore.django_store',
                 'sumatra.versioncontrol',
+                'sumatra.formatting',
                 'sumatra.web', 'sumatra.web.templatetags',
                 'sumatra.publishing',
                 'sumatra.publishing.latex', 'sumatra.publishing.sphinxext'],

which fixed the first problem. but then, I get this in my mercurial repo (which is working fine with the stable version of sumatra):

$ smt upgrade
Traceback (most recent call last):
  File "/usr/local/share/python/smt", line 5, in <module>
    pkg_resources.run_script('Sumatra==0.6.0dev', 'smt')
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 505, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 1245, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/EGG-INFO/scripts/smt", line 31, in <module>
    main(sys.argv[2:])
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/commands.py", line 544, in upgrade
    project = load_project()
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/projects.py", line 347, in load_project
    prj = _load_project_from_json(p)
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/projects.py", line 313, in _load_project_from_json
    _temp = __import__(module_name, globals(), locals(), [class_name], -1) # from <module_name> import <class_name>
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/versioncontrol/_mercurial.py", line 19, in <module>
    from mercurial import hg, ui, patch
ImportError: No module named mercurial

$


sounds familiar?

Laurent

PS : by the way, I use bitbucket's repo on a mac with homebrew's python:
$ hg sum
parent: 697:8b6e0ffce4a7 tip
 Moved `formatting` module into sub-package.
branch: default
bookmarks: develop
commit: 1 modified, 5 unknown
update: (current)




--
Laurent Perrinet - INT (UMR 7289)/CNRS
http://invibe.net/LaurentPerrinet

Andrew Davison

unread,
Apr 24, 2013, 6:03:49 AM4/24/13
to sumatr...@googlegroups.com
On Mon, Apr 22, 2013 at 10:39 PM, Andrew Davison <andrew....@unic.cnrs-gif.fr> wrote:
smt list -l -f latex > my_project.tex  

trying out this new feature (using a 'python setup.py install' command, I had an issue with formatting missing, so I added this

$ hg diff
diff -r 8b6e0ffce4a7 setup.py
--- a/setup.py    Mon Apr 22 22:12:16 2013 +0200
+++ b/setup.py    Wed Apr 24 10:23:11 2013 +0200
@@ -34,12 +34,13 @@
                 'sumatra.external.NeuroTools',
                 'sumatra.recordstore', 'sumatra.recordstore.django_store',
                 'sumatra.versioncontrol',
+                'sumatra.formatting',
                 'sumatra.web', 'sumatra.web.templatetags',
                 'sumatra.publishing',
                 'sumatra.publishing.latex', 'sumatra.publishing.sphinxext'],

Thanks for spotting this. I've fixed it in the repository.
 
which fixed the first problem. but then, I get this in my mercurial repo (which is working fine with the stable version of sumatra):

$ smt upgrade
Traceback (most recent call last):
  File "/usr/local/share/python/smt", line 5, in <module>
    pkg_resources.run_script('Sumatra==0.6.0dev', 'smt')
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 505, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 1245, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/EGG-INFO/scripts/smt", line 31, in <module>
    main(sys.argv[2:])
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/commands.py", line 544, in upgrade
    project = load_project()
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/projects.py", line 347, in load_project
    prj = _load_project_from_json(p)
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/projects.py", line 313, in _load_project_from_json
    _temp = __import__(module_name, globals(), locals(), [class_name], -1) # from <module_name> import <class_name>
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/versioncontrol/_mercurial.py", line 19, in <module>
    from mercurial import hg, ui, patch
ImportError: No module named mercurial

Is the stable version of Sumatra using the same version of Python? What happens if you "import mercurial" from within a Python shell?

Laurent Perrinet

unread,
Apr 24, 2013, 11:16:05 AM4/24/13
to sumatr...@googlegroups.com

 
which fixed the first problem. but then, I get this in my mercurial repo (which is working fine with the stable version of sumatra):

$ smt upgrade
Traceback (most recent call last):
  File "/usr/local/share/python/smt", line 5, in <module>
    pkg_resources.run_script('Sumatra==0.6.0dev', 'smt')
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 505, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg/pkg_resources.py", line 1245, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/EGG-INFO/scripts/smt", line 31, in <module>
    main(sys.argv[2:])
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/commands.py", line 544, in upgrade
    project = load_project()
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/projects.py", line 347, in load_project
    prj = _load_project_from_json(p)
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/projects.py", line 313, in _load_project_from_json
    _temp = __import__(module_name, globals(), locals(), [class_name], -1) # from <module_name> import <class_name>
  File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sumatra-0.6.0dev-py2.7.egg/sumatra/versioncontrol/_mercurial.py", line 19, in <module>
    from mercurial import hg, ui, patch
ImportError: No module named mercurial

Is the stable version of Sumatra using the same version of Python? What happens if you "import mercurial" from within a Python shell?


thanks for pointing this out! indeed, the mercurial package was broken on the client side.

laurent
Reply all
Reply to author
Forward
0 new messages