Debian Codegraph @

texmf-dist/source/latex/menucard/menucard.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2020 by Sascha Frank <[email protected]>
4 % -------------------------------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.3 or later is part of all distributions of LaTeX
14 % version 2005/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %<*driver>
20 \ProvidesFile{menucard.dtx}
21 %</driver>
22 %<package>\NeedsTeXFormat{LaTeX2e}
23 %<package>\ProvidesPackage{menucard}
24 %<*package>
25 [2020/06/17 v0.1 menucards ]
26 \RequirePackage[x11names]{xcolor}
27 \RequirePackage{soul}
28 %</package>
29 %
30 %<*driver>
31 \documentclass{ltxdoc}
32 \usepackage{menucard}[2020/06/17]
33 \usepackage{hyperref}
34 \usepackage{parskip}
35 \EnableCrossrefs
36 \CodelineIndex
37 \RecordChanges
38 \begin{document}
39 \DocInput{menucard.dtx}
40 \PrintChanges
41 \PrintIndex
42 \end{document}
43 %</driver>
44 % \fi
45 %
46 % \CheckSum{162}
47 %
48 % \CharacterTable
49 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
50 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
51 % Digits \0\1\2\3\4\5\6\7\8\9
52 % Exclamation \! Double quote \" Hash (number) \#
53 % Dollar \$ Percent \% Ampersand \&
54 % Acute accent \' Left paren \( Right paren \)
55 % Asterisk \* Plus \+ Comma \,
56 % Minus \- Point \. Solidus \/
57 % Colon \: Semicolon \; Less than \<
58 % Equals \= Greater than \> Question mark \?
59 % Commercial at \@ Left bracket \[ Backslash \\
60 % Right bracket \] Circumflex \^ Underscore \_
61 % Grave accent \` Left brace \{ Vertical bar \|
62 % Right brace \} Tilde \~}
63 %
64 %
65 % \changes{v0.1}{2020/06/17}{Initial version}
66 %
67 % \GetFileInfo{menucard.dtx}
68 %
69 % \DoNotIndex{\newcommand,\newenvironment}
70 %
71 %
72 % \title{The \textsf{menucard} package\thanks{This document
73 % corresponds to \textsf{menucard}~\fileversion, dated \filedate.}}
74 % \author{Sascha Frank \\ \texttt{[email protected]}}
75 %
76 % \maketitle
77 % \begin{abstract}
78 % The reason for this package was that I did not find a package for creating menus.
79 % \end{abstract}
80 %
81 % \section{Introduction}
82 % The usepackage is based on the answer of Gonzalo Medina\footnote{See also \href{https://tex.stackexchange.com/questions/38091}{https://tex.stackexchange.com/questions/38091}} to the question about a document class for restaurant menus.\cite{medina}
83 %
84 %
85 % \section{What you need}
86 % It requires the usepackages soul and xcolor.
87 % \section{Loading}
88 % Load the package with: \verb+\usepackage{menucard}+
89 %
90 % \section{Usage}
91 % \DescribeMacro{\ColTextColor}
92 % This macro sets the color of the menu heading. Default is Goldenrod3. Change color:
93 % \begin{verbatim}
94 % \definecolor{plumt}{rgb}{0.56, 0.27, 0.52}
95 % \renewcommand{\ColTextColor}{plumt}
96 % \end{verbatim}
97 %
98 % \DescribeMacro{\ColSubTextColor}
99 % To set the color for the second heading. By default 50\% opacity of the first color.
100 %
101 % \DescribeMacro{\zapf}
102 % With the command \verb+\zapf+ the font for the numbering can be changed. For example change to sans serif font \verb+\renewcommand{\zapf}{\sffamily}+ or to use normalfont \verb+\renewcommand{\zapf}{}+.
103 %
104 % \DescribeMacro{\Allergens}
105 % To label allergenes and additives.
106 % \begin{verbatim}
107 % \Allergens{A,B,C}
108 % \end{verbatim}
109 %
110 %
111 % \subsection{menugroup}
112 % There are three new environments, for each there is an additional star alternative. The variant without a star is intended for the case that the menus are to be numbered consecutively. In the variant with a star, the menus are not numbered consecutively. For this reason there are two different commands to insert entries. One is the command \verb+\Entry+ for the star environments and \verb+\Entrycount+ for the others.
113 %
114 % The environments Group and Group* have one parameter.
115 %
116 % \DescribeEnv{Group*}
117 % Creates a two-column table over the width of the text, with the first column left-aligned (p-column) and the second column right-aligned.
118 %
119 % \begin{verbatim}
120 % \begin{Group*}{heading}
121 % ...
122 % \end{Group*}
123 % \end{verbatim}
124 %
125 % \DescribeEnv{Group}
126 %Creates a three-column table of the width of the text, with the first two columns left-aligned (p-columns) and the third column right-aligned. The first column is intended for numbering.
127 %
128 % \begin{verbatim}
129 % \begin{Group}{heading}
130 % ...
131 % \end{Group}
132 % \end{verbatim}
133 %
134 % The following environments have two parameters.
135 %
136 % \DescribeEnv{menugroup*}
137 %Creates a two-column table over the width of the column, where the first two columns are left-aligned (p-column) and the second column is right-aligned. The text size is \verb+\huge+ for the first heading and \verb+\LARGE+ for the second heading. The colors of the heading are Goldenrod3 respectively 50\% of it by default. A horizontal line is drawn after the headings.
138 %
139 % \begin{verbatim}
140 % \begin{menugroup*}{first heading}{second heading}
141 % ...
142 % \end{menugroup*}
143 % \end{verbatim}
144 %
145 % \DescribeEnv{menugroup}
146 %Like menugroup* but with an additional third column for numbering.
147 %
148 % \begin{verbatim}
149 % \begin{menugroup}{first heading}{second heading}
150 % ...
151 % \end{menugroup}
152 % \end{verbatim}
153 %
154 % \DescribeEnv{menugroupsc*}
155 %Like menugroup* only that the headings are set in small caps.
156 %
157 % \begin{verbatim}
158 % \begin{menugroupsc*}{first heading}{second heading}
159 % ...
160 % \end{menugroupsc*}
161 % \end{verbatim}
162 %
163 % \DescribeEnv{menugroupsc}
164 %Like menugroup only that the headings are set in small caps.
165 %
166 % \begin{verbatim}
167 % \begin{menugroupsc}{first heading}{second heading}
168 % ...
169 % \end{menugroupsc}
170 % \end{verbatim}
171 %
172 % To set the menu entries within the environments the commands \verb+\Entry+ or \verb+\Entrycount+. Within these commands, the command \verb+\Expl+ can be used to insert additional explanations.
173 %
174 % \DescribeMacro{\Entry}
175 % Used within the star environments with \verb+\Entry{left}{right}+ respectively with \verb+\Entry{left, \Expl{more}}{right}+.
176 %
177 % \DescribeMacro{\Entrycount}
178 % Used within the no star environments with \verb+\Entrycount{left}{right}+ respectively with \verb+\Entrycount{left, \Expl{more}}{right}+.
179 %
180 % \DescribeMacro{\Expl}
181 % Can be used within \verb+\Entry+ respectively \verb+\Entrycount+ to write sub entries.
182 %
183 %
184 %
185 % \StopEventually{}
186 %
187 % \section{Implementation}
188 %
189 % Setting color
190 % \begin{macro}{\ColTextColor}
191 % \begin{macrocode}
192 \newcommand{\ColTextColor}{Goldenrod3}
193 % \end{macrocode}
194 % \end{macro}
195 %
196 % \begin{macro}{\ColSubTextColor}
197 % \begin{macrocode}
198 \newcommand{\ColSubTextColor}{\ColTextColor!50}
199 % \end{macrocode}
200 % \end{macro}
201 % Text color first heading
202 % \begin{macro}{\ColText}
203 % \begin{macrocode}
204 \newcommand*\ColText[1]{\textcolor{\ColTextColor}{#1}}
205 % \end{macrocode}
206 % \end{macro}
207 % Text color second heading
208 % \begin{macro}{\ColSubText}
209 % \begin{macrocode}
210 \newcommand*\ColSubText[1]{\textcolor{\ColSubTextColor}{#1}}
211 % \end{macrocode}
212 % \end{macro}
213 % Counter
214 % \begin{macro}{menucount}
215 % \begin{macrocode}
216 \newcounter{menucount}
217 % \end{macrocode}
218 % \end{macro}
219 % New font for numbers
220 % \begin{macro}{\zapf}
221 % \begin{macrocode}
222 \newcommand{\zapf}{\fontfamily{pzc}\selectfont}
223 % \end{macrocode}
224 % \end{macro}
225 % Allergens
226 % \begin{macro}{\Allergens}
227 % \begin{macrocode}
228 \newcommand{\Allergens}[1]{\textsuperscript{\tiny\sffamily #1}}
229 % \end{macrocode}
230 % \end{macro}
231 % to format each entry in ENV*
232 % \begin{macro}{\Entry}
233 % \begin{macrocode}
234 \newcommand*\Entry[2]{%
235 \sffamily#1 & #2}
236 % \end{macrocode}
237 % \end{macro}
238 % to format each subentry
239 % \begin{macro}{\Expl}
240 % \begin{macrocode}
241 \newcommand*\Expl[1]{%
242 \hspace*{1em}\footnotesize #1}
243 % \end{macrocode}
244 % \end{macro}
245 % to format each entry in ENV
246 % \begin{macro}{\Entrycount}
247 % \begin{macrocode}
248 \newcommand*\Entrycount[2]{\stepcounter{menucount} %
249 \zapf{\themenucount}\hspace*{1em} & \sffamily#1 & #2 }
250 % \end{macrocode}
251 % \end{macro}
252 %
253 % \begin{environment}{Group*}
254 % a tabular* for each food group
255 % \begin{macrocode}
256 \newenvironment{Group*}[1]{
257 \noindent\begin{tabular*}{\textwidth}{@{}p{.8\linewidth}@{\extracolsep{\fill}}r@{}}
258 {\fontsize{24}{29}\selectfont\ColText{#1}}\\[0.8em]}
259 {\end{tabular*}}
260 % \end{macrocode}
261 % \end{environment}
262 % adding an extra column for counting
263 % \begin{environment}{Group}
264 % \begin{macrocode}
265 \newenvironment{Group}[1]
266 {\noindent\begin{tabular*}{\textwidth}{p{2em}@{}p{.8\linewidth}@{\extracolsep{\fill}}r@{}}
267 \multicolumn{3}{l}{{\fontsize{24}{29}\selectfont\ColText{#1}}}\\[0.8em]}
268 {\end{tabular*}}
269 % \end{macrocode}
270 %\end{environment}
271 % Change width and font size and added two headings
272 % \begin{environment}{menugroup*}
273 % \begin{macrocode}
274 \newenvironment{menugroup*}[2]
275 {
276 \noindent\begin{tabular*}{\columnwidth}{@{}p{.8\linewidth}@{\extracolsep{\fill}}r@{}}
277 {\huge\textcolor{\ColTextColor}{#1}\hspace*{0.1em}
278 \LARGE\textcolor{\ColSubTextColor}{#2}}\\[0.2em]
279 \noindent\rule{\columnwidth}{0.4pt} & \\[0.8em]}
280 {\end{tabular*}}
281 % \end{macrocode}
282 %\end{environment}
283 % Adding an extra column for counting
284 % \begin{environment}{menugroup}
285 % \begin{macrocode}
286 \newenvironment{menugroup}[2]
287 {
288 \noindent\begin{tabular*}{\columnwidth}{p{2em}@{}p{.8\linewidth}@{\extracolsep{\fill}}r@{}}
289 \multicolumn{3}{l}{\hspace*{-0.5em}{\huge\textcolor{\ColTextColor}{#1}\hspace*{0.1em} \LARGE\textcolor{\ColSubTextColor}{#2}}}\\[0.2em]
290 \noindent\hspace*{-0.55em}\rule{\columnwidth}{0.4pt} & \\[0.8em]}
291 {\end{tabular*}}
292 % \end{macrocode}
293 % \end{environment}
294 % Adding caps for headings
295 % \begin{environment}{menugroupsc*}
296 % \begin{macrocode}
297 \newenvironment{menugroupsc*}[2]
298 {
299 \noindent\begin{tabular*}{\columnwidth}{@{}p{.8\linewidth}@{\extracolsep{\fill}}r@{}}
300 {\huge\textcolor{\ColTextColor}{\caps{#1}}\hspace*{0.1em} \LARGE\textcolor{\ColSubTextColor}{\caps{#2}}}\\[0.2em]
301 \noindent\rule{\columnwidth}{0.4pt} & \\[0.8em]}
302 {\end{tabular*}}
303 % \end{macrocode}
304 %\end{environment}
305 % Adding an extra column for counting
306 % \begin{environment}{menugroupsc}
307 % \begin{macrocode}
308 \newenvironment{menugroupsc}[2]
309 {
310 \noindent\begin{tabular*}{\columnwidth}{p{2em}@{}p{.8\linewidth}@{\extracolsep{\fill}}r@{}}
311 \multicolumn{3}{l}{\hspace*{-0.5em}{\huge\textcolor{\ColTextColor}{\caps{#1}}\hspace*{0.1em} \LARGE\textcolor{\ColSubTextColor}{\caps{#2}}}}\\[0.2em]
312 \noindent\hspace*{-0.55em}\rule{\columnwidth}{0.4pt} & \\[0.8em]}
313 {\end{tabular*}}
314 % \end{macrocode}
315 %\end{environment}
316 %
317 %
318 %\begin{thebibliography}{9}
319 %\bibitem{medina}{Gonzalo Medina, 2011/12/13, class for a restaurant menu,\\ \href{https://tex.stackexchange.com/questions/38091/document-class-for-a-restaurant-menu}{https://tex.stackexchange.com/questions/38091/document-class-for-a-restaurant-menu}}
320 %\end{thebibliography}
321 %\bibliographystyle{unsrtdin}
322 % \Finale
323 \endinput