[sage-support] Re: sagetex: granular builds for large documents

2009-12-01 Thread Eric Drechsel


On Dec 1, 3:30 pm, Dan Drake dr...@kaist.edu wrote:
 Hi Eric,



 On Tue, 01 Dec 2009 at 11:44AM -0800, Eric Drechsel wrote:
  I'm experimenting with a homework workflow using sagetex. I'd like to
  make efficient use of resources, which seems to be a (the?) major
  deficiency with sagetex, especially with large documents.

  My initial thought was that by placing each problem in an included
  file, I could have my build tool generate individual problem_x.sage
  and problem_x.sout files only for problems with changes, and keep the
  master tex file as a simple list of includes. I see now that that
  can't work, however, at least with my limited knowledge of TeX tricks.

  So I'm asking the group for ideas. Starters:

   1. Is it possible to have a master document that includes a bunch of
  complete subdocuments? If so, one could simply keep the master
  document clean of sagetex references, and build each subdocument
  separately.

 My first thought is, if you're talking about using a master document and
 compile times for your homework...you have way too much homework. :)

 I don't know about keeping the master document clean of SageTeX
 references, but by using \include, you can keep things separated, and
 you can even compile only part of the document using \includeonly.

Yes, I found out about \includeonly from [1] shortly after posting,
and I think that's what I'll do in the short term (homework being due
Thursday and all :).

[1] http://web.science.mq.edu.au/~rdale/resources/writingnotes/latexstruct.html


 One thing you can do with SageTeX to make things go faster is to use the
 pause and unpause commands -- \sagetexpause and \sagetexunpause.
 Commands between those two don't get run when you run Sage on the .sage
 file. (SageTeX literally just comments those sections out in the .sage
 file.)

The issue I have with both \sagetexpause and \includeonly is that
they're not automate-able. Subdocuments seem like a good way to
integrate with build tools (since they can have timestamps etc)

 Actually, with the stuff I've done, the most time-consuming part of
 running Sage on the .sage file is simply startup time. Once it starts
 executing the commands, it generally goes really fast, but starting Sage
 takes a while.

Good point! Most documents are probably not so computationally
expensive as the examples file (which has lots of plots). Does sagetex-
remote help with this much, or is there still alot of overhead in
creating a new session on the server?

 I'll think about your per-file ideas, and about some kind of
 \includeonly stuff. Right now, though, it works document-wide.

 What would you like to see? Can you describe some commands or
 functionality that you would find helpful?

Unless you can think of a simple way to add support for generating
separate sage files per tex file (which would also require changing
the way .sout files are included I guess?), it doesn't seem worth the
trouble. I can't begin to read sagetex.sty, so I can't really evaluate
what's a reasonable feature request.

Thanks for your thoughtful response!

Regarding the build tool, I'm using SCons, with which this is my first
experience, and so far I'm liking the flexibility and extensibility
alot. My example project with SConstruct file is here [2]

[2] http://wiki.shared.dre.am/electricity_and_magnetism/probset7/
 Dan

 --
 ---  Dan Drake
 -  http://mathsci.kaist.ac.kr/~drake
 ---

  signature.asc
  1KViewDownload

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: sagetex: granular builds for large documents

2009-12-01 Thread Eric Drechsel
Hi Harald, thanks for the suggestion, I had thought of that too. It
seems like a viable route. Each subdocument ends up on its own set of
pages, but I guess that's the case when using \include too.

-- Eric

On Dec 1, 3:11 pm, Harald Schilly harald.schi...@gmail.com wrote:
 On Dec 1, 8:44 pm, Eric Drechsel ericd...@gmail.com wrote:

   1. Is it possible to have a master document that includes a bunch of
  complete subdocuments?

 The main problem is, that you may happen to define a variable in the
 beginning and modify it later and in the end it is used. Therefore
 there is no mechanism to break this chain apart and everything you
 define lives along a full sage session. I don't know how far Dan's
 ideas are, but there is one immediate hack i can suggest you: Just
 create PDF files for each chapter and then stick them together using a
 PDF-merge tool. I haven't done it yet, but i guess it's simple to
 create one big pdf file merging several pdf documents.

 H

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: sagetex: granular builds for large documents

2009-12-01 Thread Marshall Hampton
I use pyPdf to glue pdfs together, its nice if you already like python
and want to automate such tasks:

http://pybrary.net/pyPdf/

-Marshall

On Dec 1, 5:11 pm, Harald Schilly harald.schi...@gmail.com wrote:
 On Dec 1, 8:44 pm, Eric Drechsel ericd...@gmail.com wrote:

   1. Is it possible to have a master document that includes a bunch of
  complete subdocuments?

 The main problem is, that you may happen to define a variable in the
 beginning and modify it later and in the end it is used. Therefore
 there is no mechanism to break this chain apart and everything you
 define lives along a full sage session. I don't know how far Dan's
 ideas are, but there is one immediate hack i can suggest you: Just
 create PDF files for each chapter and then stick them together using a
 PDF-merge tool. I haven't done it yet, but i guess it's simple to
 create one big pdf file merging several pdf documents.

 H

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: sagetex: granular builds for large documents

2009-12-01 Thread Dima Pasechnik
one can just use pdfpages in (pdf) LaTeX:

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-]{bla}
\includepdf[pages=-]{foo}
\end{document}

creates a pdf document consisting of bla.pdf followed by foo.pdf

2009/12/2 Marshall Hampton hampto...@gmail.com:
 I use pyPdf to glue pdfs together, its nice if you already like python
 and want to automate such tasks:

 http://pybrary.net/pyPdf/

 -Marshall

 On Dec 1, 5:11 pm, Harald Schilly harald.schi...@gmail.com wrote:
 On Dec 1, 8:44 pm, Eric Drechsel ericd...@gmail.com wrote:

   1. Is it possible to have a master document that includes a bunch of
  complete subdocuments?

 The main problem is, that you may happen to define a variable in the
 beginning and modify it later and in the end it is used. Therefore
 there is no mechanism to break this chain apart and everything you
 define lives along a full sage session. I don't know how far Dan's
 ideas are, but there is one immediate hack i can suggest you: Just
 create PDF files for each chapter and then stick them together using a
 PDF-merge tool. I haven't done it yet, but i guess it's simple to
 create one big pdf file merging several pdf documents.

 H

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support-unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org



-- 
Dmitrii Pasechnik
-
DISCLAIMER: Any text following this sentence does not constitute a
part of this message, and was added automatically during transmission.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org