Git Product home page Git Product logo

compile_diary's Introduction

Python code for assembling and compiling LaTeX diary

Actual diary

My actual diary is not found in a public repository. It was originally a single, long LaTeX file. I wrote a script to break it into sections, each section one diary entry, in the interest of the recognized good of modularity. Then I wrote the code in the present repository to compile either just the newest sections (because things sometimes go wrong in LaTeX and you would like to see what you've done) or to reassemble the parts into a whole diary.

The code here generates a .tex file, compiles it twice (necessary to produce a table of contents), and finally opens the resulting PDF file.

Organization and set-up

This program runs in both Python 2 and 3, though there are no dependencies and hence no requirements.txt file. I am running on Mac OS and some subprocess instructions assume that environment.

Directory head_and_tail_matter contain two necessary files: preamble.tex and file_end.tex; head_text_matter_can_be_edited.tex can be empty.

Directory sections contains individual diary entries, whose filenames will be loaded in the order they are returned by Python's os.listdir (dictionary order on my system).

Directory diary_graphics is the "graphicspath"; it contains any graphics files needed in the text. To include an image, use the macro \gr{filename}{n} where filename is the name of the image file in diary_graphics and n is the stylebox ratio. There are also other graphics macros grw and grh, and still other macros for my own purposes โ€” don't worry about them.

Compilation of whole diary

To compile and view the whole diary:

python compile_latex_diary.py

The filename diary_composite.tex is used, and prior versions are overwritten.

Compilation of individual sections alone

To compile and view only a selection of those sections modified in the past n hours, use:

python compile_sample_diary_entries.py n

where n is the maximum age in hours that is to be included. This second program is useful for examining the typesetting of individual entries without having to compile the whole diary. It produces a filename of the form diary_excerpts_n_sections.tex, where _n_ is an integer enumerating the sections included.

To do

  • DONE. Probably should not rely on os.listdir for sorting; sort explicitly.
  • DONE. Clean up non-essential LaTeX interim files after the second compilation.
  • Modularize so that the two programs have no repeated code. In fact, perhaps both use-cases can be handled by a single program with different inputs.

[end]

compile_diary's People

Contributors

databranner avatar brannerchinese avatar

Watchers

James Cloos avatar  avatar

Forkers

brannerchinese

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.