Journaling With LaTeX

PUBLISHED ON 21/01/2020 — EDITED ON 22/01/2020 — CREATIVITY

Intro

Lately I have been looking into journaling again. I am working on my 5 minute journal for a while now, but I wanted to extend it. As a coincidence, my friend “watts” pointed out his solution and I have jumped into it.

Journaling

Tools

  1. LaTeX
  2. Vim
  3. UltiSnips
  4. vimtex

Stoic quotes

5 minute journal displays a random stoic quote for every day. To emulate that we can use the fortune program with additional stoic quotes, found here.

% git clone https://github.com/npankaj365/stoic-fortune.git
% sudo cp stoic-quotes* /opt/local/share/games/fortune
% fortune stoic-quotes
Epictetus Quotes
What decides whether a sum of money is good? The money is not going to tell you; it must be the faculty that makes use of such impressions – reason.
Discourses I, 1.5

UltiSnips

~/.vim/UltiSnips/tex.snippets

snippet journal "Journal" b
%-------------------------------------------------------------------------------
\begin{loggentry}{`date +%d/%m/%Y`}{$1}

\subsection{Morning}

`fortune stoic-quote`

\paragraph{I am grateful for...}
\begin{enumerate}
  \item $2
  \item $3
  \item $4
\end{enumerate}

\paragraph{What would make today great?}
\begin{enumerate}
  \item $5
  \item $6
  \item $7
\end{enumerate}

\paragraph{Daily affirmations. I am...}
$8

\subsection{Evening}

\paragraph{Three amazing things that happened today...}
\begin{enumerate}
  \item $9
  \item $10
  \item $11
\end{enumerate}

\paragraph{How could I have made today even better?}
$12

\subsection{Daily thoughts}
$0

\end{loggentry}

endsnippet

TODO: Random stoic quote from fortune package could be formatted better.

I edited the UltiSnips shortcuts a bit:

~/.vimrc

...
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
let g:UltiSnipsEditSplit="vertical"
...

So when you are ready to write a journal entry, open the .tex file and do this:

journal<tab>

Then, <tab> will take your cursor to the next part (the $x variables in the UltiSnips config) and shift+tab will take you one step back.

vimtex

  • \ll builds the pdf file.
  • \lv open pdf and forward search
  • \ll \lk stop compilation
  • \le parse error log
  • \lc clean aux files
  • \lC clean pdf files

git

Great idea is to use a local git repository to track changes. Here is a handy .gitignore file:

*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
*.blg
*.dvi
*.glg
*.gls
*.ilg
*.ind
*.lof
*.lot
*.maf
*.mtc
*.mtc1
*.out
*.synctex.gz
.DS_Store
*.fls
*.fdb_latexmk

See Also