Jinwen-XU / jwjournal

A personal LaTeX class for writing journals
https://ctan.org/pkg/jwjournal
LaTeX Project Public License v1.3c
13 stars 2 forks source link
journal latex latex-class latex-template latex3

jwjournal, a personal LaTeX class for writing journals

Package dependencies: enumitem, einfart, minimalist, needspace, projlib, tcolorbox.

Introduction

A typical journal entry produced by jwjournal looks like this: image

Codewise, it is as simple as below:

2023-01-01 Sunny | Botanical Garden

  Today I visited the botanical garden!

  [Food] And had *ice cream* for lunch!

  >>> This botanical garden has a history of nearly two hundred years, take a look at this photo:
      || <0.40> {example-image}

  (( <0.45> {example-image-a}
  <- <5>
  )) <0.50> {example-image-b}
  <- <5>
  (( <0.45> {example-image-c}

It is also possible to write the date with other separators, such as 2023/01/01 or 2023.01.01.

With the options month-day-year or day-month-year, you can also write date in the format mm-dd-yyyy or dd-mm-yyyy, respectively. You may refer to the English, French and German demo documents for examples.

Every day of the week has its unique color, like this: image

By the way, the conversion from plain date string like 2023-01-01 to natural language like January 1, 2023 ⬦ Sunday is done by jwjournal automatically and has multilingual support. Thus, for example (via \UseLanguage):

Usage

The structure of the document is very simple:

\documentclass[11pt, paperstyle = light yellow, color entry, use indent = false]{jwjournal}
\UseLanguage{⟨language⟩} % For English this line can be omitted.
\begin{document}

% Your journal

\end{document}

The available class options include:

There are also some relevant options provided by the base class of jwjournal:

  • use indent = false: disable the paragraph indentation and add some space between each paragraph instead.
  • use style = ⟨provided style⟩: select the designing style of the current article; for our purpose here, it is recommended to use the style classical (with this the option use indent = false is added by default), together with the options title in boldface and title in sffamily, see the comment below regarding the usage of "Section".

You may refer to the demo documents to see their actual usage.

Here are the major syntaxes for your main text: 1) Title

With a few more for icing on the cake:

You may also refer to the demo documents to see their behaviors in action.

And don't forget that you are still using LaTeX! Thus if the provided syntax does not satisfy you, there are always LaTeX commands as a fallback.

Indentations are not important, but paragraphs need to be separated by a blank line. For the sake of readability, it is recommended to organize your text as one of the following ways:

TeXnical details

Engines and base classes

Regarding the fonts

If you are using XeLaTeX or LuaLaTeX to compile your document, then the current document class requires the following open-source fonts that are not included in the standard TeX collection:

These are necessary if you wish to write your document in Chinese (either simplified or traditional) or Japanese. Also, without these fonts installed, the compilation speed might be much slower — the compilation would still pass, but the system shall spend (quite) some time verifying that the fonts are indeed missing before switching to the fallback fonts.

Colors

The colors from Monday to Sunday have the internal names jwjournal-color-1, ..., jwjournal-color-7. Currently they are defined as:

\colorlet { jwjournal-color-1 } { yellow!50!green  }
\colorlet { jwjournal-color-2 } { yellow!70!orange }
\colorlet { jwjournal-color-3 } { cyan!70!blue     }
\colorlet { jwjournal-color-4 } { violet           }
\colorlet { jwjournal-color-5 } { yellow!40!cyan   }
\colorlet { jwjournal-color-6 } { yellow!20!orange }
\colorlet { jwjournal-color-7 } { red!20!orange    }

Functionality

The main features are achieved with the power of LaTeX3's regex functionality. It scans the content paragraph by paragraph and converts recognized patterns into corresponding TeX commands. Thus, 2023-01-01 Weather becomes \JWJournalEntry{2023-01-01}{Weather}, [Note] ... becomes \item[Note] ... inside a description environment, and +++ is essentially \enlargethispage{\baselineskip}, etc. However, this comes with a price: in order to scan the content, it is firstly stored in a macro \g_jwjournal_content_tl, and that means that you cannot use commands like \verb in your main text (unless explicitly \end{jwjournal}, write your code, and then \begin{jwjournal}). Also, synctex won't work properly.

Dates

The conversion of date string to natural language, and the calculation of the day of the week are accomplished by projlib-date, part of the ProjLib toolkit, which is still at its early stage, in some aspects not as functional as existing package such as datenumber, but should evolve through time.

Language and date format

Language and date format can both be set in two ways: as class option or with corresponding commands.

Scroll mode

The scroll mode is achieved by directly accessing \pdfpageheight (pdfTeX and XeTeX) or \pageheight (LuaTeX). The minimal page height is set to be 10in. It is worth noting that in order to calculate the height needed, the entire content are put into a single box, which puts a limitation on the length of your document (but this usually wouldn't be a problem).

Acknowledgement

The author would like to thank his friend Junzhuo Zhao for his valuable help with the German language. Danke schön!

License

This work is released under the LaTeX Project Public License, v1.3c or later.