![Tikz 日历字体大小问题](https://linux22.com/image/382217/Tikz%20%E6%97%A5%E5%8E%86%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F%E9%97%AE%E9%A2%98.png)
我调整了日历如下:为 TUG 制作日历变成我自己的版本。但我无法以“巨大”文本格式获取带有月相的日期(mcal.sty 中的变量“lunas”)。感谢您的帮助。
主要.tex:
\documentclass[border=4.9mm, multi={tikzpicture}]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
% MCAL -------------------------------
\usepackage{mcal}
% MCAL -------------------------------
\begin{document}\estilodetexto% To set up \sffamily, \bfseries etc.
\thisyear{2019}% The year the calendar is about.
\colorofHolidays{red}% The color of holidays.
\colorofWeekend{gray}% The color of weekend days.
\remaincolor{white}% The color under the top rectangle (where the title and the previous and next calendar are)
\resubcolor{white}% The color under the names of the week
\mooncounter=-1% To set the first moon of the year (0=Right Moon,1=Full Moon,2=Left Moon,-1=New Moon)
\januari[6,14,21,27]{1}% moon dates (see: https://www.timeanddate.com/moon/phases/) and holiday dates for this month
\februari[4,12,19,26]{}
\maart[6,14,21,28]{}
\april[5,12,19,27]{21,22}
\mei[5,12,18,26]{1,30}
\juni[3,10,17,25]{9,10}
\juli[2,9,16,25]{21}
\augustus[1,7,15,23,30]{15}
\september[6,14,22,28]{}
\oktober[5,13,21,28]{}
\november[4,12,19,26]{1,11}
\december[4,12,19,26]{25}
\end{document}
mcal.sty:
\RequirePackage{tikz}
\usetikzlibrary{calc,calendar}
\RequirePackage{xcolor}
\def\estilodetexto{\sffamily\bfseries\LARGE}
\pgfmathtruncatemacro{\Year}{2019}%
\pgfmathtruncatemacro{\monthcounter}{12}% December
\pgfmathtruncatemacro{\oldYear}{\Year-1}%
\pgfmathtruncatemacro{\newYear}{\Year+1}%
\def\colorofHolidays{red}
\def\colorofWeekend{gray}
\def\maincolor{white}
\def\subcolor{white}
\def\remaincolor#1{%
\let\maincolor\relax%
\def\maincolor{#1}%
}
\def\resubcolor#1{%
\let\subcolor\relax%
\def\subcolor{#1}%
}
\def\colorofHolidays#1{%
\let\colorHolidays\relax%
\def\colorHolidays{#1}%
}
\def\colorofWeekend#1{%
\let\colorWeekend\relax%
\def\colorWeekend{#1}%
}
\def\thisyear#1{%
\let\Year\relax%
\pgfmathtruncatemacro{\Year}{#1}%
}
\RequirePackage{etoolbox}
\RequirePackage{mathabx}
\newcommand*{\listadefestivos}[1]{%
\def\festivos{}%
\foreach \f in {#1} {%
\xappto\festivos{if (day of month = \f) [\colorHolidays]}}%
}
\newcount\mooncounter
\def\moonreset{\global\mooncounter=-1\relax}
\moonreset
\def\moon{%
\global\advance\mooncounter by 1\relax%
\ifcase\mooncounter $\newmoon$%
\or $\rightmoon$%
\or $\fullmoon$%
\or $\leftmoon$\global\mooncounter=-1\relax%
\fi%
}
\newcommand*{\listadelunas}[1]{%
\def\lunas{}%
\foreach \l in {#1} {%
\xappto\lunas{if (day of month = \l) [day text=\noexpand\moon\%d-]}
}%
}
\makeatletter%
\tikzoption{day headings}{\tikzstyle{day heading}=[#1]}
\tikzstyle{day heading}=[]
\tikzstyle{day letter headings}=[
execute before day scope={ \ifdate{day of month=1}{%
\pgfmathsetlength{\pgf@ya}{\tikz@lib@cal@yshift}%
\pgfmathsetlength\pgf@xa{\tikz@lib@cal@xshift}%
\pgftransformyshift{-\pgf@ya}
\foreach \d/\l in {0/M,1/D,2/W,3/D,4/V,5/Z,6/Z}{
\pgf@xa=\d\pgf@xa%
\pgftransformxshift{\pgf@xa}%
\pgftransformyshift{\pgf@ya}%
\node[every day,day heading]{\estilodetexto\normalsize\l};%
}
}{}%
}%
]
\makeatother
\pagestyle{empty}
\def\Month{%
\ifnum\monthcounter=1%
Januari\else
\ifnum\monthcounter=2%
Februari\else
\ifnum\monthcounter=3%
Maart\else
\ifnum\monthcounter=4%
April\else
\ifnum\monthcounter=5%
Mei\else
\ifnum\monthcounter=6%
Juni\else
\ifnum\monthcounter=7%
Juli\else
\ifnum\monthcounter=8%
Augustus\else
\ifnum\monthcounter=9%
September\else
\ifnum\monthcounter=10%
Oktober\else
\ifnum\monthcounter=11%
November\else
\ifnum\monthcounter=12%
December%
\fi%
\fi%
\fi%
\fi%
\fi%
\fi%
\fi%
\fi%
\fi%
\fi%
\fi%
\fi%
}
\def\findemes{\ifnum\monthcounter=12%
\pgfmathtruncatemacro{\monthcounter}{1} \else%
\pgfmathtruncatemacro{\monthcounter}{\monthcounter+1}%
\fi%
}
\def\nuevapagina{\findemes%
%\newpage%
}
\newcommand\mes[2][]{
\begin{tikzpicture}%
% Cuadricula
\draw[fill opacity=1,fill=\maincolor] (0,20) rectangle (28,16);%
\draw[fill opacity=1,fill=\subcolor] (0,15) rectangle (28,16);%
\draw[xstep=4cm, ystep=2.5cm] (0,0) grid (28,15);%
\draw[xstep=4cm, ystep=1cm] (0,15) grid (28,16);%
\draw (0,20) rectangle (28,16);%
\foreach \dia/\posicion in {Maandag/2,Dinsdag/6,Woensdag/10,Donderdag/14,Vrijdag/18,Zaterdag/22,Zondag/26}{%
\node (\dia) at (\posicion,15.5) {\dia};%
}%
% Calendario mes anterior
\node (titulocalanterior) at (2.75,19.5) {\Month};%
\calendar (calanterior) [dates=\Year-\monthcounter-01 to \Year-\monthcounter-last,%
day xshift=1em,%
day yshift = 1em-1ex,%
day text=\normalsize \%d-,%
week list,%
day letter headings] at (1.2,18.7);%
\findemes%
% CALENDARIO PRINCIPAL
\listadelunas{#1}%
\listadefestivos{#2}%
\calendar[dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
week list,%
day xshift = 4cm,%
day yshift = 2.5cm,%
day text=\Huge \%d-,%
if = {(Saturday) [\colorWeekend]},%
if = {(Sunday) [\colorWeekend]},%
] at (2.7,13.4) \festivos \lunas;%
\node[scale=2] (Mtitle) at (14,18) {\Huge \Month{} \Year};%
\findemes%
% Calendario mes siguiente
\node (titulocalsiguiente) at (25.05,19.5) {\Month};%
\calendar (calsiguiente) [dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
day xshift=1em,%
day yshift = 1em-1ex,%
day text=\normalsize \%d-,%
week list,%
day letter headings] at (23.5,18.7);%
\end{tikzpicture}
\nuevapagina
}
\newcommand\januari[2][]{
\begin{tikzpicture}%
% CuadrÃÂÂÂcula
\draw[fill opacity=1,fill=\maincolor] (0,20) rectangle (28,16);%
\draw[fill opacity=1,fill=\subcolor] (0,15) rectangle (28,16);%
\draw[xstep=4cm, ystep=2.5cm] (0,0) grid (28,15);%
\draw[xstep=4cm, ystep=1cm] (0,15) grid (28,16);%
\draw (0,20) rectangle (28,16);%
\foreach \dia/\posicion in {Maandag/2,Dinsdag/6,Woensdag/10,Donderdag/14,Vrijdag/18,Zaterdag/22,Zondag/26}{%
\node (\dia) at (\posicion,15.5) {\dia};%
}%
% Calendario mes anterior
\node (titulocalanterior) at (2.75,19.5) {\Month};%
\calendar (calanterior) [dates=\oldYear-12-01 to \oldYear-12-last,%
day xshift=1em,%
day yshift = 1em-1ex,%
day text=\normalsize \%d-,%
week list,%
day letter headings] at (1.2,18.7);%
\findemes%
% CALENDARIO PRINCIPAL
\listadelunas{#1}%
\listadefestivos{#2}%
\calendar[dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
week list,%
day xshift = 4cm,%
day yshift = 2.5cm,%
day text=\Huge \%d-,%
if = {(Saturday) [\colorWeekend]},%
if = {(Sunday) [\colorWeekend]},%
] at (2.7,13.4) \festivos \lunas;%
\node[scale=2] (Mtitle) at (14,18) {\Huge \Month{} \Year};%
\findemes%
% Calendario mes siguiente
\node (titulocalsiguiente) at (25.05,19.5) {\Month};%
\calendar (calsiguiente) [dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
day xshift=1em,%
day yshift = 1em-1ex,%
day text=\normalsize \%d-,%
week list,%
day letter headings] at (23.5,18.7);%
\end{tikzpicture}
\nuevapagina
}
\let\februari\mes%
\let\maart\mes%
\let\april\mes%
\let\mei\mes%
\let\juni\mes%
\let\juli\mes%
\let\augustus\mes%
\let\september\mes%
\let\oktober\mes%
\let\november\mes%
\newcommand\december[2][]{
\begin{tikzpicture}%
% Cuadricula
\draw[fill opacity=1,fill=\maincolor] (0,20) rectangle (28,16);%
\draw[fill opacity=1,fill=\subcolor] (0,15) rectangle (28,16);%
\draw[xstep=4cm, ystep=2.5cm] (0,0) grid (28,15);%
\draw[xstep=4cm, ystep=1cm] (0,15) grid (28,16);%
\draw (0,20) rectangle (28,16);%
\foreach \dia/\posicion in {Maandag/2,Dinsdag/6,Woensdag/10,Donderdag/14,Vrijdag/18,Zaterdag/22,Zondag/26}{%
\node (\dia) at (\posicion,15.5) {\dia};%
}%
% Calendario mes anterior
\node (titulocalanterior) at (2.75,19.5) {\Month};%
\calendar (calanterior) [dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
day xshift=1em,%
day yshift = 1em-1ex,%
day text=\normalsize \%d-,%
week list,%
day letter headings] at (1.2,18.7);%
\findemes%
% CALENDARIO PRINCIPAL
\listadelunas{#1}%
\listadefestivos{#2}%
\calendar[dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
week list,%
day xshift = 4cm,%
day yshift = 2.5cm,%
day text=\Huge \%d-,%
if = {(Saturday) [\colorWeekend]},%
if = {(Sunday) [\colorWeekend]},%
] at (2.7,13.4) \festivos \lunas;%
\node[scale=2] (Mtitle) at (14,18) {\Huge \Month{} \Year};%
\findemes%
% Calendario mes siguiente
\node (titulocalsiguiente) at (25.05,19.5) {\Month};%
\calendar (calsiguiente) [dates=\newYear-\monthcounter-1 to \newYear-\monthcounter-last,%
day xshift=1em,%
day yshift = 1em-1ex,%
day text=\normalsize \%d-,%
week list,%
day letter headings] at (23.5,18.7);%
\end{tikzpicture}
\nuevapagina
}
答案1
尝试更改此部分的代码mcal.sty
:
\def\moon{%
\global\advance\mooncounter by 1\relax%
\ifcase\mooncounter $\newmoon$%
\or $\rightmoon$%
\or $\fullmoon$%
\or $\leftmoon$\global\mooncounter=-1\relax%
\fi%
}
更改为以下内容:
\def\moon{%
\global\advance\mooncounter by 1\relax%
\ifcase\mooncounter \Huge $\newmoon$% <- Add `\Huge'
\or \Huge $\rightmoon$% <- Add `\Huge'
\or \Huge $\fullmoon$% <- Add `\Huge'
\or \Huge $\leftmoon$\global\mooncounter=-1\relax% <- Add `\Huge'
\fi%
}