From 67c7246d76c71b0a37485565aa8a917e606caf20 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 6 Dec 2017 23:53:14 +0000 Subject: mensa-tex (7dec17) git-svn-id: svn://tug.org/texlive/trunk@45997 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/mensa-tex/README.md | 4 +- .../doc/latex/mensa-tex/doc/cafe-logo.png | Bin 0 -> 5651 bytes .../doc/latex/mensa-tex/doc/mensa-tex-doc.pdf | Bin 0 -> 155375 bytes .../doc/latex/mensa-tex/doc/mensa-tex-doc.tex | 561 +++++++++++++++++++++ .../doc/latex/mensa-tex/doc/mensa-tex-example.pdf | Bin 0 -> 88060 bytes .../doc/latex/mensa-tex/doc/mensa-tex-example.tex | 86 ++++ .../doc/latex/mensa-tex/mensa-tex-doc.pdf | Bin 67732 -> 0 bytes .../doc/latex/mensa-tex/mensa-tex-doc.tex | 554 -------------------- 8 files changed, 650 insertions(+), 555 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/mensa-tex/doc/cafe-logo.png create mode 100644 Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-doc.pdf create mode 100644 Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-doc.tex create mode 100644 Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-example.pdf create mode 100644 Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-example.tex delete mode 100644 Master/texmf-dist/doc/latex/mensa-tex/mensa-tex-doc.pdf delete mode 100644 Master/texmf-dist/doc/latex/mensa-tex/mensa-tex-doc.tex (limited to 'Master/texmf-dist/doc') diff --git a/Master/texmf-dist/doc/latex/mensa-tex/README.md b/Master/texmf-dist/doc/latex/mensa-tex/README.md index 2628673cd3c..39362faecd4 100644 --- a/Master/texmf-dist/doc/latex/mensa-tex/README.md +++ b/Master/texmf-dist/doc/latex/mensa-tex/README.md @@ -1,7 +1,9 @@ # mensa-tex A LaTeX class for typesetting school cafeteria menus consisting of two lunches (with dessert) and dinner -This work, consisting of the files `mensa-tex.cls` and `mensa-tex-doc.tex`, is licensed under the LPPL, Version 1.3c (or, at your option, any later version) +This work, consisting of the files `mensa-tex.cls`, `mensa-tex-doc.tex` and `mensa-tex-example.tex`, is licensed under the LPPL, Version 1.3c (or, at your option, any later version) Current maintainer of the work is Sebastian Friedl. +The file `cafe-logo.png` used with `mensa-tex-example.tex` is licensed as public domain. It is *not* part of this work, although it is required to compile `mensa-tex-example.tex`. + mensa-tex requires LaTeX2e and depends on the packages `array`, `colortbl`, `datetime2`, `datetime2-calc`, `geometry`, `graphicx`, `lmodern`, `textcomp` and `xcolor` diff --git a/Master/texmf-dist/doc/latex/mensa-tex/doc/cafe-logo.png b/Master/texmf-dist/doc/latex/mensa-tex/doc/cafe-logo.png new file mode 100644 index 00000000000..568208e8edd Binary files /dev/null and b/Master/texmf-dist/doc/latex/mensa-tex/doc/cafe-logo.png differ diff --git a/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-doc.pdf b/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-doc.pdf new file mode 100644 index 00000000000..0f95d2e35bf Binary files /dev/null and b/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-doc.tex b/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-doc.tex new file mode 100644 index 00000000000..34f88794915 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-doc.tex @@ -0,0 +1,561 @@ +%% This is file 'mensa-tex-doc.tex', Version 2017-12-03 +%% Copyright 2017 Sebastian Friedl +%% +%% This work may be distributed and/or modified under the conditions of the LaTeX Project +%% Public License, either version 1.3c of this license or (at your option) any later version. +%% The latest version of this license is available at +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX version 2008-05-04 or later. +%% +%% This work has the LPPL maintenance status 'maintained'. +%% Author: Sebastian Friedl +%% Current maintainer of this work is Sebastian Friedl +%% +%% This work consists of the files mensa-tex.cls, mensa-tex-doc.tex and mensa-tex-example.tex +%% +%% --------------------------------------------------------------------------------------------------------------------------------------------- +%% +%% A LaTeX class for typesetting school cafeteria menus consisting of two lunches (with dessert) and dinner +%% +%% --------------------------------------------------------------------------------------------------------------------------------------------- +%% +%% Please report bugs and other problems as well as suggestions for improvements to the following email address: sfr682k@t-online.de +%% +%% --------------------------------------------------------------------------------------------------------------------------------------------- + + +% !TeX spellcheck = en_US +% !TeX program=lualatex + + + +\documentclass[11pt]{ltxdoc} + +\usepackage[utopia]{mathdesign} +\usepackage[no-math]{fontspec} + +\usepackage{polyglossia} +\setdefaultlanguage{english} +\usepackage[english]{selnolig} + +\usepackage{amsmath} +\usepackage{array} +\usepackage{csquotes} +\usepackage{graphicx} +\usepackage{hyperref} +\usepackage{multicol} +\usepackage{textcomp} +\usepackage{xcolor} + + +\parindent 0pt + +\setmainfont[Numbers=OldStyle]{erewhon} +\setsansfont[Numbers=OldStyle,Scale=MatchLowercase]{Source Sans Pro} +\setmonofont[Numbers=OldStyle,Scale=MatchLowercase]{Source Code Pro} + +\usepackage[left=4.50cm,right=2.75cm,top=3.25cm,bottom=2.75cm,nohead]{geometry} + +\hyphenation{} + +\title{The \texttt{mensa-tex} class \\ {\large\url{https://github.com/SFr682k/mensa-tex}}} +\author{Sebastian Friedl \\ \href{mailto:sfr682k@t-online.de}{\ttfamily sfr682k@t-online.de}} +\date{2017/12/03} + +\hypersetup{pdftitle={The mensa-tex class},pdfauthor={Sebastian Friedl}} + +\begin{document} + \maketitle + \thispagestyle{empty} + + \begin{center} \itshape + \enquote{I can't go to a restaurant and order food \\ because I keep looking at the fonts on the menu} \\ + --- \textsc{\upshape Donald E. Knuth} --- + \end{center} + + \medskip + \begin{abstract} + \noindent% + A \LaTeX\ class for typesetting school cafeteria menus consisting of two lunches (with dessert) and dinner + \end{abstract} + + + \tableofcontents + + \clearpage + + + + \subsection*{Dependencies and other requirements} + \addcontentsline{toc}{subsection}{Dependencies and other requirements} + The \texttt{mensa-tex} class requires \LaTeXe\ and the following packages: + \begin{multicols}{3}\ttfamily\centering + array \\ colortbl \\ datetime2 \\ datetime2-calc \\ geometry \\ graphicx \\ lmodern \\ textcomp \\ xcolor + \end{multicols} + + + \subsection*{License} + \begin{small} + \addcontentsline{toc}{subsection}{License} + \textcopyright\ 2017 Sebastian Friedl + + \smallskip + This work may be distributed and/or modified under the conditions of the \LaTeX\ Project Public License, either version 1.3c of this license or (at your option) any later version. + + \smallskip + The latest version of this license is available at \url{http://www.latex-project.org/lppl.txt} and version 1.3c or later is part of all distributions of \LaTeX\ version 2008-05-04 or later. + + \smallskip + This work has the LPPL maintenance status \enquote*{maintained}. The current maintainer of this work is Sebastian Friedl. \\ + This work consists of the following files: + \begin{itemize} \itemsep 0pt + \item \texttt{mensa-tex.cls}, + \item \texttt{mensa-tex-doc.tex} and + \item \texttt{mensa-tex-example.tex} + \end{itemize} + \end{small} + + + \subsection*{Call for cooperation} + \addcontentsline{toc}{subsection}{Call for cooperation} + Please report bugs and other problems as well as suggestions for improvements by using the \href{https://github.com/SFr682k/mensa-tex/issues}{issue tracker on GitHub} or sending an email to \href{mailto:sfr682k@t-online.de}{\texttt{sfr682k@t-online.de}}. + + + \clearpage + + + + % DOCUMENTATION PART ---------------------------------------------------------------------- + + \section{Using the \texttt{\textbackslash documentclass} command} \label{sec:docclass} + Using this class is as easy as using the \verb|\documentclass{mensa-tex}| command. + + \bigskip + Following class options are available: + \begin{itemize} + \item[\texttt{app}] Use a layout optimized for small screens using DIN/ISO A6 paper + \item[\texttt{en-GB}] Use an English localization, British variant \textit{(default)} + \item[\texttt{en-US}] Use an English localization, American variant + \item[\texttt{german}] Use a German localization + \end{itemize} + + + + \section{Creating a menu} + This section deals with creating a menu using \texttt{mensa-tex}. \\ + \textit{\color{red} All the commands described in this section are to be used inside the preamble} since the menu gets created instantly when using \verb|\begin{document}|. + + \subsection{Setting up the basic information} + The basic information consists of the name of the cafeteria, the institute (or school) it is located at and the image used on the single pages. \\ + It can be set by using the following commands: + + \medskip + \DescribeMacro{\mensaname} + This command is used to declare the name of the cafeteria -- maybe something like \verb|\mensaname{Food Corner}| \textit{(default is the plain old boring \enquote{Mensa})}. \\ + You may want to change the font size by using arbitrary \LaTeX\ font size commands. + + \medskip + \DescribeMacro{\institute} + Sets the name of the institute the cafeteria is located at -- for example, you can insert \verb|\institute{University of LOL}| in your preamble if your cafeteria is located at some institute called the \enquote{University of LOL}. \\ + Note that information about the institute is only printed when using the normal layout. + + \medskip + \DescribeMacro{\setimage} + Add an image to your diet plans using this command. \\ + Note that you \textit{have} to declare the image by using \verb|\includegraphics| inside \verb|\setimage| (e.~g.~\verb|\setimage{\includegraphics[width=8cm]{path/to/picture}}|). \\ + The space available for the image depends on the used layout (see table \ref{tab:image-sizes}). + + \begin{table}[b]\centering\sffamily\small\renewcommand{\arraystretch}{1.25} + \begin{tabular}{r*{2}{|>{\centering\ttfamily}m{.25\textwidth}<{\arraybackslash}}} + & \textsf{normal layout} & app \textsf{layout} \tabularnewline\hline\hline + width & \verb|.50\textwidth| \newline $\approx$ \verb|9.0cm| & \verb|.58\textwidth| \newline $\approx$ \verb|4.9cm| \tabularnewline\hline + height & \verb|.15\textheight| \newline $\approx$ \verb|4.0cm| & \verb|.15\textheight| \newline $\approx$ \verb|1.9cm| + \end{tabular} + + \rmfamily + \caption{Available space for the header image} + \label{tab:image-sizes} + \end{table} + + + \subsection{Adding food} + For adding information about the food, the commands described in this subsection are provided. + + \medskip + \DescribeMacro{\startdate} + This commands defines the \enquote{start date}, the date of the first entry \textit{(the start date's weekday mostly happens to be a Monday)}. The start date has to be present in \textsf{YYYY-MM-DD} format, e.~g.~\verb|\startdate{2007-01-01}| \textit{(Default is 2001-01-01)}. + + \medskip + \DescribeMacro{\monday}\DescribeMacro{\tuesday}\DescribeMacro{\wednesday}\DescribeMacro{\thursday}\DescribeMacro{\friday} + Use these five commands to insert food into the empty diet. \\ + Every single command requires the same four arguments: + \begin{multicols}{4} + \begin{enumerate}\itemsep0pt + \item Menu I + \item Menu II + \item Dessert + \item Dinner + \end{enumerate} + \end{multicols} + + For example, to obtain Monday's menu consisting of + \begin{multicols}{2} + \begin{tabbing} + \hspace{2cm}\=\kill + Menu I: \> Fish and chips \\ + Menu II: \> Crispy fried chicken \\ + Dessert: \> Chocolate fudge \\ + Dinner: \> DIY hamburgers + \end{tabbing} + \end{multicols} + you have to write \\ + \verb|\monday{Fish and chips}% <-- % is required when| \\\nopagebreak[4] + \verb| {Crispy fried chicken}% commands are continued| \\\nopagebreak[4] + \verb| {Chocolate fudge}% in the following line| \\\nopagebreak[4] + \verb| {DIY hamburgers}| + + \smallskip + It is possible to insert the command listed above without line breaks, however, doing so will result in the source being less human-readable. + + \smallskip + Due to the menu being implemented in a \texttt{tabular} environment, you have to use \verb|\linebreak| instead of \,\verb|\\|\, to produce additional lines. \\ + Possible, additional hyphenations not found by \LaTeX\ can be marked by manually inserting discretionary hyphens (\verb|\-|) (e.~g.~\verb|hyphen\-ation|). + + + \subsection{Adding additional information} + \subsubsection{Remarks at the bottom of the page} \label{sec:remarks} + Some people may want to insert some remarks or annotations at the bottom of the page. \\ + These remarks are defined using two commands, depending on the used layout. + + \medskip + \DescribeMacro{\longremarks} + This command defines the remarks used for the normal layout. \\ + They may be quite short (like \verb|\longremarks{Try it!}|) or very, very long. + + \medskip + \DescribeMacro{\shortremarks} + This command defines the remarks used for the \texttt{app}--Layout \\ + Maybe, you should reduce the font size by inserting arbitrary \LaTeX\ font size commands (e.~g.~\verb|\shortremarks{\footnotesize Now using a smaller font size}|) + + + \subsubsection{Remarks for additive ingredients} + When food contains additive ingredients, these additive ingredients are usually indicated by adding superscript figures. \\ + You have to insert the legend manually by using remarks (see section \ref{sec:remarks}). + + \medskip + \DescribeMacro{\sup} + This command is a shortcut providing access to the \verb|\textsuperscript| command. \\ + It can be used to produce a superscript 4 with \verb|\sup{4}|. + + + \subsubsection{Symbols for vegetarian and vegan food} + Due to the recent development I decided to declare symbols for labeling vegetarian and vegan food. \\ + However, you have to insert the legend manually by using remarks (see section \ref{sec:remarks}). + + \medskip + \DescribeMacro{\vgt} + Produces a symbol consisting of one green leaf ({\color{green!50!black}\textleaf}) for labeling vegetarian food + + \medskip + \DescribeMacro{\vgn} + Produces a symbol consisting of two green leaves ({\color{green!50!black}\textleaf\textleaf}) for labeling vegan food + + \medskip + Since the leaf symbol is obtained by loading the \texttt{textcomp} package and using the \verb|{\rmfamily\textleaf}| command, please avoid packages loading another roman font not supporting this symbol. This should not be a big limitation since the class only uses sans--serif fonts. \\ + Otherwise, \verb|\vgt| and \verb|\vgn| have to be redefined. + + + \subsection{Using fancy colors} + To avoid a very boring look of the menu, some parts can be highlighted by using colors. \\ + The class defines three colors: one for the background of certain boxes, another one for the text inside these boxes and a third one for structure text. + + \subsubsection{Changing colors} + Colors can be changed globally by using three commands. The colors themselves are described using the normal syntax of the \texttt{xcolor} package. + + \medskip + \DescribeMacro{\setbgcolor} + Changes the background color of certain boxes (e.~g. \verb|\setbgcolor{blue}|) + + \medskip + \DescribeMacro{\setcolorfg} + Changes the color of text inside these colored boxes (e.~g. \verb|\setcolorfg{white}|) + + \medskip + \DescribeMacro{\setctextcolor} + Changes the color of structure text (e.~g. \verb|\setctextcolor{red}|) + + + \subsubsection{A short note about color selection} + Please ensure, that the colors set with \verb|\setbgcolor| and \verb|\setcolorfg| are distinctive enough from each other. \verb|\setbgcolor{black}| and \verb|\setcolorfg{black!85}| are usually a very, very bad choice when being used together. \\ + Also, a clear difference between \verb|\setctextcolor| and the background of the sheet of paper is recommended. + + + \subsubsection{Using class--defined colors in normal text} + The colors defined with \verb|\setbgcolor|, \verb|\setcolorfg| and \verb|\setctextcolor| can be used with \verb|\color| and other color commands. \\ + The corresponding defined colors are called \verb|\bgcolor|, \verb|\colorfg| and \verb|\ctextcolor|. + + \medskip + Examples: \verb|\color{\bgcolor}|, \verb|\color{\colorfg}| and \verb|\color{\ctextcolor}| + + + + \section{How to add support for other languages} + Currently, the class natively supports English (GB/US) and German. \\ + However, with the instructions in this section, you are able to define additional localizations yourself. \\ + It is recommended to select the localization closest to your localization by using the class options described in section \ref{sec:docclass} \textit{before} redefining commands (see the examples in table \ref{tab:locals-example}). \\ + Code described in this section is to be placed \textit{before} the \verb|\begin{document}| command. \\ + Only redefine commands when necessary. + + % TODO: Table with example of pre-defined localizations + \begin{table}\centering\sffamily\renewcommand{\arraystretch}{1.25} + \begin{tabular}{r*{3}{|>{\centering}p{.2\textwidth}<{\arraybackslash}}} + & \texttt{en-GB} & \texttt{en-US} & \texttt{german} \tabularnewline \hline\hline + \verb|\menuname| & \multicolumn{2}{c|}{Menu} & Menü \tabularnewline \hline + \verb|\dessertname| & \multicolumn{2}{c|}{Dessert} & Dessert \tabularnewline \hline + \verb|\dinnername| & \multicolumn{2}{c|}{Dinner} & Abendessen \tabularnewline \hline + \verb|\dietname| & \multicolumn{2}{c|}{Weekly menu} & Speiseplan vom \tabularnewline \hline + \verb|\shortdate| & 18/09/17 & 09/18/17 & 18.09. \tabularnewline \hline + \verb|\dowshortdate| & Monday, 18/09/17 & Monday, 09/18/17 & Montag, 18.09.17 \tabularnewline \hline + \verb|\longdate| & 18/09/2017 & 09/18/2017 & 18.09.2017 \tabularnewline \hline + \verb|\daterange| & 18/09/17\,--\,22/09/17 & 09/18/17\,--\,09/22/17 & 18.09.\,--\,22.09.2017 + \end{tabular} + + \rmfamily + \caption{Examples for natively supported localizations} + \label{tab:locals-example} + \end{table} + + + + + \subsection{Weekday names} + Weekday names are stored in the \verb|\wdayname| and \verb|\swdayname| commands. \\ + To modify them, copy the code printed below into your preamble and replace the English weekday names (and their abbreviations) with the appropriate form of your localization (but leave the \verb|%|s untouched) + + \medskip + \verb|% Weekday names| \\ + \verb|\renewcommand{\wdayname}[1]{%| \\ + \verb| \ifcase\DTMfetchdow{#1}| \\ + \verb| Monday%| \\ + \verb| \or| \\ + \verb| Tuesday%| \\ + \verb| \or| \\ + \verb| Wednesday%| \\ + \verb| \or| \\ + \verb| Thursday%| \\ + \verb| \or| \\ + \verb| Friday%| \\ + \verb| \or| \\ + \verb| Saturday%| \\ + \verb| \or| \\ + \verb| Sunday%| \\ + \verb| \fi| \\ + \verb|}| + + \bigskip + \verb|% Short weekday names| \\ + \verb|\renewcommand{\swdayname}[1]{%| \\ + \verb| \ifcase\DTMfetchdow{#1}| \\ + \verb| Mon%| \\ + \verb| \or| \\ + \verb| Tue%| \\ + \verb| \or| \\ + \verb| Wed%| \\ + \verb| \or| \\ + \verb| Thu%| \\ + \verb| \or| \\ + \verb| Fri%| \\ + \verb| \or| \\ + \verb| Sat%| \\ + \verb| \or| \\ + \verb| Sun%| \\ + \verb| \fi| \\ + \verb|}| + + + \subsection{Keywords} + There are four keywords stored in separate commands. \\ + To modify them, copy the code printed below into your preamble and replace the English words by vocabulary appropriate for your localization. + + \medskip + \verb|\def\menuname{Menu}| \\ + \verb|\def\dessertname{Dessert}| \\ + \verb|\def\dinnername{Dinner}| \\ + \verb|\def\dietname{Weekly menu}| + + + \subsection{Date formats} + This part is probably the most complicated one when defining own localizations. \\ + Basically, there are four commands that may be redefined: + \begin{itemize} + \item \verb|\shortdate| \\ + The short form of the date (e.~g. 10/11) + + \item \verb|\dowshortdate| \\ + The short form of the date, including the weekday (e.~g. Sat., 10/11) + + \item \verb|\longdate| \\ + The long form of the date (e.~g. 10/11/2012) + + \item \verb|\daterange| \\ + A range between two dates (e.~g. 10/11--14/11/2012) + \end{itemize} + + \medskip + When redefining these commands, you have to assemble the templates available for day, month and year in an order matching the localization. + + \subsubsection*{Date templates} + \begin{itemize} + \item[\sffamily\bfseries DD] + \verb|\DTMtwodigits{\DTMfetchday{#1}}| \\ + Prints the day using two digits \\ + If the day consists of only one digit, a zero is inserted (e.~g. 01 instead of 1) + + \item[\sffamily\bfseries D] + \verb|\DTMfetchday{#1}| \\ + Prints the day using one or two digits + \end{itemize} + + \subsubsection*{Month templates} + \begin{itemize} + \item[\sffamily\bfseries MM] + \verb|\DTMtwodigits{\DTMfetchmonth{#1}}| \\ + Prints the month using two digits + + \item[\sffamily\bfseries M] + \verb|\DTMfetchmonth{#1}| \\ + Prints the month using one or two digits + \end{itemize} + + \subsubsection*{Year templates} + \begin{itemize} + \item[\sffamily\bfseries YYYY] + \verb|\DTMfetchyear{#1}| \\ + Prints the year using as many digits as required + + \item[\sffamily\bfseries YY] + \verb|\DTMtwodigits{\DTMfetchyear{#1}}| \\ + Prints the year using two digits + \end{itemize} + + \subsubsection*{Inserting weekday names} + \begin{tabular}{>{\sffamily\bfseries}rl} + \enquote{normal} weekday names: & \verb|\wdayname{#1}| \\ + short weekday names: & \verb|\swdayname{#1}| + \end{tabular} + + \subsubsection*{Redefining commands using templates} + Now, you only have to redefine the commands. Use the following basic structure: \\ + \verb|\renewcommand{ %% COMMAND %% }[1]{%| \\ + \verb| %% INSERT THE TEMPLATE COMBINATIONS HERE %%| \\ + \verb|}| + + \bigskip + The templates listed above can be combined suitable. \\ + For example, if you want the long date to be displayed in the \textsf{YYYY-MM-DD} format, the following code does the trick: \\ + \verb|\renewcommand{\longdate}[1]{%| \\\nopagebreak[4] + \verb| \DTMfetchyear{#1}% The YYYY template| \\\nopagebreak[4] + \verb| -% Year/month separator| \\\nopagebreak[4] + \verb| \DTMtwodigits{\DTMfetchmonth{#1}}% The MM template| \\\nopagebreak[4] + \verb| -% Month/day separator| \\\nopagebreak[4] + \verb| \DTMtwodigits{\DTMfetchday{#1}}% The DD template| \\\nopagebreak[4] + \verb|}| \pagebreak[0] + + \medskip + The same principle applies to redefinitions of \verb|\shortdate| and \verb|\dowshortdate|. \\ + The \verb|%|s avoid spaces after templates and separators when inserting line breaks. + + \medskip + If you have already redefined \verb|\shortdate| and \verb|\longdate|, you may reuse these definitions when redefining \verb|\dowshortdate|, for example: \\ + \verb|\renewcommand{\dowshortdate}[1]{%| \\\nopagebreak[4] + \verb| \wdayname{#1}% Insert the weekday| \\\nopagebreak[4] + \verb| ,~% Weekday/day seperator (~ = space)| \\\nopagebreak[4] + \verb| \shortdate{#1}% Use the short date template| \\\nopagebreak[4] + \verb|}| \pagebreak[0] + + \bigskip + \textit{Redefining the} \verb|\daterange| \textit{command is special} since it requires two arguments. \\ + Here, you have to use \dots + \begin{itemize} + \item + {\ttfamily\#1} for commands and templates referring to the start date and + + \item + {\ttfamily\#2} for commands and templates referring to the end date + \end{itemize} + + For example, a working redefinition of \verb|\daterange| can be achieved with this code: \\ + \verb|\renewcommand{\daterange}[2]{% <-- »[2]« instead of »[1]«!!| \\\nopagebreak[4] + \verb| \shortdate{#1}% Start date| \\\nopagebreak[4] + \verb| \,--\,% Seperator: -- with spaces| \\\nopagebreak[4] + \verb| \shortdate{#2}% End date: #2 inst. of #1| \\\nopagebreak[4] + \verb|}| + + + + \section{A working example} + \verb|\documentclass[en-US]{mensa-tex}| \\ + + \verb|\usepackage[american]{babel}| \\ + \verb|\usepackage[utf8]{inputenc}| \\ + + \verb|\setbgcolor{blue}| \\ + \verb|\setcolorfg{white}| \\ + \verb|\setctextcolor{red}| \\ + + + + \verb|\institute{Some university far, far away}| \\ + \verb|\mensaname{Café}| \\ + + \verb|\setimage{\includegraphics[height=.125\textheight]{cafe-logo}}| \\[\bigskipamount] + + + \verb|\startdate{2017-09-18}| \\ + + \verb|\monday{Scrambled Eggs \linebreak\vgt}%| \\ + \verb| {Curry Potato Salad with Peas, Mint \& Red Onion \linebreak\vgn}%| \\ + \verb| {Ice Cream}%| \\ + \verb| {Turkey Burger}| \\ + + \verb|\tuesday{Philly Cheese Steak\sup{1)}}%| \\ + \verb| {Sesame Noodles \linebreak\vgn}%| \\ + \verb| {Donuts}%| \\ + \verb| {Orzo Pasta}| \\ + + \verb|\wednesday{-/-}{-/-}{-/-}{-/-}| \\ + + \verb|\thursday{Buffalo Wings}%| \\ + \verb| {Vegetarian Eggrolls \linebreak\vgt}%| \\ + \verb| {Sacher Cake}%| \\ + \verb| {Chicken Tortilla}| \\ + + \verb|\friday{Pastrami Melt}%| \\ + \verb| {Grilled Cheese \linebreak\vgt}%| \\ + \verb| {Tiramisu}%| \\ + \verb| {Salmon Burger}| \\[\bigskipamount] + + \verb|\longremarks{%| \\ + \verb| {\color{\ctextcolor}| \\ + \verb| Due to a training course of our staff, the café is closed| \\ + \verb| on Wednesday, 09/20/17.}| \\ + + \verb| \medskip| \\ + \verb| In our efforts to sustain a seasonal menu, sometimes| \\ + \verb| substitutions may be required, and menu items may change| \\ + \verb| without notice.| \\ + + \verb| \bigskip| \\ + \verb| \textbf{Key:} \quad| \\ + \verb| \vgt: vegetarian \quad| \\ + \verb| \vgn: vegan \quad| \\ + \verb| \sup{1)}: spicy| \\ + \verb|}| \\ + + \verb|\begin{document}| \\ + \verb|\end{document}| + + \bigskip + Output: \\[\medskipamount]\nopagebreak[4] + $\boxed{\text{\includegraphics[width=.95\textwidth]{mensa-tex-example}}}$ +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-example.pdf b/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-example.pdf new file mode 100644 index 00000000000..6182f645b43 Binary files /dev/null and b/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-example.pdf differ diff --git a/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-example.tex b/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-example.tex new file mode 100644 index 00000000000..6b762d18af1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/mensa-tex/doc/mensa-tex-example.tex @@ -0,0 +1,86 @@ +%% This is file 'mensa-tex-example.tex', Version 2017-12-03 +%% Copyright 2017 Sebastian Friedl +%% +%% This work may be distributed and/or modified under the conditions of the LaTeX Project +%% Public License, either version 1.3c of this license or (at your option) any later version. +%% The latest version of this license is available at +%% http://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX version 2008-05-04 or later. +%% +%% This work has the LPPL maintenance status 'maintained'. +%% Author: Sebastian Friedl +%% Current maintainer of this work is Sebastian Friedl +%% +%% This work consists of the files mensa-tex.cls, mensa-tex-doc.tex and mensa-tex-example.tex +%% +%% --------------------------------------------------------------------------------------------------------------------------------------------- +%% +%% A LaTeX class for typesetting school cafeteria menus consisting of two lunches (with dessert) and dinner +%% +%% --------------------------------------------------------------------------------------------------------------------------------------------- +%% +%% Please report bugs and other problems as well as suggestions for improvements to the following email address: sfr682k@t-online.de +%% +%% --------------------------------------------------------------------------------------------------------------------------------------------- + + +\documentclass[en-US]{mensa-tex} + +\usepackage[american]{babel} +\usepackage[utf8]{inputenc} + +\setbgcolor{blue} +\setcolorfg{white} +\setctextcolor{red} + + + +\institute{Some university far, far away} +\mensaname{Café} + +\setimage{\includegraphics[height=.125\textheight]{cafe-logo}} % public domain + + +\startdate{2017-09-18} + +\monday{Scrambled Eggs \linebreak\vgt}% + {Curry Potato Salad with Peas, Mint \& Red Onion \linebreak\vgn}% + {Ice Cream}% + {Turkey Burger} + +\tuesday{Philly Cheese Steak\sup{1)}}% + {Sesame Noodles \linebreak\vgn}% + {Donuts}% + {Orzo Pasta} + +\wednesday{-/-}{-/-}{-/-}{-/-} + +\thursday{Buffalo Wings}% + {Vegetarian Eggrolls \linebreak\vgt}% + {Sacher Cake}% + {Chicken Tortilla} + +\friday{Pastrami Melt}% + {Grilled Cheese \linebreak\vgt}% + {Tiramisu}% + {Salmon Burger} + +\longremarks{% + {\color{\ctextcolor} + Due to a training course of our staff, the café is closed + on Wednesday, 09/20/17.} + + \medskip + In our efforts to sustain a seasonal menu, sometimes + substitutions may be required, and menu items may change + without notice. + + \bigskip + \textbf{Key:} \quad + \vgt: vegetarian \quad + \vgn: vegan \quad + \sup{1)}: spicy +} + +\begin{document} +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/mensa-tex/mensa-tex-doc.pdf b/Master/texmf-dist/doc/latex/mensa-tex/mensa-tex-doc.pdf deleted file mode 100644 index f932cf74fd0..00000000000 Binary files a/Master/texmf-dist/doc/latex/mensa-tex/mensa-tex-doc.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/mensa-tex/mensa-tex-doc.tex b/Master/texmf-dist/doc/latex/mensa-tex/mensa-tex-doc.tex deleted file mode 100644 index 3e8be635400..00000000000 --- a/Master/texmf-dist/doc/latex/mensa-tex/mensa-tex-doc.tex +++ /dev/null @@ -1,554 +0,0 @@ -%% This is file 'mensa-tex-doc.tex', Version 2017-12-02 -%% Copyright 2017 Sebastian Friedl -%% -%% This work may be distributed and/or modified under the conditions of the LaTeX Project -%% Public License, either version 1.3c of this license or (at your option) any later version. -%% The latest version of this license is available at -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX version 2008-05-04 or later. -%% -%% This work has the LPPL maintenance status 'maintained'. -%% Author: Sebastian Friedl -%% Current maintainer of this work is Sebastian Friedl -%% -%% This work consists of the files mensa-tex.cls and mensa-tex-doc.tex -%% -%% --------------------------------------------------------------------------------------------------------------------------------------------- -%% -%% A LaTeX class for typesetting school cafeteria menus consisting of two lunches (with dessert) and dinner -%% -%% --------------------------------------------------------------------------------------------------------------------------------------------- -%% -%% Please report bugs and other problems as well as suggestions for improvements to the following email address: sfr682k@t-online.de -%% -%% --------------------------------------------------------------------------------------------------------------------------------------------- - - -% !TeX spellcheck = en_US -% !TeX program=lualatex - - - -\documentclass[11pt]{ltxdoc} - -\usepackage[utopia]{mathdesign} -\usepackage[no-math]{fontspec} - -\usepackage{polyglossia} -\setdefaultlanguage{english} -\usepackage[english]{selnolig} - -\usepackage{array} -\usepackage{csquotes} -\usepackage{hyperref} -\usepackage{multicol} -\usepackage{textcomp} -\usepackage{xcolor} - - -\parindent 0pt - -\setmainfont[Numbers=OldStyle]{erewhon} -\setsansfont[Numbers=OldStyle,Scale=MatchLowercase]{Source Sans Pro} -\setmonofont[Numbers=OldStyle,Scale=MatchLowercase]{Source Code Pro} - -\usepackage[left=4.50cm,right=2.75cm,top=3.25cm,bottom=2.75cm,nohead]{geometry} - -\hyphenation{} - -\title{The \texttt{mensa-tex} class \\ {\large\url{https://github.com/SFr682k/mensa-tex}}} -\author{Sebastian Friedl \\ \href{mailto:sfr682k@t-online.de}{\ttfamily sfr682k@t-online.de}} -\date{2017/12/02} - -\hypersetup{pdftitle={The mensa-tex class},pdfauthor={Sebastian Friedl}} - -\begin{document} - \maketitle - \thispagestyle{empty} - - \begin{center} \itshape - \enquote{I can't go to a restaurant and order food \\ because I keep looking at the fonts on the menu} \\ - --- \textsc{\upshape Donald E. Knuth} --- - \end{center} - - \medskip - \begin{abstract} - \noindent% - A \LaTeX\ class for typesetting school cafeteria menus consisting of two lunches (with dessert) and dinner - \end{abstract} - - - \tableofcontents - - \clearpage - - - - \subsection*{Dependencies and other requirements} - \addcontentsline{toc}{subsection}{Dependencies and other requirements} - The \texttt{mensa-tex} class requires \LaTeXe\ and the following packages: - \begin{multicols}{3}\ttfamily\centering - array \\ colortbl \\ datetime2 \\ datetime2-calc \\ geometry \\ graphicx \\ lmodern \\ textcomp \\ xcolor - \end{multicols} - - - \subsection*{License} - \begin{small} - \addcontentsline{toc}{subsection}{License} - \textcopyright\ 2017 Sebastian Friedl - - \smallskip - This work may be distributed and/or modified under the conditions of the \LaTeX\ Project Public License, either version 1.3c of this license or (at your option) any later version. - - \smallskip - The latest version of this license is available at \url{http://www.latex-project.org/lppl.txt} and version 1.3c or later is part of all distributions of \LaTeX\ version 2008-05-04 or later. - - \smallskip - This work has the LPPL maintenance status \enquote*{maintained}. The current maintainer of this work is Sebastian Friedl. \\ - This work consists of the following files: - \begin{itemize} \itemsep 0pt - \item \texttt{mensa-tex.cls} and - \item \texttt{mensa-tex-doc.tex} - \end{itemize} - \end{small} - - - \subsection*{Call for cooperation} - \addcontentsline{toc}{subsection}{Call for cooperation} - Please report bugs and other problems as well as suggestions for improvements by using the \href{https://github.com/SFr682k/mensa-tex/issues}{issue tracker on GitHub} or sending an email to \href{mailto:sfr682k@t-online.de}{\texttt{sfr682k@t-online.de}}. - - - \clearpage - - - - % DOCUMENTATION PART ---------------------------------------------------------------------- - - \section{Using the \texttt{\textbackslash documentclass} command} \label{sec:docclass} - Using this class is as easy as using the \verb|\documentclass{mensa-tex}| command. - - \bigskip - Following class options are available: - \begin{itemize} - \item[\texttt{app}] Use a layout optimized for small screens using DIN/ISO A6 paper - \item[\texttt{en-GB}] Use an English localization, British variant \textit{(default)} - \item[\texttt{en-US}] Use an English localization, American variant - \item[\texttt{german}] Use a German localization - \end{itemize} - - - - \section{Creating a menu} - This section deals with creating a menu using \texttt{mensa-tex}. \\ - \textit{\color{red} All the commands described in this section are to be used inside the preamble} since the menu gets created instantly when using \verb|\begin{document}|. - - \subsection{Setting up the basic information} - The basic information consists of the name of the cafeteria, the institute (or school) it is located at and the image used on the single pages. \\ - It can be set by using the following commands: - - \medskip - \DescribeMacro{\mensaname} - This command is used to declare the name of the cafeteria -- maybe something like \verb|\mensaname{Food Corner}| \textit{(default is the plain old boring \enquote{Mensa})}. \\ - You may want to change the font size by using arbitrary \LaTeX\ font size commands. - - \medskip - \DescribeMacro{\institute} - Sets the name of the institute the cafeteria is located at -- for example, you can insert \verb|\institute{University of LOL}| in your preamble if your cafeteria is located at some institute called the \enquote{University of LOL}. \\ - Note that information about the institute is only printed when using the normal layout. - - \medskip - \DescribeMacro{\setimage} - Add an image to your diet plans using this command. \\ - Note that you \textit{have} to declare the image by using \verb|\includegraphics| inside \verb|\setimage| (e.~g.~\verb|\setimage{\includegraphics[width=8cm]{path/to/picture}}|). \\ - The space available for the image depends on the used layout (see table \ref{tab:image-sizes}). - - \begin{table}[b]\centering\sffamily\small\renewcommand{\arraystretch}{1.25} - \begin{tabular}{r*{2}{|>{\centering\ttfamily}m{.25\textwidth}<{\arraybackslash}}} - & \textsf{normal layout} & app \textsf{layout} \tabularnewline\hline\hline - width & \verb|.50\textwidth| \newline $\approx$ \verb|9.0cm| & \verb|.58\textwidth| \newline $\approx$ \verb|4.9cm| \tabularnewline\hline - height & \verb|.15\textheight| \newline $\approx$ \verb|4.0cm| & \verb|.15\textheight| \newline $\approx$ \verb|1.9cm| - \end{tabular} - - \rmfamily - \caption{Available space for the header image} - \label{tab:image-sizes} - \end{table} - - - \subsection{Adding food} - For adding information about the food, the commands described in this subsection are provided. - - \medskip - \DescribeMacro{\startdate} - This commands defines the \enquote{start date}, the date of the first entry \textit{(the start date's weekday mostly happens to be a Monday)}. The start date has to be present in \textsf{YYYY-MM-DD} format, e.~g.~\verb|\startdate{2007-01-01}| \textit{(Default is 2001-01-01)}. - - \medskip - \DescribeMacro{\monday}\DescribeMacro{\tuesday}\DescribeMacro{\wednesday}\DescribeMacro{\thursday}\DescribeMacro{\friday} - Use these five commands to insert food into the empty diet. \\ - Every single command requires the same four arguments: - \begin{multicols}{4} - \begin{enumerate}\itemsep0pt - \item Menu I - \item Menu II - \item Dessert - \item Dinner - \end{enumerate} - \end{multicols} - - For example, to obtain Monday's menu consisting of - \begin{multicols}{2} - \begin{tabbing} - \hspace{2cm}\=\kill - Menu I: \> Fish and chips \\ - Menu II: \> Crispy fried chicken \\ - Dessert: \> Chocolate fudge \\ - Dinner: \> DIY hamburgers - \end{tabbing} - \end{multicols} - you have to write \\ - \verb|\monday{Fish and chips}% <-- % is required when| \\\nopagebreak[4] - \verb| {Crispy fried chicken}% commands are continued| \\\nopagebreak[4] - \verb| {Chocolate fudge}% in the following line| \\\nopagebreak[4] - \verb| {DIY hamburgers}| - - \smallskip - It is possible to insert the command listed above without line breaks, however, doing so will result in the source being less human-readable. - - \smallskip - Due to the menu being implemented in a \texttt{tabular} environment, you have to use \verb|\linebreak| instead of \,\verb|\\|\, to produce additional lines. \\ - Possible, additional hyphenations not found by \LaTeX\ can be marked by manually inserting discretionary hyphens (\verb|\-|) (e.~g.~\verb|hyphen\-ation|). - - - \subsection{Adding additional information} - \subsubsection{Remarks at the bottom of the page} \label{sec:remarks} - Some people may want to insert some remarks or annotations at the bottom of the page. \\ - These remarks are defined using two commands, depending on the used layout. - - \medskip - \DescribeMacro{\longremarks} - This command defines the remarks used for the normal layout. \\ - They may be quite short (like \verb|\longremarks{Try it!}|) or very, very long. - - \medskip - \DescribeMacro{\shortremarks} - This command defines the remarks used for the \texttt{app}--Layout \\ - Maybe, you should reduce the font size by inserting arbitrary \LaTeX\ font size commands (e.~g.~\verb|\shortremarks{\footnotesize Now using a smaller font size}|) - - - \subsubsection{Remarks for additive ingredients} - When food contains additive ingredients, these additive ingredients are usually indicated by adding superscript figures. \\ - You have to insert the legend manually by using remarks (see section \ref{sec:remarks}). - - \medskip - \DescribeMacro{\sup} - This command is a shortcut providing access to the \verb|\textsuperscript| command. \\ - It can be used to produce a superscript 4 with \verb|\sup{4}|. - - - \subsubsection{Symbols for vegetarian and vegan food} - Due to the recent development I decided to declare symbols for labeling vegetarian and vegan food. \\ - However, you have to insert the legend manually by using remarks (see section \ref{sec:remarks}). - - \medskip - \DescribeMacro{\vgt} - Produces a symbol consisting of one green leaf ({\color{green!50!black}\textleaf}) for labeling vegetarian food - - \medskip - \DescribeMacro{\vgn} - Produces a symbol consisting of two green leaves ({\color{green!50!black}\textleaf\textleaf}) for labeling vegan food - - \medskip - Since the leaf symbol is obtained by loading the \texttt{textcomp} package and using the \verb|{\rmfamily\textleaf}| command, please avoid packages loading another roman font not supporting this symbol. This should not be a big limitation since the class only uses sans--serif fonts. \\ - Otherwise, \verb|\vgt| and \verb|\vgn| have to be redefined. - - - \subsection{Using fancy colors} - To avoid a very boring look of the menu, some parts can be highlighted by using colors. \\ - The class defines three colors: one for the background of certain boxes, another one for the text inside these boxes and a third one for structure text. - - \subsubsection{Changing colors} - Colors can be changed globally by using three commands. The colors themselves are described using the normal syntax of the \texttt{xcolor} package. - - \medskip - \DescribeMacro{\setbgcolor} - Changes the background color of certain boxes (e.~g. \verb|\setbgcolor{blue}|) - - \medskip - \DescribeMacro{\setcolorfg} - Changes the color of text inside these colored boxes (e.~g. \verb|\setcolorfg{white}|) - - \medskip - \DescribeMacro{\setctextcolor} - Changes the color of structure text (e.~g. \verb|\setctextcolor{red}|) - - - \subsubsection{A short note about color selection} - Please ensure, that the colors set with \verb|\setbgcolor| and \verb|\setcolorfg| are distinctive enough from each other. \verb|\setbgcolor{black}| and \verb|\setcolorfg{black!85}| are usually a very, very bad choice when being used together. \\ - Also, a clear difference between \verb|\setctextcolor| and the background of the sheet of paper is recommended. - - - \subsubsection{Using class--defined colors in normal text} - The colors defined with \verb|\setbgcolor|, \verb|\setcolorfg| and \verb|\setctextcolor| can be used with \verb|\color| and other color commands. \\ - The corresponding defined colors are called \verb|\bgcolor|, \verb|\colorfg| and \verb|\ctextcolor|. - - \medskip - Examples: \verb|\color{\bgcolor}|, \verb|\color{\colorfg}| and \verb|\color{\ctextcolor}| - - - - \section{How to add support for other languages} - Currently, the class natively supports English (GB/US) and German. \\ - However, with the instructions in this section, you are able to define additional localizations yourself. \\ - It is recommended to select the localization closest to your localization by using the class options described in section \ref{sec:docclass} \textit{before} redefining commands (see the examples in table \ref{tab:locals-example}). \\ - Code described in this section is to be placed \textit{before} the \verb|\begin{document}| command. \\ - Only redefine commands when necessary. - - % TODO: Table with example of pre-defined localizations - \begin{table}\centering\sffamily\renewcommand{\arraystretch}{1.25} - \begin{tabular}{r*{3}{|>{\centering}p{.2\textwidth}<{\arraybackslash}}} - & \texttt{en-GB} & \texttt{en-US} & \texttt{german} \tabularnewline \hline\hline - \verb|\menuname| & \multicolumn{2}{c|}{Menu} & Menü \tabularnewline \hline - \verb|\dessertname| & \multicolumn{2}{c|}{Dessert} & Dessert \tabularnewline \hline - \verb|\dinnername| & \multicolumn{2}{c|}{Dinner} & Abendessen \tabularnewline \hline - \verb|\dietname| & \multicolumn{2}{c|}{Weekly menu} & Speiseplan vom \tabularnewline \hline - \verb|\shortdate| & 18/09/17 & 09/18/17 & 18.09. \tabularnewline \hline - \verb|\dowshortdate| & Monday, 18/09/17 & Monday, 09/18/17 & Montag, 18.09.17 \tabularnewline \hline - \verb|\longdate| & 18/09/2017 & 09/18/2017 & 18.09.2017 \tabularnewline \hline - \verb|\daterange| & 18/09/17\,--\,22/09/17 & 09/18/17\,--\,09/22/17 & 18.09.\,--\,22.09.2017 - \end{tabular} - - \rmfamily - \caption{Examples for natively supported localizations} - \label{tab:locals-example} - \end{table} - - - - - \subsection{Weekday names} - Weekday names are stored in the \verb|\wdayname| and \verb|\swdayname| commands. \\ - To modify them, copy the code printed below into your preamble and replace the English weekday names (and their abbreviations) with the appropriate form of your localization (but leave the \verb|%|s untouched) - - \medskip - \verb|% Weekday names| \\ - \verb|\renewcommand{\wdayname}[1]{%| \\ - \verb| \ifcase\DTMfetchdow{#1}| \\ - \verb| Monday%| \\ - \verb| \or| \\ - \verb| Tuesday%| \\ - \verb| \or| \\ - \verb| Wednesday%| \\ - \verb| \or| \\ - \verb| Thursday%| \\ - \verb| \or| \\ - \verb| Friday%| \\ - \verb| \or| \\ - \verb| Saturday%| \\ - \verb| \or| \\ - \verb| Sunday%| \\ - \verb| \fi| \\ - \verb|}| - - \bigskip - \verb|% Short weekday names| \\ - \verb|\renewcommand{\swdayname}[1]{%| \\ - \verb| \ifcase\DTMfetchdow{#1}| \\ - \verb| Mon%| \\ - \verb| \or| \\ - \verb| Tue%| \\ - \verb| \or| \\ - \verb| Wed%| \\ - \verb| \or| \\ - \verb| Thu%| \\ - \verb| \or| \\ - \verb| Fri%| \\ - \verb| \or| \\ - \verb| Sat%| \\ - \verb| \or| \\ - \verb| Sun%| \\ - \verb| \fi| \\ - \verb|}| - - - \subsection{Keywords} - There are four keywords stored in separate commands. \\ - To modify them, copy the code printed below into your preamble and replace the English words by vocabulary appropriate for your localization. - - \medskip - \verb|\def\menuname{Menu}| \\ - \verb|\def\dessertname{Dessert}| \\ - \verb|\def\dinnername{Dinner}| \\ - \verb|\def\dietname{Weekly menu}| - - - \subsection{Date formats} - This part is probably the most complicated one when defining own localizations. \\ - Basically, there are four commands that may be redefined: - \begin{itemize} - \item \verb|\shortdate| \\ - The short form of the date (e.~g. 10/11) - - \item \verb|\dowshortdate| \\ - The short form of the date, including the weekday (e.~g. Sat., 10/11) - - \item \verb|\longdate| \\ - The long form of the date (e.~g. 10/11/2012) - - \item \verb|\daterange| \\ - A range between two dates (e.~g. 10/11--14/11/2012) - \end{itemize} - - \medskip - When redefining these commands, you have to assemble the templates available for day, month and year in an order matching the localization. - - \subsubsection*{Date templates} - \begin{itemize} - \item[\sffamily\bfseries DD] - \verb|\DTMtwodigits{\DTMfetchday{#1}}| \\ - Prints the day using two digits \\ - If the day consists of only one digit, a zero is inserted (e.~g. 01 instead of 1) - - \item[\sffamily\bfseries D] - \verb|\DTMfetchday{#1}| \\ - Prints the day using one or two digits - \end{itemize} - - \subsubsection*{Month templates} - \begin{itemize} - \item[\sffamily\bfseries MM] - \verb|\DTMtwodigits{\DTMfetchmonth{#1}}| \\ - Prints the month using two digits - - \item[\sffamily\bfseries M] - \verb|\DTMfetchmonth{#1}| \\ - Prints the month using one or two digits - \end{itemize} - - \subsubsection*{Year templates} - \begin{itemize} - \item[\sffamily\bfseries YYYY] - \verb|\DTMfetchyear{#1}| \\ - Prints the year using as many digits as required - - \item[\sffamily\bfseries YY] - \verb|\DTMtwodigits{\DTMfetchyear{#1}}| \\ - Prints the year using two digits - \end{itemize} - - \subsubsection*{Inserting weekday names} - \begin{tabular}{>{\sffamily\bfseries}rl} - \enquote{normal} weekday names: & \verb|\wdayname{#1}| \\ - short weekday names: & \verb|\swdayname{#1}| - \end{tabular} - - \subsubsection*{Redefining commands using templates} - Now, you only have to redefine the commands. Use the following basic structure: \\ - \verb|\renewcommand{ %% COMMAND %% }[1]{%| \\ - \verb| %% INSERT THE TEMPLATE COMBINATIONS HERE %%| \\ - \verb|}| - - \bigskip - The templates listed above can be combined suitable. \\ - For example, if you want the long date to be displayed in the \textsf{YYYY-MM-DD} format, the following code does the trick: \\ - \verb|\renewcommand{\longdate}[1]{%| \\\nopagebreak[4] - \verb| \DTMfetchyear{#1}% The YYYY template| \\\nopagebreak[4] - \verb| -% Year/month separator| \\\nopagebreak[4] - \verb| \DTMtwodigits{\DTMfetchmonth{#1}}% The MM template| \\\nopagebreak[4] - \verb| -% Month/day separator| \\\nopagebreak[4] - \verb| \DTMtwodigits{\DTMfetchday{#1}}% The DD template| \\\nopagebreak[4] - \verb|}| \pagebreak[0] - - \medskip - The same principle applies to redefinitions of \verb|\shortdate| and \verb|\dowshortdate|. \\ - The \verb|%|s avoid spaces after templates and separators when inserting line breaks. - - \medskip - If you have already redefined \verb|\shortdate| and \verb|\longdate|, you may reuse these definitions when redefining \verb|\dowshortdate|, for example: \\ - \verb|\renewcommand{\dowshortdate}[1]{%| \\\nopagebreak[4] - \verb| \wdayname{#1}% Insert the weekday| \\\nopagebreak[4] - \verb| ,~% Weekday/day seperator (~ = space)| \\\nopagebreak[4] - \verb| \shortdate{#1}% Use the short date template| \\\nopagebreak[4] - \verb|}| \pagebreak[0] - - \bigskip - \textit{Redefining the} \verb|\daterange| \textit{command is special} since it requires two arguments. \\ - Here, you have to use \dots - \begin{itemize} - \item - {\ttfamily\#1} for commands and templates referring to the start date and - - \item - {\ttfamily\#2} for commands and templates referring to the end date - \end{itemize} - - For example, a working redefinition of \verb|\daterange| can be achieved with this code: \\ - \verb|\renewcommand{\daterange}[2]{% <-- »[2]« instead of »[1]«!!| \\\nopagebreak[4] - \verb| \shortdate{#1}% Start date| \\\nopagebreak[4] - \verb| \,--\,% Seperator: -- with spaces| \\\nopagebreak[4] - \verb| \shortdate{#2}% End date: #2 inst. of #1| \\\nopagebreak[4] - \verb|}| - - - - \section{A working example} - \verb|\documentclass[en-US]{mensa-tex}| \\ - - \verb|\usepackage[american]{babel}| \\ - \verb|\usepackage[utf8]{inputenc}| \\ - - \verb|\setbgcolor{blue}| \\ - \verb|\setcolorfg{white}| \\ - \verb|\setctextcolor{red}| \\ - - - - \verb|\institute{Some university far, far away}| \\ - \verb|\mensaname{Café}| \\ - - \verb|\setimage{\includegraphics[width=.95\linewidth]{cafe-logo}}| \\[\bigskipamount] - - - \verb|\startdate{2017-09-18}| \\ - - \verb|\monday{Scrambled Eggs \linebreak\vgt}%| \\ - \verb| {Curry Potato Salad with Peas, Mint \& Red Onion \linebreak\vgn}%| \\ - \verb| {Ice Cream}%| \\ - \verb| {Turkey Burger}| \\ - - \verb|\tuesday{Philly Cheese Steak\sup{1)}}%| \\ - \verb| {Sesame Noodles \linebreak\vgn}%| \\ - \verb| {Donuts}%| \\ - \verb| {Orzo Pasta}| \\ - - \verb|\wednesday{-/-}{-/-}{-/-}{-/-}| \\ - - \verb|\thursday{Buffalo Wings}%| \\ - \verb| {Vegetarian Eggrolls \linebreak\vgt}%| \\ - \verb| {Sacher Cake}%| \\ - \verb| {Chicken Tortilla}| \\ - - \verb|\friday{Pastrami Melt}%| \\ - \verb| {Grilled Cheese \linebreak\vgt}%| \\ - \verb| {Tiramisu}%| \\ - \verb| {Salmon Burger}| \\[\bigskipamount] - - \verb|\longremarks{%| \\ - \verb| {\color{\ctextcolor}| \\ - \verb| Due to a training course of our staff, the café is closed| \\ - \verb| on Wednesday, 09/20/17.}| \\ - - \verb| \medskip| \\ - \verb| In our efforts to sustain a seasonal menu, sometimes| \\ - \verb| substitutions may be required, and menu items may change| \\ - \verb| without notice.| \\ - - \verb| \bigskip| \\ - \verb| \textbf{Key:} \quad| \\ - \verb| \vgt: vegetarian \quad| \\ - \verb| \vgn: vegan \quad| \\ - \verb| \sup{1)}: spicy| \\ - \verb|}| \\ - - \verb|\begin{document}| \\ - \verb|\end{document}| -\end{document} \ No newline at end of file -- cgit v1.2.3