![西班牙语的 Tikz 日历](https://linux22.com/image/305305/%E8%A5%BF%E7%8F%AD%E7%89%99%E8%AF%AD%E7%9A%84%20Tikz%20%E6%97%A5%E5%8E%86%20.png)
我发现这个例子我正在尝试将模板安排到今年、我的语言和我的国家。我的问题是如何获取西班牙语中的日期和月份。我发现这个问题在 stackexchange 中,我尝试应用所述方式重命名日期和月份,但没有成功。
代码如下:
\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}
编译后,您会得到: