4

I've found this example and I'm trying to arrange the template to this year, my language and my country. My question is how can I get the days and months in Spanish. I've found this question in stackexchange, and and I've tried to apply the manner stated to rename the days and months, without success.

The code is:

\documentclass[landscape,a4paper,spanish,10pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage{tikz}           
\usepackage[spanish]{translator}    

\deftranslation[to=spanish]{January}{Enero}
\deftranslation[to=spanish]{February}{Febrero}
\deftranslation[to=spanish]{March}{Marzo}
\deftranslation[to=spanish]{April}{Abril}
\deftranslation[to=spanish]{May}{Mayo}
\deftranslation[to=spanish]{June}{Junio}
\deftranslation[to=spanish]{July}{Julio}
\deftranslation[to=spanish]{August}{Agosto}
\deftranslation[to=spanish]{September}{Septiembre}
\deftranslation[to=spanish]{October}{Octubre}
\deftranslation[to=spanish]{November}{Noviembre}
\deftranslation[to=spanish]{December}{Diciembre}
\deftranslation[to=spanish]{Mon}{Lun}
\deftranslation[to=spanish]{Tue}{Mar}
\deftranslation[to=spanish]{Wed}{Mié}
\deftranslation[to=spanish]{Thu}{Jue}
\deftranslation[to=spanish]{Fri}{Vie}
\deftranslation[to=spanish]{Sat}{Sab}
\deftranslation[to=spanish]{Sun}{Dom}
\usepackage{fancyhdr}       
\usepackage{fix-cm}     
\usepackage[landscape, headheight = 2cm, margin=.5cm,top = 3.2cm, nofoot]{geometry}
\usetikzlibrary{calc}
\usetikzlibrary{calendar}
\renewcommand*\familydefault{\sfdefault}
\def\year{2015}
\def\termin#1#2{
\node [anchor=north west, text width= 3.4cm] at
($(cal-#1.north west)+(3em, 0em)$) {\tiny{#2}};
}
\renewcommand{\headrulewidth}{0.0pt}
\setlength{\headheight}{10ex}
\chead{
\fontsize{60}{70}\selectfont\textbf{\year}
\Large\textbf{Calendario}\hfill
}
\cfoot{\footnotesize\texttt{http://www.texample.net/}}

\begin{document}
\pagestyle{fancy}
\begin{center}
\begin{tikzpicture}[every day/.style={anchor = north}]
\calendar[
dates=\year-01-01 to \year-06-30,%primera hoja, desde Enero a Junio
name=cal,
day yshift = 3em,
day code=
{
\node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
minimum height= .53cm, text width = 4.4cm, draw = gray]{\tikzdaytext};
\draw (-1.8cm, -.1ex) node[anchor = west]{\footnotesize%
  \pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}};
},
execute before day scope=
{
\ifdate{day of month=1}
{
  \pgftransformxshift{4.8cm}
  % Print month name
  \draw (0,0)node [shape=rectangle, minimum height= .53cm,
    text width = 4.4cm, fill = red, text= white, draw = red, text centered]
    {\textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth}}};
}{}
\ifdate{workday}
{
  \tikzset{every day/.style={fill=white}}
  \ifdate{between=2014-12-24 and 2015-03-06}{%
    \tikzset{every day/.style={fill=gray!30}}}{}
}{}
\ifdate{Saturday}{\tikzset{every day/.style={fill=red!10}}}{}
\ifdate{Sunday}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=01-01}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=05-01}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=05-21}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=2015-04-03}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=2015-04-04}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=2015-06-29}{\tikzset{every day/.style={fill=red!20}}}{}
},
 execute at begin day scope=
 {
\pgftransformyshift{-.53*\pgfcalendarcurrentday cm}
 }
];
\termin{\year-01-01}{Año Nuevo}
\termin{2015-04-03}{Viernes Santo}
\termin{2015-04-04}{Sábado Santo}
\termin{2015-04-05}{Domingo de Resurrección}
\termin{\year-05-01}{Día del Trabajo}
\termin{\year-05-21}{Combate Naval de Iquique}
\termin{2015-06-29}{San Pedro y San Pablo}
\end{tikzpicture}
\pagebreak
\begin{tikzpicture}[every day/.style={anchor = north}]
\calendar[
dates=\year-07-01 to \year-12-31,
name=cal,
day yshift = 3em,
day code=
{
\node[name=\pgfcalendarsuggestedname,every day,shape=rectangle,
  minimum height= .53cm, text width = 4.4cm, draw = gray]{\tikzdaytext};
\draw (-1.8cm, -.1ex) node[anchor = west]
{
  \footnotesize\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}
};
},
execute before day scope=
{
\ifdate{day of month=1} {
\pgftransformxshift{4.8cm}
\draw (0,0)node [shape=rectangle, minimum height= .53cm,
  text width = 4.4cm, fill = red, text= white, draw = red, text centered]
{
  \textbf{\pgfcalendarmonthname{\pgfcalendarcurrentmonth}}
 };
}{}
\ifdate{workday}
{
\tikzset{every day/.style={fill=white}}
\ifdate{between=2015-07-13 and 2015-07-26}{%
  \tikzset{every day/.style={fill=gray!30}}}{}
}{}
\ifdate{Saturday}{\tikzset{every day/.style={fill=red!10}}}{}
\ifdate{Sunday}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=09-18}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=09-19}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=10-12}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=09-18}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=09-19}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=10-12}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=07-16}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=08-15}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=10-31}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=11-01}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=12-08}{\tikzset{every day/.style={fill=red!20}}}{}
\ifdate{equals=12-25}{\tikzset{every day/.style={fill=red!20}}}{}
},
execute at begin day scope=
{
\pgftransformyshift{-.53*\pgfcalendarcurrentday cm}
}
];
\termin{\year-07-16}{Nuestra Señora del Carmen}
\termin{\year-08-15}{Asunción de la Virgen}
\termin{\year-09-18}{Fiestas Patrias}
\termin{\year-09-19}{Día del Ejército}
\termin{2015-10-12}{Encuentro de dos Mundos}
\termin{\year-10-31}{Día de las Iglesias Evangélicas}
\termin{\year-11-01}{Día de Todos los Santos}
\termin{\year-12-08}{Inmaculada Concepción}
\termin{\year-12-25}{Navidad del Señor}
\end{tikzpicture}
\end{center}

\end{document} 

and when compiling, you get:

enter image description here

  • 1
    It works fine for me if I change \usepackage[latin1]{inputenc} to \usepackage[utf8]{inputenc} – erik Feb 09 '15 at 23:58
  • No errors at compile time, only two warnings concerning the fancyhdr package. When using utf8, the following error is obtained: Package inputenc Error: Unicode char \X not set up for use with LaTeX, where "X" is any word with diacritical sign or tilde (ñ). When using latin1, this problem doesn't occur. – G. Contreras Feb 10 '15 at 03:01
  • It works fine for me, both with latin1 and utf8 encodings. – karlkoeller Feb 10 '15 at 08:11
  • 1
    So the first thing to do is update all your packages. – John Kormylo Feb 10 '15 at 17:02
  • After updating the packages, the language problem was solved, without using the \deftranslation. Thanks, John. – G. Contreras Feb 10 '15 at 21:48

0 Answers0