Skip to content

DayOne2LaTeX is converts a journal written in the Day One app into a LaTeX book.

License

Notifications You must be signed in to change notification settings

jiuguangw/dayone2latex

Repository files navigation

DayOne2LaTeX

Overview

DayOne2LaTeX converts a journal written in the Day One app into a LaTeX book.

While Day One has functionalities to export journal entries as a PDF, the functionality is very limited and the user does not have any control over formatting. To get around the limitations, this utility uses Day One's built-in JSON export feature to obtain access to the journal contents (and other bells and whistles such as location and weather data), then converts the Markdown formatted text into a LaTeX document.

See Main.pdf for the example output.

Getting Started

Installing Anaconda Python (Recommended)

All perquisites are installed as a part of Anaconda Python.

Supported Configurations:

OS Python version
MacOS 3.7
Ubuntu 3.7
Windows 3.7

Cloning the repo

To checkout the repo:

git clone git@github.com:jiuguangw/dayone2latex.git

Day One - formatting and export

To achieve the best results, the script assumes the Day One entries are formatted such that the first line contains the title, in the H1 style. See for example:

Day One

To export the entries, go to the gear icon on the top right of the app, "Import / Export", then "Export Day One JSON (.zip)". The exported file can be found in iCloud or AirDropped to a Mac. Unzip the file and place Journal.json inside the "source" directory.

The script also assumes you have assigned a location to the entry and the Day One app has fetched the corresponding weather data for that day.

See Journal.json for an sample JSON output.

Running the script

(dayone2latex)$ cd source
(dayone2latex)$ python convert.py

.tex files are then generated inside the "content" directory, one .tex per entry, sorted by year. As Day One does not currently allow exporting specific entries, the script currently export every available entry. The author can make a manual selection during the book layout process in LaTeX.

See content for sample .tex outputs.

Formatting the book

At least a few edits are needed to the LaTeX template. In Main.tex, your book and author information:

\newcommand{\authorname}{William Shakespeare}
\newcommand{\booktitle}{My Day One Journal}
\newcommand{\subtitle}{}
\newcommand{\publisher}{New York, NY}
\newcommand{\editionyear}{2020}
\newcommand{\isbn}{000-0-00-0000-0}

In Journal.sty, edit the page trim settings:

\usepackage[
    paperheight=10in,
    paperwidth=8in,
    top=0.76in,
    bottom=0.76in,
    outer=0.6in,
    inner=0.875in
]{geometry}

Currently the book is formatted as a 10x8 book, suitable for printing using Kindle Direct Publishing,

Finally, for every entry you would like to include in the book, edit Main.tex to include the file:

\input{content/2020/2020-06-08}

Compile the book

A LaTeX TeXLive distribution is recommended. On macOS, it is MacTeX. I also recommend the IDE TexPad, although there are many other free alternative IDEs.

To layout the book, fire up your favorite LaTeX IDE and compile Main.tex. LuaTeX is recommended for its Unicode and microtype support. If using pdfTeX or XeLaTeX, please remove the following line from Journal.sty:

\usepackage[activate={true,nocompatibility},final,tracking=true,factor=1100,stretch=10,shrink=10]{microtype}

See Main.pdf for the example output.

Limitations

Currently, this utility intentionally does not include contents such as photos and hashtags in the entry. While they are easy to include in the script, I believe most users would want to manually insert photos as 1) figure placement in LaTeX is more of an art than a science and 2) Day One embedded photos are downsampled and often not print quality.

License

License terms

Everything is released under the MIT license. The full license details can be found in LICENSE. If you do end up publishing the book, I'd appreciate an acknowledgment.

Technical contributions

I welcome bug fixes, feature additions, and other ways to improve the project. Please send me pull requests, issues, etc, and contact me if you'd like to be added as a collaborator to the repo.

For others without the time or skills to contribute, I'd also appreciate your help in spreading the word via Facebook, Twitter, etc.

Donation

Please support the project by making a donation via PayPal or crypto:

paypal

Bitcoin Ethereum Bitcoin Cash Litecoin

Contact

Please drop me a line!

About

DayOne2LaTeX is converts a journal written in the Day One app into a LaTeX book.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published