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.
All perquisites are installed as a part of Anaconda Python.
Supported Configurations:
OS | Python version |
---|---|
MacOS | 3.7 |
Ubuntu | 3.7 |
Windows | 3.7 |
To checkout the repo:
git clone [email protected]:jiuguangw/dayone2latex.git
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:
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.
(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.
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}
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.
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.
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.
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.
Please support the project by making a donation via PayPal or crypto:
- Jiuguang Wang
- [email protected]
- www.robo.guru
Please drop me a line!