我想在日历上标记对我来说很重要的日子,例如生日、满月。是否可以将其设置为不同的颜色、用圆圈突出显示或绘制月亮图标?
\documentclass{article}
\usepackage{cmap} % поиск в PDF
\usepackage[T2A]{fontenc} % кодировка
%\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc} % кодировка исходного текста
\usepackage[english,russian]{babel} % локализация и переносы
\usepackage{caption}
\usepackage[left=2.5cm, right=1.5cm, top=2.5cm, bottom=2.5cm]{geometry} % Отступы
% Folding + calendar example from the PGF manual.
%
% Author: Till Tantau
\usepackage{tikz}
\usetikzlibrary{calendar,folding}
\begin{document}
\sffamily\scriptsize
\begin{tikzpicture}[transform shape,
every calendar/.style={
at={(-8ex,4ex)},
week list,
month label above centered,
month text=\bfseries\textcolor{red}{\%mt} \%y0,
if={(Sunday, Saturday) [black!50]}
}]
\tikzfoldingdodecahedron[
folding line length=2.5cm,
face 1={ \calendar [month text=\textcolor{red}{Январь} \textbf{\the\year},
dates=\the\year-01-01 to \the\year-01-last];},
face 2={ \calendar [month text=\textcolor{red}{Февраль} \textbf{\the\year},
dates=\the\year-02-01 to \the\year-02-last];},
face 3={ \calendar [month text=\textcolor{red}{Март} \textbf{\the\year},
dates=\the\year-03-01 to \the\year-03-last];},
face 4={ \calendar [month text=\textcolor{red}{Апрель} \textbf{\the\year},
dates=\the\year-04-01 to \the\year-04-last];},
face 5={ \calendar [month text=\textcolor{red}{Май} \textbf{\the\year},
dates=\the\year-05-01 to \the\year-05-last];},
face 6={ \calendar [month text=\textcolor{red}{Июнь} \textbf{\the\year},
dates=\the\year-06-01 to \the\year-06-last];},
face 7={ \calendar [month text=\textcolor{red}{Июль} \textbf{\the\year},
dates=\the\year-07-01 to \the\year-07-last];},
face 8={ \calendar [month text=\textcolor{red}{Август} \textbf{\the\year},
dates=\the\year-08-01 to \the\year-08-last];},
face 9={ \calendar [month text=\textcolor{red}{Сентябрь} \textbf{\the\year},
dates=\the\year-09-01 to \the\year-09-last];},
face 10={\calendar [month text=\textcolor{red}{Октябрь} \textbf{\the\year},
dates=\the\year-10-01 to \the\year-10-last];},
face 11={\calendar [month text=\textcolor{red}{Ноябрь} \textbf{\the\year},
dates=\the\year-11-01 to \the\year-11-last];},
face 12={\calendar [month text=\textcolor{red}{Декабрь} \textbf{\the\year},
dates=\the\year-12-01 to \the\year-12-last];}
];
\end{tikzpicture}
\end{document}
答案1
您可以使用if (equals=yyyy-mm-dd)
您可以TikZ 手册在第 589 页。这可以添加到月历规范中。
以 12 月为例,显示文本颜色、圆圈和图像:
face 12={\calendar [month text=\textcolor{red}{Декабрь} \textbf{\the\year},
dates=\the\year-12-01 to \the\year-12-last]
if (equals=2022-12-14) [blue]
if (equals=2022-12-19) {\draw[xshift=-6.5pt,yshift=2pt] (0,0) circle (5pt);}
if (equals=2022-12-07) {\node[xshift=-4pt,yshift=4pt]{\includegraphics[width=20pt]{moon}};}
;}
结果:
请注意,xshift
和yshift
用于手动定位圆圈和图像。TikZ 手册还通过重新定位日历本身提供了一种更自动化的方法,但是大多数日期的班次都是相同的,所以我认为这并不难。
要用图像(而不是覆盖)替换日期数字,您可以设置day code
特定日期:
if (equals=2022-12-07) [day code={\node[xshift=-4pt,yshift=4pt]{\includegraphics[width=20pt]{moon}};}]