#+TITLE: Wallcalendar User Manual
#+SETUPFILE: doc-setup.org

#+latex: \input{frontpage.tex}

* Tasks :noexport:
** TODO basic things should work without any class options
** setup A5 desk page layout
*** new example on the front page
** describe \fullPageFmt and \smallLandscapeFmt
** can use env variables for class options with Lua? language, resolution, etc.
* Tutorial: Forest Calendar

In this tutorial we will produce the three example pages seen in the summary.

Set the parameters of the month pages in advance, either in the preamble or in
the document body, but before calling =\MonthPage{ month }= to typeset it.

A month page can have four areas:

- Photo
- Quote
- Calendar
- Events

Their parameters are set separately for each month:

: \SetPhoto[ options ]{ month }
: \SetQuote[ options ]{ month }{ quote text }
: \SetCalendar[ options ]{ month }
: \SetEvents[ options ]{ month }{ calendar tikz marks }{ events text }

The month page will be typeset with:

: \MonthPage[ options ]{ month }

** Documentclass

To start, load the documentclass and set =year=, =language= and the =imageFolder=:

#+begin_src tex
\documentclass[
  year=2018,
  language=english,
  imageFolder=./photos/,
]{wallcalendar}
#+end_src

Let's start the preamble with =\makeatletter= to be safe.

#+begin_src tex :tangle ./examples/forest.tex
\makeatletter
#+end_src

** Font settings

For this example we'll use TeX Gyre Pagella as the main typeface. We also load
DejaVu Sans to use a particular glyph as a mark in the calendar (=U+263C= white
sun with rays).

#+begin_src tex :tangle ./examples/forest.tex
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{TeX Gyre Pagella}
\newfontfamily\dejaVuSans{DejaVu Sans}
#+end_src

#+latex: \clearpage

** June

#+begin_latex
\twocol{%
  \frame{\includegraphics[width=5cm]{cal-plain-01}}%
}{%
  \includegraphics[width=6.12cm]{cal-showframe-01}%
}

\twocolcaption{\mbox{}}{%
  \raggedright
  \texttt{showtrims} and \texttt{showframe} class options show the page structure.
}

\bigskip
#+end_latex

It will be a full page photo, with 3mm bleed on all four sides. You can see the
bleed if you enable the =showtrims= class option. We also specify the file name
of the photo (no extension), this will be the argument of =\includegraphics=.

#+begin_src tex :tangle ./examples/forest.tex
\SetPhoto[bleed=3mm, file={obscure-crop}]{June}
#+end_src

A quote will be positioned over the photo. The quote is in a =\linewidth= wide
minipage, attached to the top left corner of the page. Use =\raggedleft=,
=\raggedright=, or =\centering= for alignment, and the =xOffset= and =yOffset=
options to move the quote's minipage to the exact position.

#+begin_src tex :tangle ./examples/forest.tex
\SetQuote[xOffset=-5mm, yOffset=-20mm]{June}{%
\raggedright
\setlength{\parskip}{10pt}%
\Large
\color{white}

I shall set forth for somewhere,\\
I shall make the reckless choice\\
Some day when they are in voice\\
And tossing so as to scare\\
The white clouds over them on.\\
I shall have less to say,\\
But I shall be gone.

\textit{The Sound of the Trees} by Robert Frost
}
#+end_src

The layout macro will place the calendar at the bottom, dates in a single line.

Here we use a conditional to use a different calendar style when =showframe= is
turned on, this helps with debugging or tuning the position.

#+begin_src tex :tangle ./examples/forest.tex
\ifshowframe
  \SetCalendar[bg/.style={opacity=0.5, fill=white}]{June}
\else
  \SetCalendar[bg/.style={opacity=0.8}]{June}
\fi
#+end_src

Events for particular days are printed under the calendar.

