TikZ 日历重命名月份

TikZ 日历重命名月份

我使用 tikz 图片为自己创建了一个自定义日历。我想重命名土耳其

Ocak, \c{S}ubat, Mart, Nisan, May{\i}s, Haziran, Temmuz, A\u{g}ustos, Eyl\"{u}l, Ekim, Kas{\i}m, Aral{\i}k

我可以不是找到存储月份名称的任何地方。因此,我需要你的帮助。这是我的最小工作示例。

\documentclass[10pt]{standalone}

\usepackage{tikz}

\usetikzlibrary{calendar}

\begin{document}

\begin{tikzpicture}
\matrix[column sep=1em, row sep=1em]{
  \calendar (m09) [dates=2018-09-01 to 2018-09-last,week list,month label above centered]; &
  \calendar (m10) [dates=2018-10-01 to 2018-10-last,week list,month label above centered]; &
  \calendar (m11) [dates=2018-11-01 to 2018-11-last,week list,month label above centered]; &
  \calendar (m12) [dates=2018-12-01 to 2018-12-last,week list,month label above centered]; &
  \calendar (m01) [dates=2019-01-01 to 2019-01-last,week list,month label above centered]; &
  \calendar (m02) [dates=2019-02-01 to 2019-02-last,week list,month label above centered]; &
  \calendar (m03) [dates=2019-03-01 to 2019-03-last,week list,month label above centered]; \\
};
\end{tikzpicture}

\end{document} 

答案1

警告:

这是一个不太好的解决方案,不是一个好的解决方案。


calendar库使用\translate命令(来自translator包)来处理月份名称,因此原则上您只需使用translator您的语言选项加载包即可。我无法让它工作...

因此,您可以重新定义\pgfcalendarmonthname以满足您的需要:

\def\pgfcalendarmonthname#1{%
  \ifcase#1\or Ocak\or \c{S}ubat\or Mart\or Nisan\or
  May{\i}s\or Haziran\or Temmuz\or A\u{g}ustos\or
  Eyl\"{u}l\or Ekim\or Kas{\i}m\or Aral{\i}k\fi
}

完整 MWE:

\documentclass[10pt]{standalone}

\usepackage{tikz}

\usetikzlibrary{calendar}

\begin{document}

\def\pgfcalendarmonthname#1{%
  \ifcase#1\or Ocak\or \c{S}ubat\or Mart\or Nisan\or
  May{\i}s\or Haziran\or Temmuz\or A\u{g}ustos\or
  Eyl\"{u}l\or Ekim\or Kas{\i}m\or Aral{\i}k\fi
}

\begin{tikzpicture}[
  every calendar/.style = { week list,month label above centered },
  fullmonth/.style = {
    dates = #1-01 to #1-last
  },
]
\matrix[column sep=1em, row sep=1em]{
  \calendar (m09) [fullmonth = 2018-09]; &
  \calendar (m10) [fullmonth = 2018-10]; &
  \calendar (m11) [fullmonth = 2018-11]; &
  \calendar (m12) [fullmonth = 2018-12]; &
  \calendar (m01) [fullmonth = 2019-01]; &
  \calendar (m02) [fullmonth = 2019-02]; &
  \calendar (m03) [fullmonth = 2019-03]; \\
};
\end{tikzpicture}

\end{document}

如果您希望手动输入月份名称,则可以使用该month text选项来实现相同的结果:

\documentclass[10pt]{standalone}

\usepackage{tikz}

\usetikzlibrary{calendar}

\begin{document}

\begin{tikzpicture}[
  every calendar/.style = { week list,month label above centered },
  fullmonth/.style = {
    dates = #1-01 to #1-last
  },
]
\matrix[column sep=1em, row sep=1em]{
  \calendar (m09) [fullmonth=2018-09, month text = {Eyl\"{u}l}]; &
  \calendar (m10) [fullmonth=2018-10, month text = {Ekim}]; &
  \calendar (m11) [fullmonth=2018-11, month text = {Kas{\i}m}]; &
  \calendar (m12) [fullmonth=2018-12, month text = {Aral{\i}k}]; &
  \calendar (m01) [fullmonth=2019-01, month text = {Ocak}]; &
  \calendar (m02) [fullmonth=2019-02, month text = {\c{S}ubat}]; &
  \calendar (m03) [fullmonth=2019-03, month text = {Mart}]; \\
};
\end{tikzpicture}

\end{document}

相关内容