LaTeX forum ⇒ Page LayoutLandscape gives two pages in the calendar, why? Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
olemariendal
Posts: 2
Joined: Fri Jun 27, 2014 5:56 pm

Landscape gives two pages in the calendar, why?

Postby olemariendal » Fri Jun 27, 2014 6:24 pm

Hi,

I have a problem, I fund this latex script, but I only want from July to December. That's also fine, but I still get the first page. I think is something with landscape to do, how can I solve this. Thanks :)

  1. \documentclass[a4paper,10pt]{scrartcl}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[english]{babel}
  4. \usepackage[T1]{fontenc}
  5. \usepackage[landscape,headheight = 2cm, margin=.5cm, top = 3.2cm, nofoot]{geometry}
  6.  
  7. \usepackage{tikz}
  8. \usetikzlibrary{calc,calendar}
  9. \renewcommand*\familydefault{\sfdefault}
  10.  
  11. \usepackage{fancyhdr} % header and footer
  12. \usepackage{fix-cm} % Large year in header
  13.  
  14.  
  15. % User defined
  16. \def\year{2014}
  17. % Names of Holidays are inserted by employing this macro
  18. \def\termin#1#2{
  19. \node [anchor=north west, text width= 3.4cm] at
  20. ($(cal-#1.north west)+(4em, 0em)$) {\tiny{#2}};
  21. }
  22.  
  23. %Events
  24. \def\event#1#2{
  25. \node [anchor=north west, text width= 3.4cm] at
  26. ($(cal-#1.north west)+(4em, 0em)$) {\textbf{#2}};
  27. }
  28.  
  29. %Header
  30. \renewcommand{\headrulewidth}{0.0pt}
  31. \setlength{\headheight}{10ex}
  32. \chead{
  33. \fontsize{60}{70}\selectfont\textbf{\year}
  34. \Large\textbf{Event calender}\hfill
  35. }
  36. %Footer
  37. \cfoot{\footnotesize\texttt{Footer}}
  38. \begin{document}
  39. \pagestyle{fancy}
  40. \begin{center}
  41. \begin{tikzpicture}[every day/.style={anchor = north}]
  42. \calendar[dates=\year-07-01 to \year-12-31,
  43. name=cal,
  44. day yshift = 3em,
  45. day code=
  46. {
  47. \node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
  48. minimum height= .53cm, text width = 4.4cm, draw = gray]{\tikzdaytext};
  49. \draw (-1.8cm, -.1ex) node[anchor = west]
  50. {
  51. \footnotesize\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}
  52. };
  53. },
  54. execute before day scope=
  55. {
  56. \ifdate{day of month=1} {
  57. % Shift right
  58. \pgftransformxshift{4.8cm}
  59. % Print month name
  60. \draw (0,0)node [shape=rectangle, minimum height= .53cm,
  61. text width = 4.4cm, fill = red, text= white, draw = red, text centered]
  62. {
  63. \textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth}}
  64. };
  65. }{}
  66. \ifdate{workday}
  67. {
  68. \tikzset{every day/.style={fill=white}}
  69. % Vacation (Germany Baden-Wuerrtemberg)
  70. \ifdate{between=2014-07-25 and 2013-09-07}{%
  71. \tikzset{every day/.style={fill=gray!30}}}{}
  72. \ifdate{between=2014-10-28 and 2013-10-30}{%
  73. \tikzset{every day/.style={fill=gray!30}}}{}
  74. }{}
  75. % Saturdays and half holidays (Christma's and New year's eve)
  76. \ifdate{Saturday}{\tikzset{every day/.style={fill=red!10}}}{}
  77. \ifdate{equals=12-24}{\tikzset{every day/.style={fill=red!10}}}{}
  78. \ifdate{equals=12-31}{\tikzset{every day/.style={fill=red!10}}}{}
  79. % Sundays and full holidays
  80. \ifdate{Sunday}{\tikzset{every day/.style={fill=red!20}}}{}
  81. \ifdate{equals=11-01}{\tikzset{every day/.style={fill=red!20}}}{}
  82. \ifdate{equals=12-25}{\tikzset{every day/.style={fill=red!20}}}{}
  83. \ifdate{equals=12-26}{\tikzset{every day/.style={fill=red!20}}}{}
  84. % Christian holidays
  85. },
  86. execute at begin day scope=
  87. {
  88. % Each day is shifted down according to the day of month
  89. \pgftransformyshift{-.53*\pgfcalendarcurrentday cm}
  90. }
  91. ];
  92. % Holidaynames
  93. \termin{\year-11-01}{All Saints' Day}
  94. \termin{\year-12-24}{Christmas Eve}
  95. \termin{\year-12-25}{Christmas Day}
  96. \termin{\year-12-26}{Day After Christmas day}
  97. \termin{\year-12-31}{New Year's Eve}
  98.  
  99. % Events
  100. \event{2014-10-25}{Event 1}
  101. \event{2014-09-20}{Event 2}
  102. \event{2014-09-05}{Event 3}
  103. \event{2014-11-07}{Event 4}
  104. \event{2014-10-03}{Event 5}
  105. \event{2014-12-01}{Event 6}
  106. \event{2014-12-06}{Event 7}
  107.  
  108.  
  109.  
  110. \end{tikzpicture}
  111. \end{center}
  112.  
  113. \end{document}
Last edited by cgnieder on Sat Jun 28, 2014 10:30 pm, edited 1 time in total.
Reason: changed code markup from inline to block

Tags:

olemariendal
Posts: 2
Joined: Fri Jun 27, 2014 5:56 pm

Postby olemariendal » Fri Jun 27, 2014 7:26 pm

I solved it be my self, I just removed center.

My solution.
  1. \documentclass[a4paper,10pt]{scrartcl}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[english]{babel}
  4. \usepackage[T1]{fontenc}
  5. \usepackage[landscape,headheight = 2cm, margin=.5cm, top = 3.2cm, nofoot]{geometry}
  6.  
  7. \usepackage{tikz}
  8. \usetikzlibrary{calc,calendar}
  9. \renewcommand*\familydefault{\sfdefault}
  10.  
  11. \usepackage{fancyhdr} % header and footer
  12. \usepackage{fix-cm} % Large year in header
  13.  
  14.  
  15. % User defined
  16. \def\year{2014}
  17. % Names of Holidays are inserted by employing this macro
  18. \def\termin#1#2{
  19. \node [anchor=north west, text width= 3.4cm] at
  20. ($(cal-#1.north west)+(4em, 0em)$) {\tiny{#2}};
  21. }
  22.  
  23. %Events
  24. \def\event#1#2{
  25. \node [anchor=north west, text width= 3.4cm] at
  26. ($(cal-#1.north west)+(4em, 0em)$) {\textbf{#2}};
  27. }
  28.  
  29. %Header
  30. \renewcommand{\headrulewidth}{0.0pt}
  31. \setlength{\headheight}{10ex}
  32. \chead{
  33. \fontsize{60}{70}\selectfont\textbf{\year}
  34. \Large\textbf{Event calender}\hfill
  35. }
  36. %Footer
  37. \cfoot{\footnotesize\texttt{Footer}}
  38. \begin{document}
  39.  
  40. \pagestyle{fancy}
  41. %\begin{center}
  42. \begin{tikzpicture}[every day/.style={anchor = north}]
  43. \calendar[dates=\year-07-01 to \year-12-31,
  44. name=cal,
  45. day yshift = 3em,
  46. day code=
  47. {
  48. \node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
  49. minimum height= .53cm, text width = 4.4cm, draw = gray]{\tikzdaytext};
  50. \draw (-1.8cm, -.1ex) node[anchor = west]
  51. {
  52. \footnotesize\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}
  53. };
  54. },
  55. execute before day scope=
  56. {
  57. \ifdate{day of month=1} {
  58. % Shift right
  59. \pgftransformxshift{4.8cm}
  60. % Print month name
  61. \draw (0,0)node [shape=rectangle, minimum height= .53cm,
  62. text width = 4.4cm, fill = red, text= white, draw = red, text centered]
  63. {
  64. \textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth}}
  65. };
  66. }{}
  67. \ifdate{workday}
  68. {
  69. \tikzset{every day/.style={fill=white}}
  70. % Vacation (Germany Baden-Wuerrtemberg)
  71. \ifdate{between=2014-07-25 and 2013-09-07}{%
  72. \tikzset{every day/.style={fill=gray!30}}}{}
  73. \ifdate{between=2014-10-28 and 2013-10-30}{%
  74. \tikzset{every day/.style={fill=gray!30}}}{}
  75. }{}
  76. % Saturdays and half holidays (Christma's and New year's eve)
  77. \ifdate{Saturday}{\tikzset{every day/.style={fill=red!10}}}{}
  78. \ifdate{equals=12-24}{\tikzset{every day/.style={fill=red!10}}}{}
  79. \ifdate{equals=12-31}{\tikzset{every day/.style={fill=red!10}}}{}
  80. % Sundays and full holidays
  81. \ifdate{Sunday}{\tikzset{every day/.style={fill=red!20}}}{}
  82. \ifdate{equals=11-01}{\tikzset{every day/.style={fill=red!20}}}{}
  83. \ifdate{equals=12-25}{\tikzset{every day/.style={fill=red!20}}}{}
  84. \ifdate{equals=12-26}{\tikzset{every day/.style={fill=red!20}}}{}
  85. % Christian holidays
  86. },
  87. execute at begin day scope=
  88. {
  89. % Each day is shifted down according to the day of month
  90. \pgftransformyshift{-.53*\pgfcalendarcurrentday cm}
  91. }
  92. ];
  93. % Holidaynames
  94. \termin{\year-11-01}{All Saints' Day}
  95. \termin{\year-12-24}{Christmas Eve}
  96. \termin{\year-12-25}{Christmas Day}
  97. \termin{\year-12-26}{Day After Christmas day}
  98. \termin{\year-12-31}{New Year's Eve}
  99.  
  100. % Events
  101. \event{2014-10-25}{Event 1}
  102. \event{2014-09-20}{Event 2}
  103. \event{2014-09-05}{Event 3}
  104. \event{2014-11-07}{Event 4}
  105. \event{2014-10-03}{Event 5}
  106. \event{2014-12-01}{Event 6}
  107. \event{2014-12-06}{Event 7}
  108.  
  109.  
  110.  
  111. \end{tikzpicture}
  112. %\end{center}
  113.  
  114. \end{document}
Last edited by cgnieder on Sat Jun 28, 2014 10:31 pm, edited 1 time in total.
Reason: changed code markup from inline to block


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 1 guest