#+begin_src tex :tangle ./examples/forest.tex
\SetEvents{June}{%
  if (equals=2018-06-21)
    [day text={\dejaVuSans\char"263C}];% U+263C white sun with rays
}{%
\raggedleft
{\dejaVuSans\char"263C} June 21: Summer Solstice
}
#+end_src

** July

#+begin_latex
\twocol{%
  \frame{\includegraphics[width=5cm]{cal-plain-02}}%
}{%
  \includegraphics[width=6.12cm]{cal-showframe-02}%
}
#+end_latex

Same as June, but we will set the image to be placed above the calendar, and we
add a transparent background for the quote.

This layout is a good option when the top or the bottom of the photo has to be
cropped, and you can't use the full page aspect ratio for the photo.

#+begin_src tex :tangle ./examples/forest.tex
\SetPhoto[bleed=3mm, file={obscure-crop}]{July}

\SetQuote[%
  xOffset=0.5\linewidth - 0.5\paperwidth -3mm,
  yOffset=-20mm,
]{July}{%
\begin{tikzpicture}%
\node [
  fill=white, opacity=0.6, minimum width={\paperwidth + 3mm},
  minimum height=30mm] {};%
\node [] {%
\begin{minipage}{\paperwidth + 3mm}%
\centering
\Large
\color{white}

I shall have less to say,\\
But I shall be gone.

\textit{The Sound of the Trees} by Robert Frost
\end{minipage}%
};
\end{tikzpicture}%
}

\ifshowframe
  \SetCalendar[bg/.style={opacity=0.5}]{July}
\else
  \SetCalendar[bg/.style={opacity=1}]{July}
\fi

\SetEvents{July}{
  if (equals=2018-07-27) [day text={\dejaVuSans\char"263C}];
}{%
\raggedleft
{\dejaVuSans\char"263C} July 27: Mars at Opposition
}
#+end_src

** August

#+begin_latex
\twocol{%
  \frame{\includegraphics[width=5cm]{cal-plain-03}}%
}{%
  \includegraphics[width=6.12cm]{cal-showframe-03}%
}
#+end_latex

This layout works for photos that are horizontal (landscape orientation), scaled
into the bleed margin on three sides.

#+begin_src tex :tangle ./examples/forest.tex
\SetPhoto[bleed=3mm, file={obscure-crop}, yOffset=-150mm]{August}

\SetQuote[yOffset=-3mm]{August}{%
\centering
\setlength{\parskip}{10pt}%
\Large
\color{black!80}

I shall have less to say,\\
But I shall be gone.

\textit{The Sound of the Trees} by Robert Frost
}

\ifshowframe
  \SetCalendar[bg/.style={opacity=0.5}]{August}
\else
  \SetCalendar[bg/.style={opacity=1}]{August}
\fi

\SetEvents{August}{
  if (equals=2018-08-12) [day text={\dejaVuSans\char"263C}];
}{%
\raggedleft
{\dejaVuSans\char"263C} August 12, 13: Perseids Meteor Shower
}
#+end_src

End of the preamble.

#+begin_src tex :tangle ./examples/forest.tex
\makeatother
#+end_src

** The document

Typesetting the month pages in the document is now just this much:

#+begin_src tex :tangle ./examples/forest.tex
\begin{document}

\MonthPage[layout=full page, put photo=full page]{June}

\MonthPage[layout=full page, put photo=full width above calendar]{July}

\MonthPage[layout=small landscape, put photo=full width]{August}

\end{document}
#+end_src

#+latex: \clearpage

* Tutorial: Translations

In this tutorial we will produce the same calendar in three languages: Japanese,
English and Hungarian.

We are going to use =IPAPMincho= font for the Japanese.

#+begin_latex
\begin{extrafullwidth}

\hfill
\begin{minipage}{0.31\linewidth}
\centering

\frame{\includegraphics[width=5cm]{./examples/cal-translations-japanese.pdf}}

\end{minipage}%
\begin{minipage}{0.31\linewidth}
\centering

\frame{\includegraphics[width=5cm]{./examples/cal-translations-english.pdf}}

\end{minipage}%
\begin{minipage}{0.31\linewidth}
\centering

\frame{\includegraphics[width=5cm]{./examples/cal-translations-hungarian.pdf}}

\end{minipage}
\hfill\mbox{}

\end{extrafullwidth}
#+end_latex

** Files

The main document files:

: cal-translations-japanese.tex
: cal-translations-english.tex
: cal-translations-hungarian.tex

Fonts, formatting settings, etc.:

: local-japanese.sty
: local-english.sty
: local-hungarian.sty

Translation text input:

: frog-japanese.tex
: frog-english.tex
: frog-hungarian.tex

Setup month pages (same across translations):

: frog.tex

** Translations setup

Create the =frog-english.tex= file and use the =\SetTxt{ key }{ content }=
command to set text content for translation keys.

=frog-japanese.tex=

#+begin_src tex :tangle ./examples/frog-japanese.tex
\SetTxt{September Quote}{%
{\mincho 新池や蛙とびこむ音もなし}

{\Large\textit{araike ya / kawazu tobikomu / oto mo nashi}}

{\mincho 良寛}%
}

\newcommand\SeptMarks{%
  if (equals=2018-09-21)
    [day text={\dejaVuSans\char"263C}];% U+263C white sun with rays
}

\SetTxt{Sept Events}{%
{\dejaVuSans\char"263C} {\mincho ９月 21日: まことに ９月 21日}
}
#+end_src

=frog-english.tex=

#+begin_src tex :tangle ./examples/frog-english.tex
\SetTxt{September Quote}{%
silent new lake\\
let the frog jump\\
not even a sound

\textit{-- Ryokan}%
}

\newcommand\SeptMarks{%
  if (equals=2018-09-21)
    [day text={\dejaVuSans\char"263C}];% U+263C white sun with rays
}

\SetTxt{Sept Events}{%
{\dejaVuSans\char"263C} Sept 21: September 21
}
#+end_src

=frog-hungarian.tex=

#+begin_src tex :tangle ./examples/frog-hungarian.tex
\SetTxt{September Quote}{%
hallgat az új tó\\
ugorhat béka belé\\
vize se csobban

\textit{-- Rjókan}%
}

\newcommand\SeptMarks{%
  if (equals=2018-09-21)
    [day text={\dejaVuSans\char"263C}];% U+263C white sun with rays
}

\SetTxt{Sept Events}{%
{\dejaVuSans\char"263C} Szept 21: Szeptember 21
}
#+end_src

*NOTE:* Using =\SetTxt{}= to store values intended as tikz marks on the calendar
will not work. The =\txt{}= command will be the value of =\@eventmarks= and tikz
can't resolve it there.

Put the calendar marks in a command instead, as above with =\SeptMarks=.

#+begin_src tex
\calendar (cal#1)
  [alnitak, dates=\CalendarYear-#1-01 to \CalendarYear-#1-last]
  \@eventmarks;%
#+end_src

#+begin_src tex
% NOTE This code below will not work.
% Put the calendar marks in a command instead.

\SetTxt{Sept Marks}{%
  if (equals=2018-09-21)
    [day text={\dejaVuSans\char"263C}];% U+263C white sun with rays
}

% ...

\SetEvents{September}{%
\txt{Sept Marks}
}{%
\raggedleft
\txt{Sept Events}
}
#+end_src

** Document setup

Load the documentclass. We are setting the =translations= option to define the
file where translation keys are set. This file is loaded by the documentclass as
an =\input=.

=cal-translations-japanese.tex=

#+begin_src tex :tangle ./examples/cal-translations-japanese.tex
\documentclass[
  year = 2018,
  language = japanese,
  translationsInputFile = frog-japanese.tex,
  imageFolder = ./photos/,
]{wallcalendar}

\usepackage{local-japanese}

% Content is the same across translations
\input{./frog.tex}

\begin{document}

% Just one month
\MonthPage[layout=full page, put photo=full page]{September}

\end{document}
#+end_src

=local-japanese.sty=

#+begin_src tex :tangle ./examples/local-japanese.sty
\ProvidesPackage{local-japanese}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{TeX Gyre Pagella}
\newfontfamily\dejaVuSans{DejaVu Sans}
% Japanese font
\newfontfamily\mincho{IPAPMincho}

% Renew formatting hooks to use the \mincho font
\renewcommand\fullPageFmt{%
  \renewcommand*\monthFmt{\LARGE\mincho}%
  \renewcommand*\yearFmt{\LARGE\mincho}%
  \renewcommand*\dayLetterColor{}%
  \renewcommand*\dayLetterFmt{\tiny\mincho}%
  \renewcommand*\dayTextFmt{\small}%
  \renewcommand*\quoteFmt{}%
  \renewcommand*\headingFmt{\centering}%
  \renewcommand*\calendarFmt{\centering}%
  \renewcommand*\eventsFmt{%
   \setlength{\parindent}{0pt}\raggedleft\footnotesize%
  }%
}
#+end_src

=cal-translations-english.tex=

#+begin_src tex :tangle ./examples/cal-translations-english.tex
\documentclass[
  year = 2018,
  language = english,
  translationsInputFile = frog-english.tex,
  imageFolder = ./photos/,
]{wallcalendar}

\usepackage{local-english}

\input{./frog.tex}

\begin{document}

\MonthPage[layout=full page, put photo=full page]{September}

\end{document}
#+end_src

=local-english.sty=

#+begin_src tex :tangle ./examples/local-english.sty
\ProvidesPackage{local-english}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{TeX Gyre Pagella}
\newfontfamily\dejaVuSans{DejaVu Sans}
#+end_src

=cal-translations-hungarian.tex=

#+begin_src tex :tangle ./examples/cal-translations-hungarian.tex
\documentclass[
  year = 2018,
  language = hungarian,
  translationsInputFile = frog-hungarian.tex,
  imageFolder = ./photos/,
]{wallcalendar}

\usepackage{local-hungarian}

\input{./frog.tex}

\begin{document}

\MonthPage[layout=full page, put photo=full page]{September}

\end{document}
#+end_src

=local-hungarian.sty=

#+begin_src tex :tangle ./examples/local-hungarian.sty
\ProvidesPackage{local-hungarian}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{TeX Gyre Pagella}
\newfontfamily\dejaVuSans{DejaVu Sans}
#+end_src

=frog.tex=

#+begin_src tex :tangle ./examples/frog.tex
\makeatletter

\SetPhoto[bleed=3mm, file={frog-crop}]{September}
#+end_src

Use the =\txt{ key }= command to load text from translation keys:

#+begin_src tex :tangle ./examples/frog.tex

\SetQuote[xOffset=0pt, yOffset=-140mm]{September}{%
\raggedleft\setlength{\parskip}{10pt}\HUGE\color{white}%
\txt{September Quote}%
}
#+end_src

Calendar settings for the month, using =\txt= to access translated parts.

#+begin_src tex :tangle ./examples/frog.tex
\SetCalendar[bg/.style={opacity=0.4}]{September}

\SetEvents{September}{%
\SeptMarks%
}{%
\raggedleft
\txt{Sept Events}
}

\makeatother
#+end_src

#+latex: \clearpage

* Tutorial: Load Events from CSV

#+begin_latex
\begin{fullwidth}
\begin{minipage}{\linewidth}
\centering

\frame{\includegraphics[width=\linewidth, clip, trim=0pt 0pt 0pt 22cm]{./examples/cal-marks.pdf}}

\end{minipage}%
\end{fullwidth}
#+end_latex

** CSV files

Events in the CSV should be already sorted by date.

If you are using more than one CSV, put all events with notes (i.e. indexed
entries) in the same CSV. The index number of the mark is taken from the row
number in the CSV, so a second CSV with notes would start the count from 1
again.

We're going to use the following csv files, see in the =./doc/examples/data/= folder.

=holidays.csv=

=moonphases.csv=

=mark_defaults.csv=

** Event formatting

You can format the event output by setting the =format cmd= key:

#+begin_src tex
\parseMonthEvents[%
  format cmd = {%
    \textsuperscript{\eMark}~\eMonthShort~\eDay:\space%
    \eNote\ifnumless{\eIdx}{\eMaxIdx}{,\space}{.}%
  },
]%
#+end_src

Or define a Lua formatting function and set it with the =format func= key:

=helpers.lua=

#+begin_src lua
function eventFmtCustom(idx, max_idx, event, event_date, mark)
  local d = event_date
  tex.sprint(string.format(
    "\\textsuperscript{%s} & %s %s: & %s \\\\",
    mark.symbol, d:fmt("%b"), d:getday(), event.note
  ))
end
#+end_src

#+begin_src tex
\parseMonthEvents[format func = eventFmtCustom]%
#+end_src

** Document setup

=cal-marks.tex=

#+begin_src tex :tangle ./examples/cal-marks.tex
\documentclass[
  year = 2018,
  eventsCsv = ./data/holidays.csv,
  markDefaultsCsv = ./data/mark_defaults.csv,
  imageFolder = ./photos/,
]{wallcalendar}

\makeatletter

\colorlet{mooncolor}{darkgold}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{TeX Gyre Pagella}
\newfontfamily\dejaVuSans{DejaVu Sans}

\SetPhoto[bleed=3mm, file={frog-crop}]{September}

\SetQuote[xOffset=0pt, yOffset=-140mm]{September}{%
\raggedleft\setlength{\parskip}{10pt}\HUGE\color{white}%
silent new lake\\
let the frog jump\\
not even a sound

\textit{-- Ryokan}%
}

\SetCalendar[bg/.style={opacity=0.4}]{September}

\SetEvents{September}{%
\parseMonthMarksDayTextUsing{./data/moonphases.csv}%
\parseMonthMarksDayText%
\parseMonthMarksNote%
}{%
\raggedright
\parseMonthEvents[%
  format cmd = {%
    \textsuperscript{\eMark}~\eMonthShort~\eDay:\space%
    \eNote\ifnumless{\eIdx}{\eMaxIdx}{,\space}{.}%
   },
]%
}

\makeatother

\begin{document}

\MonthPage[layout=full page, put photo=full page]{September}

\end{document}
#+end_src

#+latex: \clearpage

* Example: Year Planner Page

#+begin_latex
\begin{fullwidth}
\begin{minipage}{0.31\linewidth}
\centering

\frame{\includegraphics[width=5cm]{./examples/cal-year-planner.pdf}}

\end{minipage}%
\end{fullwidth}
#+end_latex

** Document setup

=cal-year-planner.tex=

#+begin_src tex :tangle ./examples/cal-year-planner.tex
\documentclass[
  year = 2018,
  eventsCsv = ./data/holidays.csv,
  markDefaultsCsv = ./data/mark_defaults.csv,
  imageFolder = ./photos/,
]{wallcalendar}

\makeatletter

\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{TeX Gyre Pagella}
\newfontfamily\dejaVuSans{DejaVu Sans}

% Use two CSV files for day text input to include the moon phases
\renewcommand\@wall@plm[1]{%
\luadirect{
require("wallcalendar-helpers.lua")
monthMarksDayText(\luastring{#1}, nil, \luastring{\plannerMarksDayTextCSV})
monthMarksDayText(\luastring{#1}, nil, \luastring{./data/moonphases.csv})
tex.sprint(';')
}}
#+end_src

** \textbackslash YearPlannerPage

#+begin_src tex :tangle ./examples/cal-year-planner.tex
\newcommand\plannerYearFmt{\fontsize{26}{26}\selectfont\color{orangegold}}

\newlength\plannerNotesSep
\setlength{\plannerNotesSep}{3mm}

\newcommand\preYearPlannerPageHook{%
  \setlength{\markNumberAbove}{-9pt}%
  \setlength{\markNumberRight}{-6pt}%
  \setlength{\markDayTextAbove}{-11pt}%
  \setlength{\markDayTextRight}{-6pt}%
}

\newcommand\postYearPlannerPageHook{%
  \setlength{\markNumberAbove}{-10pt}%
  \setlength{\markNumberRight}{-3pt}%
  \setlength{\markDayTextAbove}{-10pt}%
  \setlength{\markDayTextRight}{-3pt}%
}

\newcommand\printPlannerTitle{\plannerYearFmt \CalendarYear}

\newcommand\YearPlannerPage{%
\newpage
\ifvarnishmask
\mbox{}
\else
\preYearPlannerPageHook
{\centering

{\printPlannerTitle}

\vspace*{7mm}

\YearPlannerPortrait

\vspace*{\plannerNotesSep}

\plannerEvents

}
\postYearPlannerPageHook

\fi
}

\makeatother
#+end_src

** Use it

#+begin_src tex :tangle ./examples/cal-year-planner.tex
\begin{document}

\YearPlannerPage

\end{document}
#+end_src

#+latex: \clearpage

* Example: Photo Thumbnails Page

#+begin_latex
\begin{fullwidth}
\begin{minipage}{0.31\linewidth}
\centering

\frame{\includegraphics[width=5cm]{./examples/cal-thumbnails.pdf}}

\end{minipage}%
\end{fullwidth}
#+end_latex

** Document setup

=cal-thumbnails.tex=

#+begin_src tex :tangle ./examples/cal-thumbnails.tex
\documentclass[
  year = 2018,
  imageFolder = ./photos/,
]{wallcalendar}

\makeatletter

\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont{TeX Gyre Pagella}
\newfontfamily\dejaVuSans{DejaVu Sans}

\newlength\@wall@tmp@a
\newlength\@wall@tmp@b
#+end_src

** \textbackslash ThumbWithCaptionLeftSide

Typesets the photo thumb image with its caption text on the left side.

: \ThumbWithCaptionLeftSide{January}

#+begin_src tex :tangle ./examples/cal-thumbnails.tex
\newlength\@wall@thumbWidth
\newlength\@wall@thumbHeight
\newlength\@wall@thumbCaptionWidth
\setlength{\@wall@thumbWidth}{0.1749\calPaperWidth}% 30mm at the 6.75in page width, 0.1749 = 1/5.715
\setlength{\@wall@thumbHeight}{\@wall@thumbWidth}
\setlength{\@wall@thumbCaptionWidth}{0.2333\calPaperWidth}% 40mm at 6.75in page width

\newcommand\thumbFmt{}
\newcommand\thumbMonthFmt{\fontsize{10}{13}\selectfont\bfseries}
\newcommand\thumbCaptionFmt{\fontsize{10}{13}\selectfont}

\def\@wall@thumbFile{}
\def\@wall@photoCaption{}

\newcommand\ThumbWithCaptionLeftSide[1]{%
\pgfkeys{/Photo/#1/thumbFile/.get=\@wall@thumbFile}%
\ifx\@wall@thumbFile\empty
  \pgfkeys{/Photo/#1/file/.get=\@wall@thumbFile}%
\fi
\pgfkeys{/Photo/#1/caption/.get=\@wall@photoCaption}%
% Thumbnail caption
\ifvarnishmask%
\hspace*{\@wall@thumbWidth}
\else%
\begin{minipage}[b][\@wall@thumbHeight][t]{\@wall@thumbCaptionWidth}%
\raggedleft
\thumbFmt
{\thumbMonthFmt \@tr@monthNumName{\monthToNum{#1}}}\par
{\thumbCaptionFmt \@wall@photoCaption}%
\end{minipage}%
\fi%
\hspace*{3mm}
% Thumbnail photo
\begin{minipage}[b][\@wall@thumbHeight]{\@wall@thumbWidth}%
% FIXME placeholder
%\placeholder{%
\includegraphics[ keepaspectratio, height=\@wall@thumbHeight ]{\@wall@thumbFile}%
%}%
\end{minipage}%
}
#+end_src

** \textbackslash ThumbWithCaptionRightSide

Typesets the photo thumb image with its caption text on the right side.

: \ThumbWithCaptionRightSide{January}

#+begin_src tex :tangle ./examples/cal-thumbnails.tex
\newcommand\ThumbWithCaptionRightSide[1]{%
\pgfkeys{/Photo/#1/thumbFile/.get=\@wall@thumbFile}%
\ifx\@wall@thumbFile\empty
  \pgfkeys{/Photo/#1/file/.get=\@wall@thumbFile}%
\fi
\pgfkeys{/Photo/#1/caption/.get=\@wall@photoCaption}%
% Thumbnail photo
\begin{minipage}[b][\@wall@thumbHeight]{\@wall@thumbWidth}%
% FIXME placeholder
%\placeholder{%
\includegraphics[ keepaspectratio, height=\@wall@thumbHeight ]{\@wall@thumbFile}%
%}%
\end{minipage}%
\hspace*{3mm}
% Thumbnail caption
\ifvarnishmask%
\hspace*{\@wall@thumbWidth}
\else%
\begin{minipage}[b][\@wall@thumbHeight][t]{\@wall@thumbCaptionWidth}%
\raggedright
\thumbFmt
{\thumbMonthFmt \@tr@monthNumName{\monthToNum{#1}}}\par
{\thumbCaptionFmt \@wall@photoCaption}%
\end{minipage}%
\fi%
}
#+end_src

** \textbackslash ThumbsPage

#+begin_src tex :tangle ./examples/cal-thumbnails.tex
\newlength{\thumbColumnWidth}
\newlength{\thumbColumnHeight}
\newlength{\thumbSep}
\newlength{\@t@a}
\newlength{\@t@b}

% vertical spacing
\setlength{\@t@a}{0.2\textheight}

% horizontal spacing
\setlength{\@t@b}{0.2\@wall@thumbCaptionWidth}% 8mm at 40mm caption width

\ifdimcomp{\@t@a}{<}{\@t@b}{
  \setlength{\thumbSep}{\@t@a}
}{
  \setlength{\thumbSep}{\@t@b}
}

\setlength{\thumbColumnWidth}{0.5\calPaperWidth - \thumbSep}
\setlength{\thumbColumnHeight}{\textheight}

\newcommand\ThumbsPage{%
\clearpage

\hspace*{-\@wall@leftMargin}%
\hspace*{-1pt}% small correction, space gets in somewhere
% Wrap
\begin{minipage}[t][\thumbColumnHeight]{\calPaperWidth}%
\centering%
\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt}%

% NOTE: multicols will not \vfill
% Left Column
\begin{minipage}[t][\thumbColumnHeight]{\thumbColumnWidth}%
\raggedleft

\ThumbWithCaptionLeftSide{January}

\vspace*{\thumbSep}

\ThumbWithCaptionLeftSide{March}

\vspace*{\thumbSep}

\ThumbWithCaptionLeftSide{May}

\vspace*{\thumbSep}

\ThumbWithCaptionLeftSide{July}

\vspace*{\thumbSep}

\ThumbWithCaptionLeftSide{September}

\vspace*{\thumbSep}

\ThumbWithCaptionLeftSide{November}

% End of left column
\end{minipage}%
%
\hspace*{\thumbSep}%
%
% Right column
\begin{minipage}[t][\thumbColumnHeight]{\thumbColumnWidth}%
\raggedright

\ThumbWithCaptionRightSide{February}

\vspace*{\thumbSep}

\ThumbWithCaptionRightSide{April}

\vspace*{\thumbSep}

\ThumbWithCaptionRightSide{June}

\vspace*{\thumbSep}

\ThumbWithCaptionRightSide{August}

\vspace*{\thumbSep}

\ThumbWithCaptionRightSide{October}

\vspace*{\thumbSep}

\ThumbWithCaptionRightSide{December}

% End of right column
\end{minipage}%

% End of wrap
\end{minipage}%
}
#+end_src

** Setup the photo keys

#+begin_src tex :tangle ./examples/cal-thumbnails.tex
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{January}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{February}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{March}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{April}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{May}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{June}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{July}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{August}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{September}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{October}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{November}
\SetPhoto[file={frog-crop}, thumbFile={frog-crop-thumb}, caption={Let the frog jump}]{December}

\makeatother
#+end_src

** Use it

#+begin_src tex :tangle ./examples/cal-thumbnails.tex
\begin{document}

\ThumbsPage

\end{document}
#+end_src

* Documentclass Options

: year

: language

: imageFolder

: showframe

: showtrims

: varnishmask

* User Commands

: \SetPhoto[ options ]{ month }

: \SetQuote[ options ]{ month }{ quote text }

: \SetCalendar[ options ]{ month }

: \SetEvents[ options ]{ month }{ calendar tikz marks }{ events text }

: \MonthPage[ options ]{ month }

#+latex: \clearpage

* Page Layout

We will review how the page layout happens when we call =\MonthPage=.

Before calling =\MonthPage= to typeset a particular month, be sure that the
content for the given month has been already set with =\SetPhoto=, =\SetQuote=,
=\SetCalendar= and =\SetEvents=.

Then we can typeset that month, for example:

: \MonthPage[layout=full page, put photo=full page]{June}

This will be a full page portrait month with the photo scaled to cover the
entire page with additional bleed on all four sides.

#+begin_latex
\twocol{%
  \frame{\includegraphics[width=5cm]{cal-plain-01}}%
}{%
  \includegraphics[width=6.12cm]{cal-showframe-01}%
}
#+end_latex

The above =showframe= figure shows the structural elements of the page.

Every layout is implemented by a single handler macro which will deal with all
the typesetting of the given page. The =full page= key is set to the
=\@wall@fullPageLayout= macro by default, and so this gets called.

The layout macro is just a free-style placeholder. It can access the photo,
quote, calendar and events as set earlier, but it is up to the macro to
implement what to do with them.

This is for the convenience of setting the page elements using the same
interface, but being able to execute different layouts for different pages.

The class contains two layout examples. The =full page= layout is best for
portrait photos that can be scaled to cover the entire page. The =small
landscape= layout is for landscape photos which can be scaled horizontally,
possibly bleeding into the side margins.

* Contact

Github: <https://github.com/profound-labs/wallcalendar/>

Email: =Gambhīro Bhikkhu <gambhiro.bhikkhu.85@gmail.com>=
