Making TikZ diary - combining multiple elements despite date loops
up vote
0
down vote
favorite
I am trying to create a diary/organiser in TeX/Tikz, but having adjusted code found online I've struggling to combine elements into one document which has the following format:
Calendar overview of month with birthday's marked in, followed by week to view diary over two pages alternated with pages of square dotted note paper
Too ambitious?
So for example, from January the format would be:
- Calendar overview of January
- Two pages square dot note paper
- Week 1 diary over two pages (2-8 Jan)
- Two pages square dot note paper
- Week 2 diary over two pages (9-15 Jan)
- Two pages square dot note paper
- Week 3 diary over two pages (16-22 Jan)
- Two pages square dot note paper
- Week 4 diary over two pages (23 - 29 Jan)
- Two pages square dot note paper
- Calendar overview of February
- and so on for the year!
I am not a very elegant coder and a beginner with tex, so you'll probably find the additions I've made to scripts inefficient. Below are the three different scripts for the elements I'm seeking to combine into one document.
The first script - that makes the week-to-view pages - has a loop at the end which ensures all the dates are correct in the document. I can't tell how to keep this loop working, and also combine in the other elements.
week-to-view diary layout
The following code creates the diary layout I'm seeking - I adapted it from LaTeX calendar layout in Moleskine/Leuchtturm weekly format.
%%%%Script to make an organiser - week-to-view across two pages
documentclass[tikz]{standalone}% Does not support leap years.
pdfpageheight=210mm %%Should make PDF A5
pdfpagewidth=148mm
%% Load needed packages
usepackage{lmodern}
usepackage{tikz}
usetikzlibrary{positioning}
usepackage{ifthen}
%% Create needed conters
newcounter{ThisYear}
newcounter{NewYearsDay}
newcounter{NewYearsWeek}
newcounter{NumberOfWeeksThisYear}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SET VARIABLES HERE %
% Year number you want to generate the calendar for:
setcounter{ThisYear}{2019}
% Which day is the January, 1st? (1 for Monday, 2 for Tuesday, etc.)
setcounter{NewYearsDay}{7}
% Which week does January, 1st belongs to?
% Choose 52 (sometimes 53) or 1. Week 1 is not necessary the week of Jan, 1st; but *it is the week of Jan, 4th.*)
setcounter{NewYearsWeek}{52}
% How many weeks this year? (Choose 52 or 53, appropriately)
setcounter{NumberOfWeeksThisYear}{52}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Let's begin with messy stuff
% If Jan, 1st is not on Week #1...
ifthenelse{value{NewYearsWeek}>51}{
addtocounter{ThisYear}{-1} % start calendar with the last week of the previous year
stepcounter{NumberOfWeeksThisYear} % increase amount of weeks to generate
}{}
% Following counter is the backbone of the calendar generation.
newcounter{NDOYnumber} %% Nth Day Of the Year: 1 for Jan, 1st; 2 for Jan, 2nd; etc.
% Set the first day of the calendar (i.e. Monday of the first generated week)
ifthenelse{value{NewYearsDay}=1}{
% Monday = Jan, 1st
setcounter{NDOYnumber}{1}
}{
% Monday belongs to previous year
setcounter{NDOYnumber}{367}
addtocounter{NDOYnumber}{-value{NewYearsDay}}
}
% Store day's quantieme (1 for Jan, 1st & Feb, 1st, etc.; 17 for Jan, 17th, Feb, 17th, etc.)
newcounter{NDOYquantieme}
% Store day's month number (1 for Jan, 2 for Feb, etc.)
newcounter{NDOYmonthnumber}
% Internal counter
newcounter{tempNDOY}
% Based on `NDOYnumber` value, compute month number and quantieme
newcommand{NDOYtomonthnumber}{%
setcounter{tempNDOY}{value{NDOYnumber}}%
setcounter{NDOYmonthnumber}{1}%
ifthenelse{value{tempNDOY}<32}{% %% JANUARY
setcounter{NDOYquantieme}{value{tempNDOY}}%% Set January quantieme
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% FEBRUARY
ifthenelse{value{tempNDOY}<29}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-28}%
stepcounter{NDOYmonthnumber}% %% MARCH
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% APRIL
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% MAY
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% JUNE
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% JULY
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% AUGUST
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% SEPTEMBER
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% OCTOBER
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% NOVEMBER
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% DECEMBER
setcounter{NDOYquantieme}{value{tempNDOY}}%
}}}}}}}}}}}%
}
% Based on previously computed `NDOYmonthnumber` value, return month name
newcommand{NDOYtomonth}{%
foreach monthnumber/monthname in {1/January, 2/February, 3/March, 4/April, 5/May, 6/June, 7/July, 8/August, 9/September, 10/October, 11/November, 12/December}{%
ifthenelse{value{NDOYmonthnumber}=monthnumber}{monthname}{}%
}
}
% 'Smartly' increase `NDOYnumber` value (i.e. reset to 1 after December, 31st)
newcommand{stepNDOY}{%
ifthenelse{value{NDOYnumber}=365}{%
setcounter{NDOYnumber}{1}%
stepcounter{ThisYear}
}{%
stepcounter{NDOYnumber}%
}%
}
% Defines the `tikzpicture` used to print a week (i.e. calendar page) - 1 page Mon/Tues/Weds
newcommand{printweek}[1]{% argument = value{NDOYnumber}, i.e. Monday's day-of-the-year number
% begin{tikzpicture}[%
%draw [step=0.2cm,dotted, gray] (0,0) grid (7,9);
% end{tikzpicture}%
begin{tikzpicture}[%
inner sep=3 pt,
dayname/.style={%
node font=footnotesize,
},
daynumber/.style={%
anchor=north east,
node font=footnotesize,
},
%xscale = 3,
%yscale=-1.5,% CAUTION: axis direction reversed!
]
NDOYtomonthnumber%(see below)
node (year_number) at (1,10) [anchor = south east, minimum height = 2em] {theThisYear}; %prints year number
node [base right = 1em of year_number, anchor=base west, node font=large] {NDOYtomonth}; %prints month name
%% Monday
NDOYtomonthnumber % compute and store which month and quantieme is this day, based on `NDOYnumber` value
node (monday_number) at (1,9) [daynumber] {theNDOYquantieme}; % prints quantieme
node [base right = 1em of monday_number, anchor=base west] [dayname] {Monday}; % prints day name
stepNDOY % 'smartly' increases `NDOYnumber` value
%% Tuesday
NDOYtomonthnumber
node (tuesday_number) at (1,6) [daynumber] {theNDOYquantieme};
node [base right = 1em of tuesday_number, anchor=base west] [dayname] {Tuesday};
stepNDOY
%% Wednesday
NDOYtomonthnumber
node (wednesday_number) at (1,3) [daynumber] {theNDOYquantieme};
node [base right = 1em of wednesday_number, anchor=base west] [dayname] {Wednesday};
stepNDOY
%% Draw lines
foreach i in {0, 1.2, ..., 7}{%
% draw [dotted, gray, thin] (2,i) -- (4,i); %%non-weekday side lines
draw [gray, thin] (5,i) -- (5,i); %(across,up)
}
%%box at the top
draw (0,9) --(0,10) -- (7,10) -- (7,9); %(across,up)
%%Draw the boxes for days of the week - 3 boxes on one side
draw (0,6) --(0,9) -- (7,9) -- (7,6); %(across,up)
draw (0,3) --(0,6) -- (7,6) -- (7,3); %(across,up)
draw (0,0) --(0,3) -- (7,3) -- (7,0); %(across,up)
%%Line to make do-list for each day
draw (5,0) --(5,9); %(across,up)
%%Line to split weekdays in AM and PM
draw [dotted] (2.5,0)--(2.5,2.5); %(across,up)
draw [dotted] (2.5, 3)--(2.5,5.5); %(across,up)
draw [dotted] (2.5, 6)--(2.5,8.5); %(across,up)
% boxes are 10 lines each (5 lines weekend) - draw in these lines
draw [dotted] (0,6.25) -- (7, 6.25); %(across,up)
draw [dotted] (0,6.50) -- (7, 6.50); %(across,up)
draw [dotted] (0,6.75) -- (7, 6.75); %(across,up)
draw [dotted] (0,7) -- (7, 7); %(across,up)
draw [dotted] (0,7.25) -- (7, 7.25); %(across,up)
draw [dotted] (0,7.50) -- (7, 7.50); %(across,up)
draw [dotted] (0,7.75) -- (7, 7.75); %(across,up)
draw [dotted] (0,8) -- (7, 8); %(across,up)
draw [dotted] (0,8.25) -- (7, 8.25); %(across,up)
draw [dotted] (0,8.50) -- (7, 8.50); %(across,up)
draw [dotted] (0,3.25) -- (7, 3.25); %(across,up)
draw [dotted] (0,3.50) -- (7, 3.50); %(across,up)
draw [dotted] (0,3.75) -- (7, 3.75); %(across,up)
draw [dotted] (0,4) -- (7, 4); %(across,up)
draw [dotted] (0,4.25) -- (7, 4.25); %(across,up)
draw [dotted] (0,4.50) -- (7, 4.50); %(across,up)
draw [dotted] (0,4.75) -- (7, 4.75); %(across,up)
draw [dotted] (0,5) -- (7, 5); %(across,up)
draw [dotted] (0,5.25) -- (7, 5.25); %(across,up)
draw [dotted] (0,5.50) -- (7, 5.50); %(across,up)
draw [dotted] (0,0.25) -- (7, 0.25);
draw [dotted] (0,0.50) -- (7, 0.50);
draw [dotted] (0,0.75) -- (7, 0.75);
draw [dotted] (0,1) -- (7, 1);
draw [dotted] (0,1.25) -- (7, 1.25);
draw [dotted] (0,1.50) -- (7, 1.50);
draw [dotted] (0,1.75) -- (7, 1.75);
draw [dotted] (0,2) -- (7, 2);
draw [dotted] (0,2.25) -- (7, 2.25);
draw [dotted] (0,2.50) -- (7, 2.50);
end{tikzpicture}%
% Defines the `tikzpicture` used to print a week (i.e. calendar page) - 1 page Thurs/Fri/Sat/Sun
begin{tikzpicture}[%
inner sep=3 pt,
dayname/.style={%
node font=footnotesize,
},
daynumber/.style={%
anchor=north east,
node font=normalsizebfseries,
},
%xscale = 3,
%yscale=-1.5,% CAUTION: axis direction reversed!
]
NDOYtomonthnumber%(see below)
node (year_number) at (1,10) [anchor = south east, minimum height = 2em] {theThisYear}; %prints year number
node [base right = 1em of year_number, anchor=base west, node font=large] {NDOYtomonth}; %prints month name
%% Thursday
NDOYtomonthnumber
node (thursday_number) at (1,9) [daynumber] {theNDOYquantieme};
node [base right = 1em of thursday_number, anchor=base west] [dayname] {Thursday};
stepNDOY
%% Friday
NDOYtomonthnumber
node (friday_number) at (1,6) [daynumber] {theNDOYquantieme};
node [base right = 1em of friday_number, anchor=base west] [dayname] {Friday};
stepNDOY
%% Saturday
NDOYtomonthnumber
node (saturday_number) at (1,3) [daynumber] {theNDOYquantieme};
node [base right = 1em of saturday_number, anchor=base west] [dayname] {Saturday};
stepNDOY
%% Sunday
NDOYtomonthnumber
node (sunday_number) at (1,1.5) [daynumber] {theNDOYquantieme};
node [base right = 1em of sunday_number, anchor=base west] [dayname] {Sunday};
stepNDOY
%% Draw lines
foreach i in {0, 1.2, ..., 7}{%
% draw [dotted, gray, thin] (2,i) -- (4,i); %%non-weekday side lines
draw [gray, thin] (5,i) -- (5,i); %(across,up)
}
%%box at the top
draw (0,9) --(0,10) -- (7,10) -- (7,9); %(across,up)
%%Draw the boxes for days of the week - 3 boxes on one side
draw (0,6) --(0,9) -- (7,9) -- (7,6); %(across,up)
draw (0,3) --(0,6) -- (7,6) -- (7,3); %(across,up)
draw (0,1.5) --(0,3) -- (7,3) -- (7,1.5); %(across,up)
draw (0,0) --(0,1.5) -- (7,1.5) -- (7,0); %(across,up)
%%Line to make do-list for each day
draw (5,0) --(5,9); %(across,up)
%%Line to split weekdays in AM and PM
draw [dotted] (2.5, 3)--(2.5,5.5); %(across,up)
draw [dotted] (2.5, 6)--(2.5,8.5); %(across,up)
% boxes are 10 lines each (5 lines weekend) - draw in these lines
draw [dotted] (0,6.25) -- (7, 6.25); %(across,up)
draw [dotted] (0,6.50) -- (7, 6.50); %(across,up)
draw [dotted] (0,6.75) -- (7, 6.75); %(across,up)
draw [dotted] (0,7) -- (7, 7); %(across,up)
draw [dotted] (0,7.25) -- (7, 7.25); %(across,up)
draw [dotted] (0,7.50) -- (7, 7.50); %(across,up)
draw [dotted] (0,7.75) -- (7, 7.75); %(across,up)
draw [dotted] (0,8) -- (7, 8); %(across,up)
draw [dotted] (0,8.25) -- (7, 8.25); %(across,up)
draw [dotted] (0,8.50) -- (7, 8.50); %(across,up)
draw [dotted] (0,3.25) -- (7, 3.25); %(across,up)
draw [dotted] (0,3.50) -- (7, 3.50); %(across,up)
draw [dotted] (0,3.75) -- (7, 3.75); %(across,up)
draw [dotted] (0,4) -- (7, 4); %(across,up)
draw [dotted] (0,4.25) -- (7, 4.25); %(across,up)
draw [dotted] (0,4.50) -- (7, 4.50); %(across,up)
draw [dotted] (0,4.75) -- (7, 4.75); %(across,up)
draw [dotted] (0,5) -- (7, 5); %(across,up)
draw [dotted] (0,5.25) -- (7, 5.25); %(across,up)
draw [dotted] (0,5.50) -- (7, 5.50); %(across,up)
end{tikzpicture}%
}
begin{document}
foreach n in {1,...,value{NumberOfWeeksThisYear}}{%
printweek{value{NDOYnumber}}
}
end{document}
Overview calendar
The calendar overview layout I have working, adapated from http://www.texample.net/tikz/examples/birthday-calendar/. However, how do I get it to the right place in the layout?
Note pages
And to make square dotted note paper, I have
draw [step=0.2cm,dotted, gray] (0,0) grid (7,7);
Any help appreciated - or direction to other posts which cover this issue. It was tricky to know how to search for it.
Thanks,
Lindsey
tikz-pgf tikz-styles calendar tikz-calendar
New contributor
add a comment |
up vote
0
down vote
favorite
I am trying to create a diary/organiser in TeX/Tikz, but having adjusted code found online I've struggling to combine elements into one document which has the following format:
Calendar overview of month with birthday's marked in, followed by week to view diary over two pages alternated with pages of square dotted note paper
Too ambitious?
So for example, from January the format would be:
- Calendar overview of January
- Two pages square dot note paper
- Week 1 diary over two pages (2-8 Jan)
- Two pages square dot note paper
- Week 2 diary over two pages (9-15 Jan)
- Two pages square dot note paper
- Week 3 diary over two pages (16-22 Jan)
- Two pages square dot note paper
- Week 4 diary over two pages (23 - 29 Jan)
- Two pages square dot note paper
- Calendar overview of February
- and so on for the year!
I am not a very elegant coder and a beginner with tex, so you'll probably find the additions I've made to scripts inefficient. Below are the three different scripts for the elements I'm seeking to combine into one document.
The first script - that makes the week-to-view pages - has a loop at the end which ensures all the dates are correct in the document. I can't tell how to keep this loop working, and also combine in the other elements.
week-to-view diary layout
The following code creates the diary layout I'm seeking - I adapted it from LaTeX calendar layout in Moleskine/Leuchtturm weekly format.
%%%%Script to make an organiser - week-to-view across two pages
documentclass[tikz]{standalone}% Does not support leap years.
pdfpageheight=210mm %%Should make PDF A5
pdfpagewidth=148mm
%% Load needed packages
usepackage{lmodern}
usepackage{tikz}
usetikzlibrary{positioning}
usepackage{ifthen}
%% Create needed conters
newcounter{ThisYear}
newcounter{NewYearsDay}
newcounter{NewYearsWeek}
newcounter{NumberOfWeeksThisYear}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SET VARIABLES HERE %
% Year number you want to generate the calendar for:
setcounter{ThisYear}{2019}
% Which day is the January, 1st? (1 for Monday, 2 for Tuesday, etc.)
setcounter{NewYearsDay}{7}
% Which week does January, 1st belongs to?
% Choose 52 (sometimes 53) or 1. Week 1 is not necessary the week of Jan, 1st; but *it is the week of Jan, 4th.*)
setcounter{NewYearsWeek}{52}
% How many weeks this year? (Choose 52 or 53, appropriately)
setcounter{NumberOfWeeksThisYear}{52}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Let's begin with messy stuff
% If Jan, 1st is not on Week #1...
ifthenelse{value{NewYearsWeek}>51}{
addtocounter{ThisYear}{-1} % start calendar with the last week of the previous year
stepcounter{NumberOfWeeksThisYear} % increase amount of weeks to generate
}{}
% Following counter is the backbone of the calendar generation.
newcounter{NDOYnumber} %% Nth Day Of the Year: 1 for Jan, 1st; 2 for Jan, 2nd; etc.
% Set the first day of the calendar (i.e. Monday of the first generated week)
ifthenelse{value{NewYearsDay}=1}{
% Monday = Jan, 1st
setcounter{NDOYnumber}{1}
}{
% Monday belongs to previous year
setcounter{NDOYnumber}{367}
addtocounter{NDOYnumber}{-value{NewYearsDay}}
}
% Store day's quantieme (1 for Jan, 1st & Feb, 1st, etc.; 17 for Jan, 17th, Feb, 17th, etc.)
newcounter{NDOYquantieme}
% Store day's month number (1 for Jan, 2 for Feb, etc.)
newcounter{NDOYmonthnumber}
% Internal counter
newcounter{tempNDOY}
% Based on `NDOYnumber` value, compute month number and quantieme
newcommand{NDOYtomonthnumber}{%
setcounter{tempNDOY}{value{NDOYnumber}}%
setcounter{NDOYmonthnumber}{1}%
ifthenelse{value{tempNDOY}<32}{% %% JANUARY
setcounter{NDOYquantieme}{value{tempNDOY}}%% Set January quantieme
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% FEBRUARY
ifthenelse{value{tempNDOY}<29}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-28}%
stepcounter{NDOYmonthnumber}% %% MARCH
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% APRIL
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% MAY
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% JUNE
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% JULY
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% AUGUST
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% SEPTEMBER
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% OCTOBER
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% NOVEMBER
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% DECEMBER
setcounter{NDOYquantieme}{value{tempNDOY}}%
}}}}}}}}}}}%
}
% Based on previously computed `NDOYmonthnumber` value, return month name
newcommand{NDOYtomonth}{%
foreach monthnumber/monthname in {1/January, 2/February, 3/March, 4/April, 5/May, 6/June, 7/July, 8/August, 9/September, 10/October, 11/November, 12/December}{%
ifthenelse{value{NDOYmonthnumber}=monthnumber}{monthname}{}%
}
}
% 'Smartly' increase `NDOYnumber` value (i.e. reset to 1 after December, 31st)
newcommand{stepNDOY}{%
ifthenelse{value{NDOYnumber}=365}{%
setcounter{NDOYnumber}{1}%
stepcounter{ThisYear}
}{%
stepcounter{NDOYnumber}%
}%
}
% Defines the `tikzpicture` used to print a week (i.e. calendar page) - 1 page Mon/Tues/Weds
newcommand{printweek}[1]{% argument = value{NDOYnumber}, i.e. Monday's day-of-the-year number
% begin{tikzpicture}[%
%draw [step=0.2cm,dotted, gray] (0,0) grid (7,9);
% end{tikzpicture}%
begin{tikzpicture}[%
inner sep=3 pt,
dayname/.style={%
node font=footnotesize,
},
daynumber/.style={%
anchor=north east,
node font=footnotesize,
},
%xscale = 3,
%yscale=-1.5,% CAUTION: axis direction reversed!
]
NDOYtomonthnumber%(see below)
node (year_number) at (1,10) [anchor = south east, minimum height = 2em] {theThisYear}; %prints year number
node [base right = 1em of year_number, anchor=base west, node font=large] {NDOYtomonth}; %prints month name
%% Monday
NDOYtomonthnumber % compute and store which month and quantieme is this day, based on `NDOYnumber` value
node (monday_number) at (1,9) [daynumber] {theNDOYquantieme}; % prints quantieme
node [base right = 1em of monday_number, anchor=base west] [dayname] {Monday}; % prints day name
stepNDOY % 'smartly' increases `NDOYnumber` value
%% Tuesday
NDOYtomonthnumber
node (tuesday_number) at (1,6) [daynumber] {theNDOYquantieme};
node [base right = 1em of tuesday_number, anchor=base west] [dayname] {Tuesday};
stepNDOY
%% Wednesday
NDOYtomonthnumber
node (wednesday_number) at (1,3) [daynumber] {theNDOYquantieme};
node [base right = 1em of wednesday_number, anchor=base west] [dayname] {Wednesday};
stepNDOY
%% Draw lines
foreach i in {0, 1.2, ..., 7}{%
% draw [dotted, gray, thin] (2,i) -- (4,i); %%non-weekday side lines
draw [gray, thin] (5,i) -- (5,i); %(across,up)
}
%%box at the top
draw (0,9) --(0,10) -- (7,10) -- (7,9); %(across,up)
%%Draw the boxes for days of the week - 3 boxes on one side
draw (0,6) --(0,9) -- (7,9) -- (7,6); %(across,up)
draw (0,3) --(0,6) -- (7,6) -- (7,3); %(across,up)
draw (0,0) --(0,3) -- (7,3) -- (7,0); %(across,up)
%%Line to make do-list for each day
draw (5,0) --(5,9); %(across,up)
%%Line to split weekdays in AM and PM
draw [dotted] (2.5,0)--(2.5,2.5); %(across,up)
draw [dotted] (2.5, 3)--(2.5,5.5); %(across,up)
draw [dotted] (2.5, 6)--(2.5,8.5); %(across,up)
% boxes are 10 lines each (5 lines weekend) - draw in these lines
draw [dotted] (0,6.25) -- (7, 6.25); %(across,up)
draw [dotted] (0,6.50) -- (7, 6.50); %(across,up)
draw [dotted] (0,6.75) -- (7, 6.75); %(across,up)
draw [dotted] (0,7) -- (7, 7); %(across,up)
draw [dotted] (0,7.25) -- (7, 7.25); %(across,up)
draw [dotted] (0,7.50) -- (7, 7.50); %(across,up)
draw [dotted] (0,7.75) -- (7, 7.75); %(across,up)
draw [dotted] (0,8) -- (7, 8); %(across,up)
draw [dotted] (0,8.25) -- (7, 8.25); %(across,up)
draw [dotted] (0,8.50) -- (7, 8.50); %(across,up)
draw [dotted] (0,3.25) -- (7, 3.25); %(across,up)
draw [dotted] (0,3.50) -- (7, 3.50); %(across,up)
draw [dotted] (0,3.75) -- (7, 3.75); %(across,up)
draw [dotted] (0,4) -- (7, 4); %(across,up)
draw [dotted] (0,4.25) -- (7, 4.25); %(across,up)
draw [dotted] (0,4.50) -- (7, 4.50); %(across,up)
draw [dotted] (0,4.75) -- (7, 4.75); %(across,up)
draw [dotted] (0,5) -- (7, 5); %(across,up)
draw [dotted] (0,5.25) -- (7, 5.25); %(across,up)
draw [dotted] (0,5.50) -- (7, 5.50); %(across,up)
draw [dotted] (0,0.25) -- (7, 0.25);
draw [dotted] (0,0.50) -- (7, 0.50);
draw [dotted] (0,0.75) -- (7, 0.75);
draw [dotted] (0,1) -- (7, 1);
draw [dotted] (0,1.25) -- (7, 1.25);
draw [dotted] (0,1.50) -- (7, 1.50);
draw [dotted] (0,1.75) -- (7, 1.75);
draw [dotted] (0,2) -- (7, 2);
draw [dotted] (0,2.25) -- (7, 2.25);
draw [dotted] (0,2.50) -- (7, 2.50);
end{tikzpicture}%
% Defines the `tikzpicture` used to print a week (i.e. calendar page) - 1 page Thurs/Fri/Sat/Sun
begin{tikzpicture}[%
inner sep=3 pt,
dayname/.style={%
node font=footnotesize,
},
daynumber/.style={%
anchor=north east,
node font=normalsizebfseries,
},
%xscale = 3,
%yscale=-1.5,% CAUTION: axis direction reversed!
]
NDOYtomonthnumber%(see below)
node (year_number) at (1,10) [anchor = south east, minimum height = 2em] {theThisYear}; %prints year number
node [base right = 1em of year_number, anchor=base west, node font=large] {NDOYtomonth}; %prints month name
%% Thursday
NDOYtomonthnumber
node (thursday_number) at (1,9) [daynumber] {theNDOYquantieme};
node [base right = 1em of thursday_number, anchor=base west] [dayname] {Thursday};
stepNDOY
%% Friday
NDOYtomonthnumber
node (friday_number) at (1,6) [daynumber] {theNDOYquantieme};
node [base right = 1em of friday_number, anchor=base west] [dayname] {Friday};
stepNDOY
%% Saturday
NDOYtomonthnumber
node (saturday_number) at (1,3) [daynumber] {theNDOYquantieme};
node [base right = 1em of saturday_number, anchor=base west] [dayname] {Saturday};
stepNDOY
%% Sunday
NDOYtomonthnumber
node (sunday_number) at (1,1.5) [daynumber] {theNDOYquantieme};
node [base right = 1em of sunday_number, anchor=base west] [dayname] {Sunday};
stepNDOY
%% Draw lines
foreach i in {0, 1.2, ..., 7}{%
% draw [dotted, gray, thin] (2,i) -- (4,i); %%non-weekday side lines
draw [gray, thin] (5,i) -- (5,i); %(across,up)
}
%%box at the top
draw (0,9) --(0,10) -- (7,10) -- (7,9); %(across,up)
%%Draw the boxes for days of the week - 3 boxes on one side
draw (0,6) --(0,9) -- (7,9) -- (7,6); %(across,up)
draw (0,3) --(0,6) -- (7,6) -- (7,3); %(across,up)
draw (0,1.5) --(0,3) -- (7,3) -- (7,1.5); %(across,up)
draw (0,0) --(0,1.5) -- (7,1.5) -- (7,0); %(across,up)
%%Line to make do-list for each day
draw (5,0) --(5,9); %(across,up)
%%Line to split weekdays in AM and PM
draw [dotted] (2.5, 3)--(2.5,5.5); %(across,up)
draw [dotted] (2.5, 6)--(2.5,8.5); %(across,up)
% boxes are 10 lines each (5 lines weekend) - draw in these lines
draw [dotted] (0,6.25) -- (7, 6.25); %(across,up)
draw [dotted] (0,6.50) -- (7, 6.50); %(across,up)
draw [dotted] (0,6.75) -- (7, 6.75); %(across,up)
draw [dotted] (0,7) -- (7, 7); %(across,up)
draw [dotted] (0,7.25) -- (7, 7.25); %(across,up)
draw [dotted] (0,7.50) -- (7, 7.50); %(across,up)
draw [dotted] (0,7.75) -- (7, 7.75); %(across,up)
draw [dotted] (0,8) -- (7, 8); %(across,up)
draw [dotted] (0,8.25) -- (7, 8.25); %(across,up)
draw [dotted] (0,8.50) -- (7, 8.50); %(across,up)
draw [dotted] (0,3.25) -- (7, 3.25); %(across,up)
draw [dotted] (0,3.50) -- (7, 3.50); %(across,up)
draw [dotted] (0,3.75) -- (7, 3.75); %(across,up)
draw [dotted] (0,4) -- (7, 4); %(across,up)
draw [dotted] (0,4.25) -- (7, 4.25); %(across,up)
draw [dotted] (0,4.50) -- (7, 4.50); %(across,up)
draw [dotted] (0,4.75) -- (7, 4.75); %(across,up)
draw [dotted] (0,5) -- (7, 5); %(across,up)
draw [dotted] (0,5.25) -- (7, 5.25); %(across,up)
draw [dotted] (0,5.50) -- (7, 5.50); %(across,up)
end{tikzpicture}%
}
begin{document}
foreach n in {1,...,value{NumberOfWeeksThisYear}}{%
printweek{value{NDOYnumber}}
}
end{document}
Overview calendar
The calendar overview layout I have working, adapated from http://www.texample.net/tikz/examples/birthday-calendar/. However, how do I get it to the right place in the layout?
Note pages
And to make square dotted note paper, I have
draw [step=0.2cm,dotted, gray] (0,0) grid (7,7);
Any help appreciated - or direction to other posts which cover this issue. It was tricky to know how to search for it.
Thanks,
Lindsey
tikz-pgf tikz-styles calendar tikz-calendar
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to create a diary/organiser in TeX/Tikz, but having adjusted code found online I've struggling to combine elements into one document which has the following format:
Calendar overview of month with birthday's marked in, followed by week to view diary over two pages alternated with pages of square dotted note paper
Too ambitious?
So for example, from January the format would be:
- Calendar overview of January
- Two pages square dot note paper
- Week 1 diary over two pages (2-8 Jan)
- Two pages square dot note paper
- Week 2 diary over two pages (9-15 Jan)
- Two pages square dot note paper
- Week 3 diary over two pages (16-22 Jan)
- Two pages square dot note paper
- Week 4 diary over two pages (23 - 29 Jan)
- Two pages square dot note paper
- Calendar overview of February
- and so on for the year!
I am not a very elegant coder and a beginner with tex, so you'll probably find the additions I've made to scripts inefficient. Below are the three different scripts for the elements I'm seeking to combine into one document.
The first script - that makes the week-to-view pages - has a loop at the end which ensures all the dates are correct in the document. I can't tell how to keep this loop working, and also combine in the other elements.
week-to-view diary layout
The following code creates the diary layout I'm seeking - I adapted it from LaTeX calendar layout in Moleskine/Leuchtturm weekly format.
%%%%Script to make an organiser - week-to-view across two pages
documentclass[tikz]{standalone}% Does not support leap years.
pdfpageheight=210mm %%Should make PDF A5
pdfpagewidth=148mm
%% Load needed packages
usepackage{lmodern}
usepackage{tikz}
usetikzlibrary{positioning}
usepackage{ifthen}
%% Create needed conters
newcounter{ThisYear}
newcounter{NewYearsDay}
newcounter{NewYearsWeek}
newcounter{NumberOfWeeksThisYear}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SET VARIABLES HERE %
% Year number you want to generate the calendar for:
setcounter{ThisYear}{2019}
% Which day is the January, 1st? (1 for Monday, 2 for Tuesday, etc.)
setcounter{NewYearsDay}{7}
% Which week does January, 1st belongs to?
% Choose 52 (sometimes 53) or 1. Week 1 is not necessary the week of Jan, 1st; but *it is the week of Jan, 4th.*)
setcounter{NewYearsWeek}{52}
% How many weeks this year? (Choose 52 or 53, appropriately)
setcounter{NumberOfWeeksThisYear}{52}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Let's begin with messy stuff
% If Jan, 1st is not on Week #1...
ifthenelse{value{NewYearsWeek}>51}{
addtocounter{ThisYear}{-1} % start calendar with the last week of the previous year
stepcounter{NumberOfWeeksThisYear} % increase amount of weeks to generate
}{}
% Following counter is the backbone of the calendar generation.
newcounter{NDOYnumber} %% Nth Day Of the Year: 1 for Jan, 1st; 2 for Jan, 2nd; etc.
% Set the first day of the calendar (i.e. Monday of the first generated week)
ifthenelse{value{NewYearsDay}=1}{
% Monday = Jan, 1st
setcounter{NDOYnumber}{1}
}{
% Monday belongs to previous year
setcounter{NDOYnumber}{367}
addtocounter{NDOYnumber}{-value{NewYearsDay}}
}
% Store day's quantieme (1 for Jan, 1st & Feb, 1st, etc.; 17 for Jan, 17th, Feb, 17th, etc.)
newcounter{NDOYquantieme}
% Store day's month number (1 for Jan, 2 for Feb, etc.)
newcounter{NDOYmonthnumber}
% Internal counter
newcounter{tempNDOY}
% Based on `NDOYnumber` value, compute month number and quantieme
newcommand{NDOYtomonthnumber}{%
setcounter{tempNDOY}{value{NDOYnumber}}%
setcounter{NDOYmonthnumber}{1}%
ifthenelse{value{tempNDOY}<32}{% %% JANUARY
setcounter{NDOYquantieme}{value{tempNDOY}}%% Set January quantieme
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% FEBRUARY
ifthenelse{value{tempNDOY}<29}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-28}%
stepcounter{NDOYmonthnumber}% %% MARCH
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% APRIL
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% MAY
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% JUNE
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% JULY
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% AUGUST
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% SEPTEMBER
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% OCTOBER
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% NOVEMBER
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% DECEMBER
setcounter{NDOYquantieme}{value{tempNDOY}}%
}}}}}}}}}}}%
}
% Based on previously computed `NDOYmonthnumber` value, return month name
newcommand{NDOYtomonth}{%
foreach monthnumber/monthname in {1/January, 2/February, 3/March, 4/April, 5/May, 6/June, 7/July, 8/August, 9/September, 10/October, 11/November, 12/December}{%
ifthenelse{value{NDOYmonthnumber}=monthnumber}{monthname}{}%
}
}
% 'Smartly' increase `NDOYnumber` value (i.e. reset to 1 after December, 31st)
newcommand{stepNDOY}{%
ifthenelse{value{NDOYnumber}=365}{%
setcounter{NDOYnumber}{1}%
stepcounter{ThisYear}
}{%
stepcounter{NDOYnumber}%
}%
}
% Defines the `tikzpicture` used to print a week (i.e. calendar page) - 1 page Mon/Tues/Weds
newcommand{printweek}[1]{% argument = value{NDOYnumber}, i.e. Monday's day-of-the-year number
% begin{tikzpicture}[%
%draw [step=0.2cm,dotted, gray] (0,0) grid (7,9);
% end{tikzpicture}%
begin{tikzpicture}[%
inner sep=3 pt,
dayname/.style={%
node font=footnotesize,
},
daynumber/.style={%
anchor=north east,
node font=footnotesize,
},
%xscale = 3,
%yscale=-1.5,% CAUTION: axis direction reversed!
]
NDOYtomonthnumber%(see below)
node (year_number) at (1,10) [anchor = south east, minimum height = 2em] {theThisYear}; %prints year number
node [base right = 1em of year_number, anchor=base west, node font=large] {NDOYtomonth}; %prints month name
%% Monday
NDOYtomonthnumber % compute and store which month and quantieme is this day, based on `NDOYnumber` value
node (monday_number) at (1,9) [daynumber] {theNDOYquantieme}; % prints quantieme
node [base right = 1em of monday_number, anchor=base west] [dayname] {Monday}; % prints day name
stepNDOY % 'smartly' increases `NDOYnumber` value
%% Tuesday
NDOYtomonthnumber
node (tuesday_number) at (1,6) [daynumber] {theNDOYquantieme};
node [base right = 1em of tuesday_number, anchor=base west] [dayname] {Tuesday};
stepNDOY
%% Wednesday
NDOYtomonthnumber
node (wednesday_number) at (1,3) [daynumber] {theNDOYquantieme};
node [base right = 1em of wednesday_number, anchor=base west] [dayname] {Wednesday};
stepNDOY
%% Draw lines
foreach i in {0, 1.2, ..., 7}{%
% draw [dotted, gray, thin] (2,i) -- (4,i); %%non-weekday side lines
draw [gray, thin] (5,i) -- (5,i); %(across,up)
}
%%box at the top
draw (0,9) --(0,10) -- (7,10) -- (7,9); %(across,up)
%%Draw the boxes for days of the week - 3 boxes on one side
draw (0,6) --(0,9) -- (7,9) -- (7,6); %(across,up)
draw (0,3) --(0,6) -- (7,6) -- (7,3); %(across,up)
draw (0,0) --(0,3) -- (7,3) -- (7,0); %(across,up)
%%Line to make do-list for each day
draw (5,0) --(5,9); %(across,up)
%%Line to split weekdays in AM and PM
draw [dotted] (2.5,0)--(2.5,2.5); %(across,up)
draw [dotted] (2.5, 3)--(2.5,5.5); %(across,up)
draw [dotted] (2.5, 6)--(2.5,8.5); %(across,up)
% boxes are 10 lines each (5 lines weekend) - draw in these lines
draw [dotted] (0,6.25) -- (7, 6.25); %(across,up)
draw [dotted] (0,6.50) -- (7, 6.50); %(across,up)
draw [dotted] (0,6.75) -- (7, 6.75); %(across,up)
draw [dotted] (0,7) -- (7, 7); %(across,up)
draw [dotted] (0,7.25) -- (7, 7.25); %(across,up)
draw [dotted] (0,7.50) -- (7, 7.50); %(across,up)
draw [dotted] (0,7.75) -- (7, 7.75); %(across,up)
draw [dotted] (0,8) -- (7, 8); %(across,up)
draw [dotted] (0,8.25) -- (7, 8.25); %(across,up)
draw [dotted] (0,8.50) -- (7, 8.50); %(across,up)
draw [dotted] (0,3.25) -- (7, 3.25); %(across,up)
draw [dotted] (0,3.50) -- (7, 3.50); %(across,up)
draw [dotted] (0,3.75) -- (7, 3.75); %(across,up)
draw [dotted] (0,4) -- (7, 4); %(across,up)
draw [dotted] (0,4.25) -- (7, 4.25); %(across,up)
draw [dotted] (0,4.50) -- (7, 4.50); %(across,up)
draw [dotted] (0,4.75) -- (7, 4.75); %(across,up)
draw [dotted] (0,5) -- (7, 5); %(across,up)
draw [dotted] (0,5.25) -- (7, 5.25); %(across,up)
draw [dotted] (0,5.50) -- (7, 5.50); %(across,up)
draw [dotted] (0,0.25) -- (7, 0.25);
draw [dotted] (0,0.50) -- (7, 0.50);
draw [dotted] (0,0.75) -- (7, 0.75);
draw [dotted] (0,1) -- (7, 1);
draw [dotted] (0,1.25) -- (7, 1.25);
draw [dotted] (0,1.50) -- (7, 1.50);
draw [dotted] (0,1.75) -- (7, 1.75);
draw [dotted] (0,2) -- (7, 2);
draw [dotted] (0,2.25) -- (7, 2.25);
draw [dotted] (0,2.50) -- (7, 2.50);
end{tikzpicture}%
% Defines the `tikzpicture` used to print a week (i.e. calendar page) - 1 page Thurs/Fri/Sat/Sun
begin{tikzpicture}[%
inner sep=3 pt,
dayname/.style={%
node font=footnotesize,
},
daynumber/.style={%
anchor=north east,
node font=normalsizebfseries,
},
%xscale = 3,
%yscale=-1.5,% CAUTION: axis direction reversed!
]
NDOYtomonthnumber%(see below)
node (year_number) at (1,10) [anchor = south east, minimum height = 2em] {theThisYear}; %prints year number
node [base right = 1em of year_number, anchor=base west, node font=large] {NDOYtomonth}; %prints month name
%% Thursday
NDOYtomonthnumber
node (thursday_number) at (1,9) [daynumber] {theNDOYquantieme};
node [base right = 1em of thursday_number, anchor=base west] [dayname] {Thursday};
stepNDOY
%% Friday
NDOYtomonthnumber
node (friday_number) at (1,6) [daynumber] {theNDOYquantieme};
node [base right = 1em of friday_number, anchor=base west] [dayname] {Friday};
stepNDOY
%% Saturday
NDOYtomonthnumber
node (saturday_number) at (1,3) [daynumber] {theNDOYquantieme};
node [base right = 1em of saturday_number, anchor=base west] [dayname] {Saturday};
stepNDOY
%% Sunday
NDOYtomonthnumber
node (sunday_number) at (1,1.5) [daynumber] {theNDOYquantieme};
node [base right = 1em of sunday_number, anchor=base west] [dayname] {Sunday};
stepNDOY
%% Draw lines
foreach i in {0, 1.2, ..., 7}{%
% draw [dotted, gray, thin] (2,i) -- (4,i); %%non-weekday side lines
draw [gray, thin] (5,i) -- (5,i); %(across,up)
}
%%box at the top
draw (0,9) --(0,10) -- (7,10) -- (7,9); %(across,up)
%%Draw the boxes for days of the week - 3 boxes on one side
draw (0,6) --(0,9) -- (7,9) -- (7,6); %(across,up)
draw (0,3) --(0,6) -- (7,6) -- (7,3); %(across,up)
draw (0,1.5) --(0,3) -- (7,3) -- (7,1.5); %(across,up)
draw (0,0) --(0,1.5) -- (7,1.5) -- (7,0); %(across,up)
%%Line to make do-list for each day
draw (5,0) --(5,9); %(across,up)
%%Line to split weekdays in AM and PM
draw [dotted] (2.5, 3)--(2.5,5.5); %(across,up)
draw [dotted] (2.5, 6)--(2.5,8.5); %(across,up)
% boxes are 10 lines each (5 lines weekend) - draw in these lines
draw [dotted] (0,6.25) -- (7, 6.25); %(across,up)
draw [dotted] (0,6.50) -- (7, 6.50); %(across,up)
draw [dotted] (0,6.75) -- (7, 6.75); %(across,up)
draw [dotted] (0,7) -- (7, 7); %(across,up)
draw [dotted] (0,7.25) -- (7, 7.25); %(across,up)
draw [dotted] (0,7.50) -- (7, 7.50); %(across,up)
draw [dotted] (0,7.75) -- (7, 7.75); %(across,up)
draw [dotted] (0,8) -- (7, 8); %(across,up)
draw [dotted] (0,8.25) -- (7, 8.25); %(across,up)
draw [dotted] (0,8.50) -- (7, 8.50); %(across,up)
draw [dotted] (0,3.25) -- (7, 3.25); %(across,up)
draw [dotted] (0,3.50) -- (7, 3.50); %(across,up)
draw [dotted] (0,3.75) -- (7, 3.75); %(across,up)
draw [dotted] (0,4) -- (7, 4); %(across,up)
draw [dotted] (0,4.25) -- (7, 4.25); %(across,up)
draw [dotted] (0,4.50) -- (7, 4.50); %(across,up)
draw [dotted] (0,4.75) -- (7, 4.75); %(across,up)
draw [dotted] (0,5) -- (7, 5); %(across,up)
draw [dotted] (0,5.25) -- (7, 5.25); %(across,up)
draw [dotted] (0,5.50) -- (7, 5.50); %(across,up)
end{tikzpicture}%
}
begin{document}
foreach n in {1,...,value{NumberOfWeeksThisYear}}{%
printweek{value{NDOYnumber}}
}
end{document}
Overview calendar
The calendar overview layout I have working, adapated from http://www.texample.net/tikz/examples/birthday-calendar/. However, how do I get it to the right place in the layout?
Note pages
And to make square dotted note paper, I have
draw [step=0.2cm,dotted, gray] (0,0) grid (7,7);
Any help appreciated - or direction to other posts which cover this issue. It was tricky to know how to search for it.
Thanks,
Lindsey
tikz-pgf tikz-styles calendar tikz-calendar
New contributor
I am trying to create a diary/organiser in TeX/Tikz, but having adjusted code found online I've struggling to combine elements into one document which has the following format:
Calendar overview of month with birthday's marked in, followed by week to view diary over two pages alternated with pages of square dotted note paper
Too ambitious?
So for example, from January the format would be:
- Calendar overview of January
- Two pages square dot note paper
- Week 1 diary over two pages (2-8 Jan)
- Two pages square dot note paper
- Week 2 diary over two pages (9-15 Jan)
- Two pages square dot note paper
- Week 3 diary over two pages (16-22 Jan)
- Two pages square dot note paper
- Week 4 diary over two pages (23 - 29 Jan)
- Two pages square dot note paper
- Calendar overview of February
- and so on for the year!
I am not a very elegant coder and a beginner with tex, so you'll probably find the additions I've made to scripts inefficient. Below are the three different scripts for the elements I'm seeking to combine into one document.
The first script - that makes the week-to-view pages - has a loop at the end which ensures all the dates are correct in the document. I can't tell how to keep this loop working, and also combine in the other elements.
week-to-view diary layout
The following code creates the diary layout I'm seeking - I adapted it from LaTeX calendar layout in Moleskine/Leuchtturm weekly format.
%%%%Script to make an organiser - week-to-view across two pages
documentclass[tikz]{standalone}% Does not support leap years.
pdfpageheight=210mm %%Should make PDF A5
pdfpagewidth=148mm
%% Load needed packages
usepackage{lmodern}
usepackage{tikz}
usetikzlibrary{positioning}
usepackage{ifthen}
%% Create needed conters
newcounter{ThisYear}
newcounter{NewYearsDay}
newcounter{NewYearsWeek}
newcounter{NumberOfWeeksThisYear}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SET VARIABLES HERE %
% Year number you want to generate the calendar for:
setcounter{ThisYear}{2019}
% Which day is the January, 1st? (1 for Monday, 2 for Tuesday, etc.)
setcounter{NewYearsDay}{7}
% Which week does January, 1st belongs to?
% Choose 52 (sometimes 53) or 1. Week 1 is not necessary the week of Jan, 1st; but *it is the week of Jan, 4th.*)
setcounter{NewYearsWeek}{52}
% How many weeks this year? (Choose 52 or 53, appropriately)
setcounter{NumberOfWeeksThisYear}{52}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Let's begin with messy stuff
% If Jan, 1st is not on Week #1...
ifthenelse{value{NewYearsWeek}>51}{
addtocounter{ThisYear}{-1} % start calendar with the last week of the previous year
stepcounter{NumberOfWeeksThisYear} % increase amount of weeks to generate
}{}
% Following counter is the backbone of the calendar generation.
newcounter{NDOYnumber} %% Nth Day Of the Year: 1 for Jan, 1st; 2 for Jan, 2nd; etc.
% Set the first day of the calendar (i.e. Monday of the first generated week)
ifthenelse{value{NewYearsDay}=1}{
% Monday = Jan, 1st
setcounter{NDOYnumber}{1}
}{
% Monday belongs to previous year
setcounter{NDOYnumber}{367}
addtocounter{NDOYnumber}{-value{NewYearsDay}}
}
% Store day's quantieme (1 for Jan, 1st & Feb, 1st, etc.; 17 for Jan, 17th, Feb, 17th, etc.)
newcounter{NDOYquantieme}
% Store day's month number (1 for Jan, 2 for Feb, etc.)
newcounter{NDOYmonthnumber}
% Internal counter
newcounter{tempNDOY}
% Based on `NDOYnumber` value, compute month number and quantieme
newcommand{NDOYtomonthnumber}{%
setcounter{tempNDOY}{value{NDOYnumber}}%
setcounter{NDOYmonthnumber}{1}%
ifthenelse{value{tempNDOY}<32}{% %% JANUARY
setcounter{NDOYquantieme}{value{tempNDOY}}%% Set January quantieme
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% FEBRUARY
ifthenelse{value{tempNDOY}<29}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-28}%
stepcounter{NDOYmonthnumber}% %% MARCH
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% APRIL
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% MAY
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% JUNE
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% JULY
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% AUGUST
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% SEPTEMBER
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% OCTOBER
ifthenelse{value{tempNDOY}<32}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-31}%
stepcounter{NDOYmonthnumber}% %% NOVEMBER
ifthenelse{value{tempNDOY}<31}{%
setcounter{NDOYquantieme}{value{tempNDOY}}%
}{%
addtocounter{tempNDOY}{-30}%
stepcounter{NDOYmonthnumber}% %% DECEMBER
setcounter{NDOYquantieme}{value{tempNDOY}}%
}}}}}}}}}}}%
}
% Based on previously computed `NDOYmonthnumber` value, return month name
newcommand{NDOYtomonth}{%
foreach monthnumber/monthname in {1/January, 2/February, 3/March, 4/April, 5/May, 6/June, 7/July, 8/August, 9/September, 10/October, 11/November, 12/December}{%
ifthenelse{value{NDOYmonthnumber}=monthnumber}{monthname}{}%
}
}
% 'Smartly' increase `NDOYnumber` value (i.e. reset to 1 after December, 31st)
newcommand{stepNDOY}{%
ifthenelse{value{NDOYnumber}=365}{%
setcounter{NDOYnumber}{1}%
stepcounter{ThisYear}
}{%
stepcounter{NDOYnumber}%
}%
}
% Defines the `tikzpicture` used to print a week (i.e. calendar page) - 1 page Mon/Tues/Weds
newcommand{printweek}[1]{% argument = value{NDOYnumber}, i.e. Monday's day-of-the-year number
% begin{tikzpicture}[%
%draw [step=0.2cm,dotted, gray] (0,0) grid (7,9);
% end{tikzpicture}%
begin{tikzpicture}[%
inner sep=3 pt,
dayname/.style={%
node font=footnotesize,
},
daynumber/.style={%
anchor=north east,
node font=footnotesize,
},
%xscale = 3,
%yscale=-1.5,% CAUTION: axis direction reversed!
]
NDOYtomonthnumber%(see below)
node (year_number) at (1,10) [anchor = south east, minimum height = 2em] {theThisYear}; %prints year number
node [base right = 1em of year_number, anchor=base west, node font=large] {NDOYtomonth}; %prints month name
%% Monday
NDOYtomonthnumber % compute and store which month and quantieme is this day, based on `NDOYnumber` value
node (monday_number) at (1,9) [daynumber] {theNDOYquantieme}; % prints quantieme
node [base right = 1em of monday_number, anchor=base west] [dayname] {Monday}; % prints day name
stepNDOY % 'smartly' increases `NDOYnumber` value
%% Tuesday
NDOYtomonthnumber
node (tuesday_number) at (1,6) [daynumber] {theNDOYquantieme};
node [base right = 1em of tuesday_number, anchor=base west] [dayname] {Tuesday};
stepNDOY
%% Wednesday
NDOYtomonthnumber
node (wednesday_number) at (1,3) [daynumber] {theNDOYquantieme};
node [base right = 1em of wednesday_number, anchor=base west] [dayname] {Wednesday};
stepNDOY
%% Draw lines
foreach i in {0, 1.2, ..., 7}{%
% draw [dotted, gray, thin] (2,i) -- (4,i); %%non-weekday side lines
draw [gray, thin] (5,i) -- (5,i); %(across,up)
}
%%box at the top
draw (0,9) --(0,10) -- (7,10) -- (7,9); %(across,up)
%%Draw the boxes for days of the week - 3 boxes on one side
draw (0,6) --(0,9) -- (7,9) -- (7,6); %(across,up)
draw (0,3) --(0,6) -- (7,6) -- (7,3); %(across,up)
draw (0,0) --(0,3) -- (7,3) -- (7,0); %(across,up)
%%Line to make do-list for each day
draw (5,0) --(5,9); %(across,up)
%%Line to split weekdays in AM and PM
draw [dotted] (2.5,0)--(2.5,2.5); %(across,up)
draw [dotted] (2.5, 3)--(2.5,5.5); %(across,up)
draw [dotted] (2.5, 6)--(2.5,8.5); %(across,up)
% boxes are 10 lines each (5 lines weekend) - draw in these lines
draw [dotted] (0,6.25) -- (7, 6.25); %(across,up)
draw [dotted] (0,6.50) -- (7, 6.50); %(across,up)
draw [dotted] (0,6.75) -- (7, 6.75); %(across,up)
draw [dotted] (0,7) -- (7, 7); %(across,up)
draw [dotted] (0,7.25) -- (7, 7.25); %(across,up)
draw [dotted] (0,7.50) -- (7, 7.50); %(across,up)
draw [dotted] (0,7.75) -- (7, 7.75); %(across,up)
draw [dotted] (0,8) -- (7, 8); %(across,up)
draw [dotted] (0,8.25) -- (7, 8.25); %(across,up)
draw [dotted] (0,8.50) -- (7, 8.50); %(across,up)
draw [dotted] (0,3.25) -- (7, 3.25); %(across,up)
draw [dotted] (0,3.50) -- (7, 3.50); %(across,up)
draw [dotted] (0,3.75) -- (7, 3.75); %(across,up)
draw [dotted] (0,4) -- (7, 4); %(across,up)
draw [dotted] (0,4.25) -- (7, 4.25); %(across,up)
draw [dotted] (0,4.50) -- (7, 4.50); %(across,up)
draw [dotted] (0,4.75) -- (7, 4.75); %(across,up)
draw [dotted] (0,5) -- (7, 5); %(across,up)
draw [dotted] (0,5.25) -- (7, 5.25); %(across,up)
draw [dotted] (0,5.50) -- (7, 5.50); %(across,up)
draw [dotted] (0,0.25) -- (7, 0.25);
draw [dotted] (0,0.50) -- (7, 0.50);
draw [dotted] (0,0.75) -- (7, 0.75);
draw [dotted] (0,1) -- (7, 1);
draw [dotted] (0,1.25) -- (7, 1.25);
draw [dotted] (0,1.50) -- (7, 1.50);
draw [dotted] (0,1.75) -- (7, 1.75);
draw [dotted] (0,2) -- (7, 2);
draw [dotted] (0,2.25) -- (7, 2.25);
draw [dotted] (0,2.50) -- (7, 2.50);
end{tikzpicture}%
% Defines the `tikzpicture` used to print a week (i.e. calendar page) - 1 page Thurs/Fri/Sat/Sun
begin{tikzpicture}[%
inner sep=3 pt,
dayname/.style={%
node font=footnotesize,
},
daynumber/.style={%
anchor=north east,
node font=normalsizebfseries,
},
%xscale = 3,
%yscale=-1.5,% CAUTION: axis direction reversed!
]
NDOYtomonthnumber%(see below)
node (year_number) at (1,10) [anchor = south east, minimum height = 2em] {theThisYear}; %prints year number
node [base right = 1em of year_number, anchor=base west, node font=large] {NDOYtomonth}; %prints month name
%% Thursday
NDOYtomonthnumber
node (thursday_number) at (1,9) [daynumber] {theNDOYquantieme};
node [base right = 1em of thursday_number, anchor=base west] [dayname] {Thursday};
stepNDOY
%% Friday
NDOYtomonthnumber
node (friday_number) at (1,6) [daynumber] {theNDOYquantieme};
node [base right = 1em of friday_number, anchor=base west] [dayname] {Friday};
stepNDOY
%% Saturday
NDOYtomonthnumber
node (saturday_number) at (1,3) [daynumber] {theNDOYquantieme};
node [base right = 1em of saturday_number, anchor=base west] [dayname] {Saturday};
stepNDOY
%% Sunday
NDOYtomonthnumber
node (sunday_number) at (1,1.5) [daynumber] {theNDOYquantieme};
node [base right = 1em of sunday_number, anchor=base west] [dayname] {Sunday};
stepNDOY
%% Draw lines
foreach i in {0, 1.2, ..., 7}{%
% draw [dotted, gray, thin] (2,i) -- (4,i); %%non-weekday side lines
draw [gray, thin] (5,i) -- (5,i); %(across,up)
}
%%box at the top
draw (0,9) --(0,10) -- (7,10) -- (7,9); %(across,up)
%%Draw the boxes for days of the week - 3 boxes on one side
draw (0,6) --(0,9) -- (7,9) -- (7,6); %(across,up)
draw (0,3) --(0,6) -- (7,6) -- (7,3); %(across,up)
draw (0,1.5) --(0,3) -- (7,3) -- (7,1.5); %(across,up)
draw (0,0) --(0,1.5) -- (7,1.5) -- (7,0); %(across,up)
%%Line to make do-list for each day
draw (5,0) --(5,9); %(across,up)
%%Line to split weekdays in AM and PM
draw [dotted] (2.5, 3)--(2.5,5.5); %(across,up)
draw [dotted] (2.5, 6)--(2.5,8.5); %(across,up)
% boxes are 10 lines each (5 lines weekend) - draw in these lines
draw [dotted] (0,6.25) -- (7, 6.25); %(across,up)
draw [dotted] (0,6.50) -- (7, 6.50); %(across,up)
draw [dotted] (0,6.75) -- (7, 6.75); %(across,up)
draw [dotted] (0,7) -- (7, 7); %(across,up)
draw [dotted] (0,7.25) -- (7, 7.25); %(across,up)
draw [dotted] (0,7.50) -- (7, 7.50); %(across,up)
draw [dotted] (0,7.75) -- (7, 7.75); %(across,up)
draw [dotted] (0,8) -- (7, 8); %(across,up)
draw [dotted] (0,8.25) -- (7, 8.25); %(across,up)
draw [dotted] (0,8.50) -- (7, 8.50); %(across,up)
draw [dotted] (0,3.25) -- (7, 3.25); %(across,up)
draw [dotted] (0,3.50) -- (7, 3.50); %(across,up)
draw [dotted] (0,3.75) -- (7, 3.75); %(across,up)
draw [dotted] (0,4) -- (7, 4); %(across,up)
draw [dotted] (0,4.25) -- (7, 4.25); %(across,up)
draw [dotted] (0,4.50) -- (7, 4.50); %(across,up)
draw [dotted] (0,4.75) -- (7, 4.75); %(across,up)
draw [dotted] (0,5) -- (7, 5); %(across,up)
draw [dotted] (0,5.25) -- (7, 5.25); %(across,up)
draw [dotted] (0,5.50) -- (7, 5.50); %(across,up)
end{tikzpicture}%
}
begin{document}
foreach n in {1,...,value{NumberOfWeeksThisYear}}{%
printweek{value{NDOYnumber}}
}
end{document}
Overview calendar
The calendar overview layout I have working, adapated from http://www.texample.net/tikz/examples/birthday-calendar/. However, how do I get it to the right place in the layout?
Note pages
And to make square dotted note paper, I have
draw [step=0.2cm,dotted, gray] (0,0) grid (7,7);
Any help appreciated - or direction to other posts which cover this issue. It was tricky to know how to search for it.
Thanks,
Lindsey
tikz-pgf tikz-styles calendar tikz-calendar
tikz-pgf tikz-styles calendar tikz-calendar
New contributor
New contributor
New contributor
asked Nov 21 at 19:15
Lindsey
1
1
New contributor
New contributor
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Lindsey is a new contributor. Be nice, and check out our Code of Conduct.
Lindsey is a new contributor. Be nice, and check out our Code of Conduct.
Lindsey is a new contributor. Be nice, and check out our Code of Conduct.
Lindsey is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461181%2fmaking-tikz-diary-combining-multiple-elements-despite-date-loops%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown