使用葡萄牙语的 Tikz 日历作为教学大纲

使用葡萄牙语的 Tikz 日历作为教学大纲

我一直在尝试使用这个问题回答在页面之间和葡萄牙语中显示日历的问题,但运气不佳。例如,当我尝试显示大于一页的日历时,它只是截断,而不是将其分散到各个页面上。此外,我在文档中找不到任何将日期和月份重命名为我的母语(葡萄牙语-br)的方法,也找不到任何设置可以做到这一点。

其他网站上提供的一些代码如下巴西网站tikz 文档奇怪的是,pdf 第 28 节第 323 页无法在我的 mac os lion 上运行的 Latex TextMate 版本上进行编译。

简而言之,我正在寻找的是:

  1. 将其翻译成葡萄牙语的方法
  2. 能够发送超过一页的时间长度。事实上,我正在寻找的时间长度已经显示在我当前拥有的代码上,并且为澄清起见,还附上了生成的 pdf。

我的 tex 文件可以直接编译成 pdf,并显示上述问题这里

\documentclass[a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[brazilian]{babel}
\usepackage[T1]{fontenc}

\usepackage{lscape}
\usepackage{longtable}
\usepackage{multicol}
\usepackage{tikz}
\usetikzlibrary{calendar}

\newcounter{lecture}
\setcounter{lecture}{1}

\newcommand{\scheme}[4]{% Lecture Name, Aim, Objectives, Activities
\expandafter\gdef\csname lecture \arabic{lecture}\endcsname{#1}%
\arabic{lecture}. \stepcounter{lecture} & \raggedright #1 & Aim: #2

Objectives:
#3
&
#4
\\
\hline
}

\newcounter{topic}
\renewcommand{\thetopic}{\Roman{topic}}
\setcounter{topic}{0}

\newcommand{\topic}[1]{%
\multicolumn{4}{l}{\stepcounter{topic}
\rule{0pt}{20pt} \Large \textbf{Topic \thetopic: #1}} 
\\* \multicolumn{4}{l}{\parbox{0pt}{\vspace*{12pt}\hspace*{-\tabcolsep}\rule{\fullwidth}{.5pt}}} \\*
}

\newcounter{excursion}
\renewcommand{\theexcursion}{\Alph{excursion}}
\setcounter{excursion}{0}

\newcommand{\excursion}[1]{%
\multicolumn{4}{l}{\stepcounter{excursion}
\rule{0pt}{20pt} \Large \textbf{Excursion \theexcursion: #1}} 
\\* \multicolumn{4}{l}{\parbox{0pt}{\vspace*{12pt}\hspace*{-\tabcolsep}\rule{\fullwidth}{.5pt}}} \\*
}

\newenvironment{objectives}{%
By the end of this lecture a student should be able to:
\enumerate}{\endenumerate}

\pagestyle{empty}

\setlength{\hoffset}{.5\textwidth}
\setlength{\textwidth}{19cm}
\addtolength{\hoffset}{-.5\textwidth}
\setlength{\voffset}{.5\textheight}
\setlength{\textheight}{27cm}
\addtolength{\voffset}{-.5\textheight}

\newlength{\fischeme}
\newlength{\sescheme}
\newlength{\thscheme}
\newlength{\foscheme}
\newlength{\fullwidth}

\addtolength{\textwidth}{-15pt}
\addtolength{\textheight}{-15pt}

\setlength{\fischeme}{.075\textheight}
\setlength{\sescheme}{.125\textheight}
\setlength{\thscheme}{.4\textheight}
\setlength{\foscheme}{.35\textheight}

\setlength{\fullwidth}{\fischeme}
\addtolength{\fullwidth}{\sescheme}
\addtolength{\fullwidth}{\thscheme}
\addtolength{\fullwidth}{\foscheme}

\addtolength{\fischeme}{-2\tabcolsep}
\addtolength{\sescheme}{-2\tabcolsep}
\addtolength{\thscheme}{-2\tabcolsep}
\addtolength{\foscheme}{-2\tabcolsep}

\addtolength{\textwidth}{15pt}
\addtolength{\textheight}{15pt}

\begin{document}
\begin{landscape}

\begin{center}
{\Huge MA3402 Analysis on Manifolds}
\end{center}

\vfill

\begin{longtable}{|p{\fischeme}|p{\sescheme}|p{\thscheme}|p{\foscheme}|}
\hline
Lecture Number & Lecture Name & Aims and Objectives & Activities,
Material, Refs \endhead
\hline \endfoot
\hline

\topic{Manifolds}

\scheme{%
Calculus Review
}{%
To recall the key concepts of calculus.
}{%
\begin{objectives}
\item List the main definitions and results of calculus
\item Understand the key role of approximation in the application of
analysis
\end{objectives}
}{%
\begin{enumerate}
\item Recall quiz
\item Vote for the ``Most Valuable Theorem''
\item How close is close enough?
\end{enumerate}
}

\excursion{Lie Groups}

\scheme{%
Lie Groups
}{%
To introduce basic Lie groups
}{%
\begin{objectives}
\item Prove that multiplication and inverse are smooth maps on
  \(Gl_n\).
\item Prove the same for \(O_n\).
\item Know the definition of a principal bundle (for \(Gl_n\) and
  \(O_n\)).
\item Know how to construct associated fibre bundles.
\end{objectives}
}{%
}

\hline\hline

\scheme{%
Problem Session
}{%
To go through the fifth problem sheet.
}{%
}{%
Fifth problem sheet
}


\topic{Differentiation}

\scheme{%
Differentiation on Manifolds
}{%
To explore the different types of differentiation that are possible.
}{%
\begin{objectives}
\item Define the Lie bracket of vector fields in terms of flow.
\item Define the Lie derivative of tensors.
\end{objectives}
}{%
\begin{enumerate}
\item Differentiation as change under infinitesimal perturbation.
\end{enumerate}
}


\end{longtable}
\end{landscape}

%\setcounter{lecture}{0}

\tikz [every day/.style={anchor=east}]
\calendar [dates=2013-07-10 to 2014-14-01, day list downward, month label above left,day text={\%w. \%d=}]
%if (Monday) {\draw (-0.29,0) circle (8pt);} Circulo para provas
if (Sunday) [black!50,nodes={draw=none}] %Cinza para dias sem aula
if (Monday,Tuesday) [red]
if (Monday,Tuesday) {\node[anchor=west] at (.5,0) {\stepcounter{lecture}Aula \arabic{lecture} \csname lecture \arabic{lecture}\endcsname};};

\end{document}

我很感激任何关于如何解决这个问题的帮助,目前没有很多以 .tex 文件形式出现的课程表模板。更不用说它很容易翻译了。如果最终用我自己的母语写出 12 个月和 7 天,我也不介意作为一种解决方案,只要能用 1 天和 1 个月的例子来解释如何做到这一点。

希望问题不要太具体。谢谢。

答案1

作为一个只会说英式英语的无知人士,我并不熟悉 中的语言选项LaTeX及其软件包。但是,该类beamer随软件包一起提供translator,并且tikz日历库确实在幕后使用了它。手册(非常简短地)在“日期和日历实用程序宏”一节中PGF提到了该软件包。translator

除了不理解LaTeX语言选项之外,我对该软件包或日历库也不是很熟悉translator。但是通过“瞎折腾”,我似乎找到了一些几乎可以正常工作的东西,它们可能有用,也可能没用。

令人恼火的是,我无法让它与brazilian语言选项一起工作,但我可以通过指定来让它工作portuguese。对任何误译表示歉意。

\documentclass{standalone}

\usepackage[portuguese]{babel}

\usepackage{tikz}

\usetikzlibrary{calendar}

\usepackage[portuguese]{translator}

\deftranslation[to=portuguese]{January}{Janeiro}
\deftranslation[to=portuguese]{February}{Fevereir}
\deftranslation[to=portuguese]{March}{Mar\c co}
\deftranslation[to=portuguese]{April}{Abril}
\deftranslation[to=portuguese]{May}{Maio}
\deftranslation[to=portuguese]{June}{Junho}
\deftranslation[to=portuguese]{July}{Julho}
\deftranslation[to=portuguese]{August}{Agosto}
\deftranslation[to=portuguese]{September}{Setembro}
\deftranslation[to=portuguese]{October}{Outubro}
\deftranslation[to=portuguese]{November}{Novembro}
\deftranslation[to=portuguese]{December}{Dezembro}

\deftranslation[to=portuguese]{Mon}{2\textsuperscript{a}}
\deftranslation[to=portuguese]{Tue}{3\textsuperscript{a}}
\deftranslation[to=portuguese]{Wed}{4\textsuperscript{a}}
\deftranslation[to=portuguese]{Thu}{5\textsuperscript{a}}
\deftranslation[to=portuguese]{Fri}{6\textsuperscript{a}}
\deftranslation[to=portuguese]{Sat}{Sab}
\deftranslation[to=portuguese]{Sun}{Dom}

\newcounter{lecture}
\setcounter{lecture}{1}

\begin{document}

\tikz[every day/.style={anchor=east}]
\calendar [dates=2013-11-1 to 2013-11-14,day list downward, month label above left,day text={\%w. \%d=}]
if (Sunday) [black!50,nodes={draw=none}] %Cinza para dias sem aula
if (Monday,Tuesday) [red]
if (Monday,Tuesday) {\node[anchor=west] at (.5,0) 
  {\stepcounter{lecture}Aula \arabic{lecture} \csname lecture \arabic{lecture}\endcsname};};

\end{document}

在此处输入图片描述

关于将日历拆分到多个页面:由于日历位于一个方框内,tikzpicture并被放入文档中TeX,因此目前无法拆分到多个页面。因此,必须手动拆分日历并将其放在每个页面上。

不过,它可以在一定程度上实现自动化,尽管有点粗糙。下面,每周都是一张单独的图片。

\documentclass{article}
\usepackage[margin=1in]{geometry}

\usepackage{tikz}

\usetikzlibrary{calendar}

\newcounter{lecture}
\setcounter{lecture}{1}
\newcount\julianstartday

\begin{document}

\pgfcalendardatetojulian{2013-11-4}{\julianstartday}

\foreach \week in {1,...,7}{
  \pgfcalendarjuliantodate{\julianstartday}{\y}{\m}{\d}
  \global\advance\julianstartday by 7
  %
  \tikz[every day/.style={anchor=base east},
   every month/.style={xshift=-1.5cm, anchor=base east},
   % Always do the month code get the bounding box of the picture
   % right, but only show the text on the first of the week.
   month code={%
     \node[every month]{\ifdate{Monday}{\tikzmonthtext}{\phantom\tikzmonthtext}};
   },
   execute at begin day scope={%
     \pgftransformyshift{\pgfcalendarcurrentweekday*-1cm+1cm}%
     \tikzmonthcode
   }
 ]
  \calendar [dates=\y-\m-\d to \y-\m-\d+6,day text={\%w. \%d=}]
    if (Sunday) [black!50,nodes={draw=none}] %Cinza para dias sem aula
    if (Monday,Tuesday) [red]
    if (Monday,Tuesday) {\node[anchor=base west] at (.5,0) 
      {\stepcounter{lecture}Aula \arabic{lecture} \csname lecture \arabic{lecture}\endcsname};};
  \vskip0.5cm
}
\end{document}

回应评论:在计算中是否可以有一个“非”规则或逻辑“与”规则\ifdate,以便以特定方式排版日期仅有的如果其中一条规则为真?

答案是“有点”。默认情况下if (Monday,Tuesday),如果任何一个 Monday为真或Tuesday为真(即逻辑“或”)。

这并没有多大帮助。

然而我们可以建立一个and not holiday规则,假设它是条件中的最后一条规则它会完成这项工作。下面我整理了一些内部宏,并提供了一个方便的\pgfcalendardeclareholiday宏。请注意,这Guy Fawkes一天在英国实际上并不是假期,它只是一个与日历中的讲座相对应的真实日期。

\documentclass{standalone}

\usepackage[portuguese]{babel}

\usepackage{tikz}

\usetikzlibrary{calendar}

\usepackage[portuguese]{translator}

\deftranslation[to=portuguese]{January}{Janeiro}
\deftranslation[to=portuguese]{February}{Fevereir}
\deftranslation[to=portuguese]{March}{Mar\c co}
\deftranslation[to=portuguese]{April}{Abril}
\deftranslation[to=portuguese]{May}{Maio}
\deftranslation[to=portuguese]{June}{Junho}
\deftranslation[to=portuguese]{July}{Julho}
\deftranslation[to=portuguese]{August}{Agosto}
\deftranslation[to=portuguese]{September}{Setembro}
\deftranslation[to=portuguese]{October}{Outubro}
\deftranslation[to=portuguese]{November}{Novembro}
\deftranslation[to=portuguese]{December}{Dezembro}

\deftranslation[to=portuguese]{Mon}{2\textsuperscript{a}}
\deftranslation[to=portuguese]{Tue}{3\textsuperscript{a}}
\deftranslation[to=portuguese]{Wed}{4\textsuperscript{a}}
\deftranslation[to=portuguese]{Thu}{5\textsuperscript{a}}
\deftranslation[to=portuguese]{Fri}{6\textsuperscript{a}}
\deftranslation[to=portuguese]{Sat}{Sab}
\deftranslation[to=portuguese]{Sun}{Dom}


\newcounter{lecture}
\setcounter{lecture}{1}
\newcount\julianstartday

\makeatletter

% Macro to declare a holiday
\def\pgfcalendardeclareholiday#1#2{%
    \pgfutil@namedef{pgf@calendar@holiday@#1@}{#2}%
}

\pgfkeys{/pgf/calendar/holiday/.code={%
  \edef\date{\pgfcalendarifdateyear-\pgfcalendarifdatemonth-\pgfcalendarifdateday}%
    \pgfutil@ifundefined{pgf@calendar@holiday@\date @}{%
        \let\pgfcalendarholidayname=\pgfutil@empty%
    }{%
      % If the internal holiday macro has been defined indicate a match
      \expandafter\let\expandafter\pgfcalendarholidayname\expandafter=\csname pgf@calendar@holiday@\date @\endcsname%
      \pgfcalendarmatchestrue%
    }%
}}

\pgfkeys{/pgf/calendar/and not holiday/.code={%
  \edef\date{\pgfcalendarifdateyear-\pgfcalendarifdatemonth-\pgfcalendarifdateday}%
    \pgfutil@ifundefined{pgf@calendar@holiday@\date @}{%
      % If the internal holiday macro has been defined *and* 
      % previous tests have returned true return true
      \ifpgfcalendarmatches%
            \pgfcalendarmatchestrue%
        \else%
          \pgfcalendarmatchesfalse%
        \fi%
        \let\pgfcalendarholidayname=\pgfutil@empty%
    }{%
      \expandafter\let\expandafter\pgfcalendarholidayname\expandafter=\csname pgf@calendar@holiday@\date @\endcsname%
      \pgfcalendarmatchesfalse%
    }%
}}



\begin{document}

\pgfcalendardeclareholiday{2013-11-02}{Finados}
\pgfcalendardeclareholiday{2013-11-15}{Proclama\c c\~ ao da Rep\'blica}

\pgfcalendardeclareholiday{2013-11-05}{Guy Fawkes}% <- not a real holiday



\pgfcalendardatetojulian{2013-10-28}{\julianstartday}

\begin{minipage}{4in}
\foreach \week in {1,...,3}{
  \pgfcalendarjuliantodate{\julianstartday}{\y}{\m}{\d}
  \global\advance\julianstartday by 7
  %
  \tikz[every day/.style={anchor=base east},
   every month/.style={xshift=-1.5cm, anchor=base east},
   % Always do the month code get the bounding box of the picture
   % right, but only show the text on the first of the week
   month code={%
     \node[every month]{\ifdate{Monday,day of month=1}{\tikzmonthtext}{\phantom\tikzmonthtext}};
   },
   execute at begin day scope={%
     \pgftransformyshift{\pgfcalendarcurrentweekday*-1cm+1cm}%
     \tikzmonthcode
   }
 ]
  \calendar [dates=\y-\m-\d to \y-\m-\d+6,day text={\%w. \%d=}]
    if (Sunday) [black!50,nodes={draw=none}] %Cinza para dias sem aula
    if (Monday,Tuesday) [red]
    if (holiday) [blue]
    if (holiday) {\node [anchor=base west, blue] at (.5,0) {\pgfcalendarholidayname};}
    if (Monday,Tuesday, and not holiday) {\node[anchor=base west] at (.5,0) 
      {\stepcounter{lecture}Aula \arabic{lecture} \csname lecture \arabic{lecture}\endcsname};};
  \vskip0.5cm
}
\end{minipage}
\end{document}

在此处输入图片描述

答案2

虽然这不是对你问题的直接回答,但该termcal软件包提供了一个非常简单易用的日历,专为课程大纲而设计,非常容易本地化。实际上只有三个命令需要重新定义:一个用于月份名称的缩写,一个用于序数的格式,一个用于月份和数字的排序。以下是来自链接问题翻译成葡萄牙语。

\documentclass{article}
\usepackage{fixltx2e}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{termcal}

% Beginning of translation code
\makeatletter
% redefine the month abbreviations (these can be full names if you prefer)
\renewcommand\monthname{\ifcase\c@month\or jan\or fev\or mar\or abr%
        \or mai\or jun\or jul\or ago\or sep\or out%
        \or nov\or dez\fi}
% redefine the printing of the date
% for Portuguese, this is either just the number itself, or
% \the\c@date\textsuperscript{o} depending on if you want an ordinal marker
% other languages might require a more complex redefinition
\renewcommand\ordinaldate{\the\c@date}
% redefine how a date that is the first in a new month is printed
% This would normally be redefined however you like anyway
\renewcommand{\calprintdate}{%
    \ifnewmonth\framebox{\ordinaldate~de~\monthname}%
    \else \ordinaldate\fi
  }
\makeatother
% End of translation code

% Few useful commands (our classes always meet either on Monday and Wednesday 
% or on Tuesday and Thursday)

\newcommand{\MWClass}{%
\calday[segunda-feira]{\classday} % Monday
\skipday % Tuesday (no class)
\calday[quarta-feira]{\classday} % Wednesday
\skipday % Thursday (no class)
\skipday % Friday 
\skipday\skipday % weekend (no class)
}

\newcommand{\TRClass}{%
\skipday % Monday (no class)
\calday[terça-feira]{\classday} % Tuesday
\skipday % Wednesday (no class)
\calday[quinta-feira]{\classday} % Thursday
\skipday % Friday 
\skipday\skipday % weekend (no class)
}

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

\begin{document}

\paragraph*{Tentative Schedule:}
\begin{calendar}{1/11/2010}{16} % Semester starts on 1/11/2010 and last for 16
                    % weeks, including finals week
\setlength{\calboxdepth}{.3in}
\TRClass
% schedule
\caltexton{1}{1.1, 1.2 Review}
\caltextnext{1.3, 1.4 Review}
\caltextnext{2.1, 2.2 Linear Equations}
% ... and so on

% Holidays
\Holiday{1/18/2010}{Martin Luther King Day}
\Holiday{3/8/2010}{Spring Break}
% ... and so on

\options{4/26/2010}{\noclassday} % finals week
\options{4/27/2010}{\noclassday} % finals week
\options{4/28/2010}{\noclassday} % finals week
\options{4/29/2010}{\noclassday} % finals week
\options{4/30/2010}{\noclassday} % finals week
\caltext{4/27/2010}{\textbf{Final Exam}}
\end{calendar}
\end{document}

代码输出

相关内容