Termcal 在表格边框上打印计算出的天数

Termcal 在表格边框上打印计算出的天数

termcal 包在两个或更多\calday条目的情况下工作正常。但是,如果有六个\skipday条目,则计算出的天数位于表边框上。以下是问题的快照:

在此处输入图片描述

该示例由以下代码生成:

\documentclass[a4]{article}
\usepackage{termcal}

\newcommand{\TRClass}{%
\skipday % Tuesday
\skipday % Tuesday
\skipday % Wednesday (no class)
\calday[Thursday]{\classday} % Thursday
\skipday % Friday 
\skipday\skipday % weekend (no class)
}

\newcommand{\Holiday}[2]{%
\options{#1}{\noclassday}
\caltext{#1}{#2}
}

\begin{document}
\paragraph*{Lab Tentative Schedule for Electric Circuit Analysis:}
\begin{center}
\begin{calendar}{8/18/2014}{2} % Semester starts on 1/11/2010 and last for 16
                    % weeks, including finals week
\setlength{\calboxdepth}{.3in}
\TRClass
% schedule
\caltexton{1}{Lab briefing}
\caltextnext{2.2 Charge, Current, Voltage, and Power\\
2.3 Voltage and Current Sources\\
2.4 Ohm's Law}

\end{calendar}
\end{center}
\end{document}

任何关于这个问题的帮助都非常受欢迎。

奥利弗·福斯特

答案1

\ca@doaday文件中的定义中有一个虚假空格termcal.sty。您必须添加一个%类似

\renewcommand\ca@doaday[1]{% %%<--- spurious space

完整代码:

\documentclass[a4paper]{article}    %% a4 doesn't work here
\usepackage{termcal}

\makeatletter
\renewcommand\ca@doaday[1]{% %%<--- spurious space
   \hspace*{-1em}\hbox{\vrule depth \calboxdepth height 0pt width 0pt\vtop{%  note \hspace* in the begining
                                           %% Adjust as needed.
   #1%                                 %options specified by |\calday|
   \csname\curdate options\endcsname%  % options specified by date
   \ifclassday\csname C\theclassnum options\endcsname\fi%   by classnumber
   \hbox to \hsize{\calprintdate\hfill\ifclassday\calprintclass\fi}%
   \vspace{2pt}
      \begingroup
        \let\\=\ca@normbs
        \raggedright
        \sloppy
        \the\weeklytext\par
        \csname\curdate text\endcsname
        \ifclassday\csname C\theclassnum text\endcsname
                   \stepcounter{classnum}\fi
      \endgroup
   }}%
    \global\newmonthfalse
    \advancedate%
}%
\makeatother

\newcommand{\TRClass}{%
\skipday % Tuesday
\skipday % Tuesday
\skipday % Wednesday (no class)
\calday[Thursday]{\classday} % Thursday
\skipday % Friday
\skipday\skipday % weekend (no class)
}

\newcommand{\Holiday}[2]{%
\options{#1}{\noclassday}%
\caltext{#1}{#2}%
}%

\begin{document}
\paragraph*{Lab Tentative Schedule for Electric Circuit Analysis:}
\begin{center}
\begin{calendar}{8/18/2014}{2} % Semester starts on 1/11/2010 and last for 16
                    % weeks, including finals week
\setlength{\calboxdepth}{0.3in}
\TRClass
% schedule
\caltexton{1}{Lab briefing}%
\caltextnext{2.2 Charge, Current, Voltage, and Power\\
2.3 Voltage and Current Sources\\
2.4 Ohm's Law}
\end{calendar}
\end{center}
\end{document}

在此处输入图片描述

答案2

代码中有三处地方可以发现虚假空格。删除它们可以解决问题,并且\hspace接受答案中的否定不是必需的。这是一个没有否定的解决方案。(我还调整了大小以\calboxdepth适合您的三行。

\makeatletter
\renewcommand\ca@doaday[1]{% <--- Spurious space removed here
\hbox{\vrule depth \calboxdepth height 0pt width 0pt\vtop{%  
   #1%                                 %options specified by |\calday|
   \csname\curdate options\endcsname%  % options specified by date
   \ifclassday\csname C\theclassnum options\endcsname\fi%   by classnumber
   \hbox to \hsize{\calprintdate\hfill\ifclassday\calprintclass\fi}%
   \vspace{2pt}
      \begingroup
        \let\\=\ca@normbs
        \raggedright
        \sloppy
        \the\weeklytext\par
        \csname\curdate text\endcsname%
        \ifclassday\csname C\theclassnum text\endcsname
                   \stepcounter{classnum}\fi
      \endgroup
   }}%
    \global\newmonthfalse
    \advancedate%
}%
\renewcommand\advancedate{\stepcounter{date}% <--- Spurious space removed here
    \ifnum\thedate>\monthlength\relax
       \addtocounter{date}{-\monthlength}\advancemonth\fi}

\renewcommand\advancemonth{%
   \global\newmonthtrue\stepcounter{month}% <-- another spurious space
   \ifnum\c@month>12
      \stepcounter{year}\setleap\setcounter{month}1\fi}
\makeatother%


\newcommand{\TRClass}{%
\skipday % Tuesday
\skipday % Tuesday
\skipday % Wednesday (no class)
\calday[Thursday]{\classday} % Thursday
\skipday % Friday 
\skipday\skipday % weekend (no class)
}

\newcommand{\Holiday}[2]{%
\options{#1}{\noclassday}
\caltext{#1}{#2}
}

\begin{document}
\paragraph*{Lab Tentative Schedule for Electric Circuit Analysis:}
\begin{center}
\begin{calendar}{8/18/2014}{2} % Semester starts on 1/11/2010 and last for 16
                    % weeks, including finals week
\setlength{\calboxdepth}{.6in}
\TRClass
% schedule
\caltexton{1}{Lab briefing}
\caltextnext{2.2 Charge, Current, Voltage, and Power\\
2.3 Voltage and Current Sources\\
2.4 Ohm's Law}

\end{calendar}
\end{center}
\end{document}

代码输出

相关内容