Browse Source

Squashed 'texmf/' changes from 8cd4858..6897aee

6897aee Make some fixes to how recipes are typeset
7df8a5e Add version and copyright package
80a62ca Fix how blanking is handled
e77a72f Fix param count

git-subtree-dir: texmf
git-subtree-split: 6897aee8cea32a08c090559044f11d24281941d7
Samuel W. Flint 4 years ago
parent
commit
c965f36727
2 changed files with 21 additions and 5 deletions
  1. 7 5
      recipe.sty
  2. 14 0
      version-and-copyright.sty

+ 7 - 5
recipe.sty

@@ -14,14 +14,17 @@
 \newcommand\threequarters{\nicefrac{3}{4}}
 
 \newcommand\recipe@ingredient[2]{#1 & #2 \\}
-\newcommand\recipe@serving[1]{\ifempty{#1}{}{\textit{#1 servings}}}
-\newcommand\recipe@contributor[1]{\ifempty{#1}{}{Courtesy of #1}}
+\newcommand\recipe@serving[1]{\ifblank{#1}{}{\textit{#1 servings}}}
+\newcommand\recipe@contributor[1]{\ifblank{#1}{}{Courtesy of #1}}
+\newcommand\recipe@majorstep[1]{\par\smallskip\textbf{#1}\par}
 
-\newenvironment{recipe}[1]{%
+\newenvironment{recipe}[3]{%
   \bigskip%
   \begin{adjustwidth}{4em}{4em}%
+    \let\majorstep=\recipe@majorstep
     \centerline{\textbf{#1}}%
-    \recipe@contributor{#2}\hfill\recipe@servings{#3}\\
+    \recipe@contributor{#2}\hfill\recipe@serving{#3}\\
+    \smallskip%
     \newenvironment{note}{\textit{Note:}}{}
     \newenvironment{ingredients}{%
       \smallskip%
@@ -35,7 +38,6 @@
       \end{center}%
       \smallskip%
     }%
-    \smallskip
   }{%
   \end{adjustwidth}%
   \bigskip%

+ 14 - 0
version-and-copyright.sty

@@ -0,0 +1,14 @@
+\ProvidesPackage{version-and-copyright}[2020/02/02 Handle Version and Copyright]
+
+\RequirePackage{verbatim}
+\RequirePackage{shellesc}
+\RequirePackage{etoolbox}
+
+\ProcessOptions\relax
+
+\newcommand\vc@getRev{\ShellEscape{git rev-parse --short HEAD > \jobname.ver}}
+\newcommand\gitrevision{\vc@getRev\input{\jobname.ver}}
+
+\newcommand\copyrightRange[1]{\copyright~#1\ifnumgreater{\year}{#1}{--\the\year}{}}
+
+\endinput