I am planning to take some notes in a 'laboratory book'-ish latex document (compare these templates 1,2). The protocol will span a large time and entries might vary from a few items to several sides.

In order to keep better track of what I did when, I would like to have a calendar (e.g. this or this) that shows section titles (and maybe the page number). These should link to the sections (like done with pictures here).

Obviously one can use hyperref and simply do it by hand. However an TOC in such manner that is generated automatically was preferable.


How can I create a TOC that looks like a calendar?

(or: a calendar that acts like a TOC)

(probably not Minimal) Working Example

Neither looking particularly nice nor quick to create (even if I used a custom command for the entries):

% Monthly Calendar
% LaTeX Template
% This template has been downloaded from:
% http://www.latextemplates.com
% Original calendar style author:
% Evan Sultanik (http://www.sultanik.com/LaTeX_calendar_style)
% Important note:
% This template requires the calendar.sty file to be in the same directory as the
% .tex file. The calendar.sty file provides the necessary structure to create the
% calendar.
%   Modified in order to represent the MWE for tex.stackexchange question:
%   https://tex.stackexchange.com/q/356889/74942




LaTeX2e class file `calendar' v\CalendarVersion]

\typeout{'calendar' style \CalendarVersion \CalendarVersionDate.}
\typeout{Created by Evan Sultanik}
\typeout{****** Bugs/comments/suggestions/technicalities to Evan Sultanik -- evan@sultanik.com ******}



    \parbox{\hsize}{\vspace*{5pt}\raggedright\scriptsize #1}\smallskip



    \ifnum#1=1 Sunday\else
    \ifnum#1=2 Monday\else
    \ifnum#1=3 Tuesday\else
    \ifnum#1=4 Wednesday\else
    \ifnum#1=5 Thursday\else
    \ifnum#1=6 Friday\else
    \ifnum#1=7 Saturday\else
    \PackageError{calendar}{Unrecognized day number: #1!}

        \if\@calendarmode\@CALtrue\else\PackageWarning{calendar}{The '\day' macro is expected to be used in the 'calendar' environment!}\fi
        \global\advance\@currentdaynum by 1
        \ifnum\@currentdaynum=6 &\\\hline\else
        \ifnum\@currentdaynum=5 &&\\\hline\else
        \ifnum\@currentdaynum=4 &&&\\\hline\else
        \ifnum\@currentdaynum=3 &&&&\\\hline\else
        \ifnum\@currentdaynum=2 &&&&&\\\hline\else
        \ifnum\@currentdaynum=1 &&&&&&\\\hline
        \if\@calendarmode\@CALtrue\else\PackageWarning{calendar}{The '\calendarday' macro is expected to be used in the 'calendar' environment!}\fi
        \global\advance\@currentdaynum by 1

    \tabularx{\@calendarwidth}{|X|X|X|X|X|X|X|} \hline
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 \\ \hline \hline
\usepackage{calendar} % Use the calendar.sty style


\pagestyle{empty} % Removes the page number from the bottom of the page


\StartingDayNumber=1 % Calendar starting day, default of 1 means Sunday, 2 for Monday, etc

\section{Table of Contents}
\textsc{\LARGE january}\\ % Month
\textsc{\large 2017} % Year




% This part is very finicky. It defines the number of blank days at the beginning of the calendar before the first of the month starts. If you need this to be more than 4 (i.e. the first starts on a Friday or Saturday in a 31 day month), then you have two options: 
% 1) You can uncomment another one or two \BlankDay's below which will make a new week (6 total) which makes the calendar too big for one page, remedy this by decreasing the size of each day by replacing 2.5cm below with a smaller number. 
% 2) Make the spill-over days start at the top left of the calendar (i.e. the calendar starts with 31 then a few days blank then 1, 2, 3, etc). The second option can be configured by uncommenting the below:

%\setcounter{calendardate}{31} % Begin the count with 31 so the top left day is 31; this can be changed to 29 or 30 as required
%\day{}{\vspace{2.5cm}} % 31 - add another line identical to this if starting at 30 or earlier

% You will need to comment out the 31 in the NUMBERED DAYS AND CALENDAR CONTENT section below for this as well as commenting out one of the \BlankDay's below. Play around with it and you will get it.



% These are the numbered days in the template - if there are less than 31 days simply comment out the bottom lines.

% \vspace{2.5cm} is only there to provide an even look to the calendar where each day is 2.5cm tall, it can be changed or removed to automatically adjust to the day in the week with the most content

\setcounter{calendardate}{1} % Start the date counter at 1

            \hyperref[01012017]{\nameref{01012017}} \hfill \pageref{01012017} \\
            \hyperref[01012017_h]{\nameref{01012017_h}} \hfill \pageref{01012017_h} \\
            \hyperref[01012017_s]{\nameref{01012017_s}} \hfill \pageref{01012017_s}
            } % 1 - Example of content
    \hyperref[02012017]{\nameref{02012017}} \hfill \pageref{02012017} \\
    \hyperref[02012017_a]{\nameref{02012017_a}} \hfill \pageref{02012017_a} \\
    \hyperref[02012017_b]{\nameref{02012017_b}} \hfill \pageref{02012017_b}
} % 2 
\day{}{\vspace{2.5cm}} % 3
\day{}{\vspace{2.5cm}} % 4
\day{}{\vspace{2.5cm}} % 5
\day{}{\vspace{2.5cm}} % 6
\day{}{\vspace{2.5cm}} % 7
\day{}{\vspace{2.5cm}} % 8
    \hyperref[09012017]{\nameref{09012017}} \hfill \pageref{09012017} \\
} % 9
\day{}{\vspace{2.5cm}} % 10
\day{}{\vspace{2.5cm}} % 11
\day{}{\vspace{2.5cm}} % 12
\day{}{\vspace{2.5cm}} % 13
\day{}{\vspace{2.5cm}} % 14
\day{}{\vspace{2.5cm}} % 15
\day{}{\vspace{2.5cm}} % 16
\day{}{\vspace{2.5cm}} % 17
\day{}{\vspace{2.5cm}} % 18
\day{}{\vspace{2.5cm}} % 19
\day{}{\vspace{2.5cm}} % 20 
\day{}{\vspace{2.5cm}} % 21
\day{}{\vspace{2.5cm}} % 22
\day{}{\vspace{2.5cm}} % 23
\day{}{\vspace{2.5cm}} % 24
\day{}{\vspace{2.5cm}} % 25
\day{}{\vspace{2.5cm}} % 26
\day{}{\vspace{2.5cm}} % 27
\day{}{\vspace{2.5cm}} % 28
\day{}{\vspace{2.5cm}} % 29 
\day{}{\vspace{2.5cm}} % 30 
\day{}{\vspace{2.5cm}} % 31

% Un-comment the \BlankDay below if the bottom line of the calendar is missing

% Un-comment to start counting again after 31
%\day{}{\vspace{2.5cm}} % 1
%\day{}{\vspace{2.5cm}} % 2
%\day{}{\vspace{2.5cm}} % 3



\section{day1 - 01.01.2017}\label{01012017}
    \item did some setup things
    \item $\dots$

My tedious written composition of annoying hardware setup.
The fun part: software!

\section{day2 - 02.01.2017}\label{02012017}
\section{first test project}\label{02012017_a}
some text
\section{video shoot}\label{02012017_b}
notes on my video log recording
\section{something important}\label{09012017}


(I did not want to remove too much information so no-one would confuse this with not being from latextemplates.com. Moreover I am not aware what is actually minimally required)

produces: enter image description here


first outsourced question: Bake '\today' into source file (or custom aux-file)


I am still investigating on this issue, hence ... Helpful information, e.g. on generation of ToCs, deeper TeX(-programming) necessary for this project or anything else would be much appreciated also!

  • Make a ToC that look like a calendar-table will be not trivial, I guess. Among others issues, how determine in which day should appear each section? (i.e. why "hardware" is in 1st tuesday, for instance?) So...why not simply make a empty calendar, put a label in each section (e.g.: \section{First test proyect\label{sec:firstp}}) and insert a cross-reference in the calendar? I mean some like \nameref{sec:firstp}\dotfill\pageref{sec:firstp}? (not very automatic, but probably a lot faster that try to do magic). – Fran Mar 5 '17 at 0:00
  • @Fran well, that is obviously an option, though I am explicitly asking for some TeX magician. The parts are all existent (ToC, calendars, linking, sectioning, ...). The day or place to insert could either be an additional option for section or automatically extracted from current date (like \today). However, when its done automatically one cannot insert things that cover several days so in the end a manual option was needed anyways I guess. – gr4nt3d Mar 5 '17 at 15:42
  • @hillbilly Please include a Minimum Working Example in the form of LaTeX in the post, rather than supplying links. – Mussé Redi Mar 6 '17 at 13:56
  • 1
    @MusséRedi I dont know what minimal means in this context. I have no knowledge of deep TeX and creating ToCs. I tried to create something like the desired result in the example. (@Fran the added working example is not convenient to use due to the manual work necessary.) – gr4nt3d Mar 8 '17 at 12:05
  • 1
    See tex.meta.stackexchange.com/questions/228/…. You are looking for a very dedicated helper if you expect somebody to follow all those links. Try breaking the task down into one step at a time. Ask about steps you get stuck on, rather than asking for the whole caboodle, whicj is way too much for this format. – cfr Jun 21 '17 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.