如何实现日历自动化

如何实现日历自动化

我有这个带有 tikz 的日历,我想让它更新到实际日期,而无需手动执行。这是日历

\documentclass[10pt]{article} % Can also use 11pt for a larger overall font size

\usepackage{tikz}
\usetikzlibrary{calendar,shapes.misc}
\begin{document}
\begin{tikzpicture}
  \calendar
  [
    dates=2022-11-01 to 2022-11-last,
    week list,inner sep=2pt,month label above centered,
    month text=\%mt \%y0
  ]
  if (at most=2022-11-30) [nodes={strike out,draw}]
  if (weekend)            [black!50,nodes={draw=none}]
  ;
\end{tikzpicture}
\end{document}

答案1

改编

  • pgfcalendar定义\year\month\day表示当前年、月、日,可以使用

结果

在此处输入图片描述

代码

\documentclass[10pt]{article} % Can also use 11pt for a larger overall font size

\usepackage{tikz}
\usetikzlibrary{calendar,shapes.misc}

\begin{document}

\begin{tikzpicture}
  \calendar
  [
    dates=\year-\month-01 to \year-\month-last,
    week list,inner sep=2pt,month label above centered,
    month text=\%mt \%y0
  ]
  if (at most=\year-\month-\day) [nodes={strike out,draw}]
  if (weekend)            [black!50,nodes={draw=none}]
  ;
\end{tikzpicture}

\end{document}

相关内容