![日历挑战](https://linux22.com/image/362370/%E6%97%A5%E5%8E%86%E6%8C%91%E6%88%98.png)
我认为这符合网站参数。几年来,我为 TUG 制作了日历。最新的是 2018 年的,可以从 [ctan]{https://tug.org/calendar.html} 获取,那里有 a4 和信纸大小的日历。日历每月有两页,一页有插图,另一页有注明特殊节日的日子,还有列出个人约会的空间。今年我被要求提供 LaTeX 源,以便可以修改日历以包括日本和斯堪的纳维亚假期。
我的代码由三个文件组成,一个用于 A4 纸的母版,另一个用于信纸的母版,第三个(每个母版都使用)用于日历图片和月份数据。过去,我刚刚编辑了最后一个文件以用于下一年。
我希望这里有 2 个 MWE 作为 A4 日历的示例。
% calmwe18pa4.tex Calendar for 2018 (a4paper, mwe)
\documentclass[12pt,a4paper]{memoir}
\usepackage{graphicx}
\DeclareGraphicsRule{*}{mps}{*}{}
\usepackage{palatino}
\usepackage{pdfpages}
\usepackage{comment}
\setlrmarginsandblock{0.5in}{*}{1.0}
\setulmarginsandblock{1.0in}{*}{1.0}
\setheadfoot{1pt}{1pt}
\checkandfixthelayout
% various lengths for adjusting the layout
\newlength{\cw} \setlength{\cw}{0.115\textwidth}
\newlength{\ch} \setlength{\ch}{0.145\textheight}
\newcommand*{\cntr}[1]{\multicolumn{1}{c}{\large #1}}
\newcommand*{\txt}[1]{{\footnotesize #1}}
% macros for various image sizes
\newcommand*{\Pic}[1]{%
\clearpage
{\centering
\includegraphics[height=0.88\textheight,keepaspectratio]{#1}
\par}}
\newcommand*{\PicW}[1]{%
\clearpage
{\centering
\includegraphics[width=\textwidth,keepaspectratio]{#1}
\par}}
\newcommand*{\Picw}[1]{%
\clearpage
{\centering
\includegraphics[width=0.2\textwidth,keepaspectratio]{#1}
\par}}
\newcommand*{\pic}[1]{%
\includegraphics[height=0.2\textheight,keepaspectratio]{#1}}
\newcommand*{\picw}[1]{%
\includegraphics[height=0.15\textheight,keepaspectratio]{#1}}
\pagestyle{empty}
\begin{document}
\input{calmwe18pics}
\end{document}
这是第二次 MWE。
% calmwe18pics.tex Calendar pics for mwe 2018
\newcommand*{\info}[2]{%
\vspace{\onelineskip}%
{
#1\ (Original size #2) \par}}
%%% COVER PAGE
\newcommand*{\covpic}[1]{%
\includegraphics[height=0.35\textheight,keepaspectratio]{#1}}
\renewcommand*{\covpic}[1]{%
\includegraphics[width=0.35\textwidth,keepaspectratio]{#1}}
\mbox{} \\
%\covpic{1225-bible-eng} \hfill \covpic{1450-hours-fr}
\covpic{example-image} \hfill \covpic{example-image}
\vfill
\begin{center} \bfseries
{\LARGE Manuscripts 1225 --- 1800 \\[0.8in]}
\HUGE 2018
\end{center}
\vfill
%\covpic{1586-diary-eng} \hfill \covpic{19c-delail-indian}
\covpic{example-image} \hfill \covpic{example-image}
\mbox{}
\newcommand*{\sep}{\hfill / \hfill}
\clearpage
%%% JANUARY illustration and calendar
%\Pic{1225-bible-eng}
%\Pic{example-image}
\clearpage
{\centering
\includegraphics[height=0.88\textheight,width=\textwidth]{example-image}
\par}
\info{Leaf from an English theologian's bible with two column Latin text in a protogothic hand,
on vellum, 1225,
providing an index to Biblical subjects. Versals in red and blue.}{207 by 255mm}
\clearpage
{\HUGE JANUARY \hfill 2018}
\vspace{2\onelineskip}
\begin{tabular}{|p{\cw}|p{\cw}|p{\cw}|p{\cw}|p{\cw}||p{\cw}|p{\cw}|}% hline
\cntr{Mon} & \cntr{Tue} & \cntr{Wed} & \cntr{Thu} & \cntr{Fri} & \cntr{Sat} & \cntr{Sun} \\ \hline
1 \txt{New Year's Day} & 2 & 3 & 4 & 5 & 6 & 7 \\[\ch] \hline
8 & 9 & 10 & 11 & 12 & 13 & 14 \\[\ch] \hline
15 \txt{MLK Day (USA)} & 16 & 17 & 18 & 19 & 20 & 21 \\[\ch] \hline
22 & 23 & 24 & 25 & 26 & 27 & 28 \\[\ch] \hline
29 & 30 & 31 & & & & \\[\ch]
\hline
\end{tabular}
\clearpage
%%% FEBRUARY illustration and calendar
%\Pic{1250-bible-fr}
\clearpage
{\centering
\includegraphics[height=0.88\textheight,width=\textwidth]{example-image}
\par}
\info{Leaf from a French Bible 1250. Latin text in two columns of 49 lines each in a tiny
bookhand (equivalent to about 5.5pt in modern terms) on vellum.
Black Early Gothic script with some red and blue rubrication.
There is some even smaller handwritten text (commentary/notes?) in brown ink.}{100 by 148mm}
{\HUGE FEBRUARY \hfill 2018}
\vspace{2\onelineskip}
\begin{tabular}{|p{\cw}|p{\cw}|p{\cw}|p{\cw}|p{\cw}||p{\cw}|p{\cw}|}% \hline
\cntr{Mon} & \cntr{Tue} & \cntr{Wed} & \cntr{Thu} & \cntr{Fri} & \cntr{Sat} & \cntr{Sun} \\ \hline
& & & 1 & 2 & 3 & 4 \\[\ch] \hline
5 & 6 & 7 & 8 & 9 & 10 & 11 \\[\ch] \hline
12 & 13 & 14 & 15 & 16 & 17 & 18 \\[\ch] \hline
19 \txt{Presidents' Day (USA)} & 20 & 21 & 22 & 23 & 24 & 25 \\[\ch] \hline
26 & 27 & 28 & & & & \\[\ch] \hline
%29 & & & & & & \\[\ch]
\hline
\end{tabular}
\clearpage
%%%% etc etc etc
\clearpage
\renewcommand*{\pic}[1]{%
\includegraphics[width=0.2\textwidth,height=0.2\textheight]{#1}}
\newcommand*{\picex}{%
\pic{example-image}}
\begin{center}
\begin{comment}
\begin{tabular}{cccc}
\picex & \pic{1250-bible-fr} & \pic{1260-homily-italy} & \pic{1445-hours-fr} \\
\pic{1450-hours-fr} & \pic{14c-hours-fr} & \pic{1472-psalter-fr} & \pic{1520-hours-fl} \\
\picw{1586-diary-eng} & \pic{1690-delail-arabic} & \pic{17c-koran-indian} & \pic{19c-delail-indian} % \picw{1800-gita-kashmir}
\end{tabular}
\end{comment}
\begin{tabular}{cccc}
\picex & \picex & \picex & \picex \\
\picex & \picex & \picex & \picex \\
\picex & \picex & \picex & \picex \\
\end{tabular}
\end{center}
%\mbox{}
\vfill
%\begin{adjustwidth}{2in}{2in}
\setlength{\parindent}{2em}
\flushleftright
The original leaves are from the Herries collection. They were scanned and then
magnified or shrunk to fit the available space. Peter Wilson's \LaTeX\ memoir class was
used to typeset the calendar.
\vfill
\begin{center}
The Herries Press, Kenilworth, 2017 \\[0.5\onelineskip]
%\includegraphics[scale=0.6]{anvil.15}
\includegraphics[scale=0.15]{example-image}
\end{center}
\endinput
我查看了 CTAN,看是否有任何类别/包可以提供类似的东西,但据我所知,他们只关心列出日期,而没有机会添加任何内容。
我不会改变我的工作方式,但想知道是否有人认为创建一个类/包是值得的,如果是的话,是否有人愿意尝试并将成功的结果提交给 CTAN 以供一般使用?
彼得·W.
答案1
仅回答两个问题中的第一个:
有一些方法,可能不在 CTAN 上,但在谷歌上搜索“latex calendar github”可以找到其中一些。例如https://github.com/profound-labs/wallcalendar,我以此为基础进行了自己的设计(其中只涉及日期的 LaTeX,其余部分则涉及 scribus)。这比你的更“花哨”,但你说过你无论如何都不会换……