milesdai / TAoE3Solutions

Solutions to the problems in The Art of Electronics 3ed.
MIT License
153 stars 30 forks source link

Tex file taking very long to compile/render figures #32

Open zoelzw opened 2 years ago

zoelzw commented 2 years ago

As we added more figures to the tex file, I noticed that it took longer and longer to compile the document. I was trying to add a phasor diagram but it took too long. I didn't get the timeout error but it was time-consuming to have to wait to see the edits. I don't know if others have the same problem, but it'd be nice if we can improve the efficiency of compiling. We could divide each chapter into smaller chunks in different tex files. Or, would you consider organizing figures externally as described here? Thanks!

milesdai commented 2 years ago

Yeah this is a good point. I've integrated the externalize tikzpackage and worked out all the bugs to get things to compile. Take a look at #34 for the details.

Testing on my local machine (which admittedly is relatively slow), it takes the compile time from 11 seconds down to 6 seconds when the figures are already generated. On the downside, the initial compilation takes around 2.5 minutes.

I'm going to continue the discussion of the details of this implementation on #34, and I would recommend taking a look over there since this adds somewhat significant workflow changes.

milesdai commented 2 years ago

With all that being said, this solution still doesn't quite scale well as the number of chapters increases. If you are using overleaf, my suspicion is that we will hit the time limit for Overleaf again at some point especially since the project is currently mostly just Chapter 1.

When I first started this project, I had actually intended to keep each chapter separate because I was afraid of long compile times. I guess I forgot about that in the latest reorganization of the latex document (it seemed kind of nice to compile a single final document). Maybe something that's more sustainable is to use the standalone package to split the document by chapter so that each chapter can be compiled on its own.