Debian Codegraph @

texmf-dist/source/latex/liturgy-cw/liturgy-cw.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2025 Dimitri Theulings <[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.3c
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.3c or later is part of all distributions of LaTeX
14 % version 2008-05-04 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %<*driver>
20 \ProvidesFile{liturgy-cw.dtx}
21 %</driver>
22 %<package>\NeedsTeXFormat{LaTeX2e}[2020-02-02]
23 %<package>\ProvidesPackage{liturgy-cw}
24 %<*package>
25 [2025-08-13 v0.3 LaTeX package for typesetting Common Worship liturgies]
26 %</package>
27 %
28 %<*driver>
29 \documentclass{ltxdoc}
30 \usepackage{liturgy-cw}[2025-08-13]
31 \usepackage{xcolor}
32 \usepackage{verse}
33 \usepackage[most]{tcolorbox}
34 \newtcolorbox{resultbox}{%
35 left=3pt, top=3pt, bottom=3pt,
36 before skip=11pt, after skip=11pt, arc=1mm,
37 borderline={0.5pt}{0pt}{black},colback=white, colframe=white}
38 \newtcblisting{commandbox}{%
39 breakable,enhanced,verbatim ignore percent,
40 left=3pt, top=3pt, bottom=3pt,
41 before skip=11pt, after skip=11pt, arc=1mm,
42 borderline={0.5pt}{0pt}{black},colback=blue!10!white,colframe=blue!50!black,
43 listing only,
44 listing options={style=tcblatex,inputencoding=utf8,basicstyle=\ttfamily\small}}
45 \EnableCrossrefs
46 \RecordChanges
47 \begin{document}
48 \OnlyDescription
49 \DocInput{liturgy-cw.dtx}
50 \PrintChanges
51 \PrintIndex
52 \end{document}
53 %</driver>
54 % \fi
55 %
56 % \changes{v0.1}{2025-05-02}{Initial version}
57 % \changes{v0.2}{2025-06-03}{Initial release}
58 % \changes{v0.3}{2025-08-13}{Minor improvements}
59 %
60 % \GetFileInfo{liturgy-cw.dtx}
61 %
62 % \title{The \textsf{liturgy-cw} package\thanks{This document
63 % relates to \textsf{liturgy-cw}~\fileversion, last revised \filedate.}}
64 % \author{Dimitri Theulings \\ \small\texttt{[email protected]} \\
65 % \small\texttt{https://github.com/dimitrit/liturgy-cw}}
66 %
67 % \maketitle
68 %
69 % \begin{abstract}
70 % The \textsf{liturgy-cw} package greatly simplifies the typesetting of
71 % service sheets and booklets in the style of the Common Worship liturgical
72 % resources of the Church~of~England. The package provides commands for a
73 % number of liturgical elements, including rubrics, responsories and
74 % `required part' indicators.
75 % \end{abstract}
76 %
77 % \section{Introduction}
78 %
79 % For the past quarter century \textit{Common Worship Prayers and Services}\cite{commonworship}
80 % has been the authorised liturygy for worship in the Church of England.
81 % For practical and (not least) financial reasons many churches have produced
82 % their own service sheets and booklets. These materials are often created
83 % using widely available word processing and desktop publishing software
84 % packages with varying success.
85 %
86 % The \textsf{liturgy-cw} package arose from the need to create service
87 % sheets and booklets quickly and easily, while ensuring these retain a
88 % consistent visual style that is familiar to both worshipers and service
89 % leaders. Given the familiarity that these users have with the visual style
90 % of Common Worship made its design the obvious target for this package.
91 %
92 % Morgan's account of the making of Common Worship\cite{morgan} details
93 % the design, together with rationales for various decisions that had to
94 % be made in its implementation. While the \textsf{liturgy-cw} package
95 % falls far short of an exact, or even complete, implementation of this
96 % design, it should nevertheless prove useful in fulfilling its basic
97 % objectives.
98 %
99 % \section{Limitations}
100 %
101 % Because of its dependencies, including \textsf{fontspec}, the
102 % \textsf{liturgy-cw} package requires Lua\TeX\ or other supported
103 % \TeX\ engine to function.
104 %
105 % For best results you should have both \textit{Gill Sans MT} and
106 % \textit{Noto Sans Liturgy} fonts installed on your system. The latter
107 % is required for the symbol functions, |\Rx|, |\Pause| and |\Cross|.
108 %
109 % \section{Bug reports and feature requests}
110 % \label{repo}
111 % The source code, together with instructions for building and installing
112 % the package, can be found on github;
113 % \url{https://github.com/dimitrit/liturgy-cw}.
114 % Please raise a github issue if you find any bugs or would like to suggest
115 % a new feature.
116 %
117 % \section{Package documentation}
118 %
119 % \subsection{Basic usage}
120 % The \textsf{liturgy-cw} package provides functions and environments to
121 % create service booklets and sheets in the style of Common Worship. The
122 % simple example below typesets the contemporary version of the Lord's
123 % prayer as a `required part'. A comprehensive example, `\textit{An
124 % Order for Night Prayer (Compline)}' is included in the source repository.
125 %
126 % \vspace*{1ex}
127 %
128 % \noindent\begin{commandbox}
129 % \begin{required}
130 % \rubric{The Lord's Prayer is said}
131 %
132 % \minister{
133 % Rejoicing in God’s new creation,\\
134 % as our Saviour taught us, so we pray}
135 % \lpc
136 % \end{required}
137 % \end{commandbox}
138 %
139 % \vspace*{1ex}
140 %
141 % \noindent\begin{resultbox}
142 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
143 % \setlength\vbarhskip{-3pt}
144 % \begin{required}
145 % \rubric{The Lord's Prayer is said}
146 %
147 % \minister{Rejoicing in God’s new creation,\\
148 % as our Saviour taught us, so we pray}
149 % \lpc
150 % \end{required}
151 % \end{resultbox}
152 %
153 % \subsection{Commands for typesetting liturgies}
154 %
155 % \subsubsection{Environments}
156 % \DescribeEnv{required}
157 % Required parts of Common Worship liturgy are indicated by a vertical red
158 % bar. The |required| environment can be used to mark such sections. The
159 % position of the vertical bar is defined by |\vbarhskip|.
160 %
161 % \subsubsection{Functions}
162 % \DescribeMacro{rubric}
163 % The |\rubric|\marg{directive} function adds a direction for the conduct of
164 % the service in red, italicised print. For example:
165 %
166 % \vspace*{1ex}
167 %
168 % \noindent\begin{commandbox}
169 % \rubric{The appointed psalmody is said.}
170 % \end{commandbox}
171 %
172 % \vspace*{1ex}
173 %
174 % \noindent\begin{resultbox}
175 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
176 % \rubric{The appointed psalmody is said.}
177 % \end{resultbox}
178 %
179 % \DescribeMacro{minister}
180 % Words spoken by clergy are included using the |\minister|\oarg{role}\marg{words}
181 % function. Using the optional \textit{role} argument it is possible to specify
182 % a ministry role, for example:
183 %
184 % \vspace*{1ex}
185 %
186 % \noindent\begin{commandbox}
187 % \minister[President]{%
188 % The harvest of the Spirit is love, joy and peace.\\
189 % The peace of the Lord be always with you}
190 % \all{and also with you.}
191 %
192 % \minister[Deacon]{Let us offer one another a sign of peace.}
193 % \end{commandbox}
194 %
195 % \vspace*{1ex}
196 %
197 % \noindent\begin{resultbox}
198 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
199 % \minister[President]{The harvest of the Spirit is love, joy and peace.\\
200 % The peace of the Lord be always with you}
201 % \all{and also with you.}
202 %
203 % \minister[Deacon]{Let us offer one another a sign of peace.}
204 % \end{resultbox}
205 %
206 % \DescribeMacro{all}
207 % |\all|\marg{words} is used to highlight the words that are to be spoken by
208 % the whole congregation. Words are printed in bold, preceded by the italicised
209 % word \textit{All} in red, printed in the margin. The \textit{All} directive
210 % is omitted when using the starred version, |\all*|\marg{words}, as shown in
211 % the example:
212 %
213 % \vspace*{1ex}
214 %
215 % \noindent\begin{commandbox}
216 % \minister{Lord, hear us.}
217 % \all*{Lord, graciously hear us.}
218 % \end{commandbox}
219 %
220 % \vspace*{1ex}
221 %
222 % \noindent\begin{resultbox}
223 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
224 % \minister{Lord, hear us.}
225 % \all*{Lord, graciously hear us.}
226 % \end{resultbox}
227 %
228 % \subsubsection{Symbols}
229 % The symbol functions require the \textit{Noto Sans Liturgy} font to be
230 % installed on your system. This font can be downloaded from the package
231 % source repository (see `\textit{Bug reports and feature requests}' on page
232 % \pageref{repo}).
233 %
234 % \DescribeMacro{Cross} The \Cross\ symbol can be included in the liturgy
235 % using |\Cross|:
236 %
237 % \vspace*{1ex}
238 %
239 % \noindent\begin{commandbox}
240 % \textit{N}, I baptize you\\
241 % in the name of the Father, \Cross\\
242 % and of the Son,\\
243 % and of the Holy Spirit.
244 % \end{commandbox}
245 %
246 % \vspace*{1ex}
247 %
248 % \noindent\begin{resultbox}
249 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
250 % \textit{N}, I baptize you\\
251 % in the name of the Father, \Cross\\
252 % and of the Son,\\
253 % and of the Holy Spirit.
254 % \end{resultbox}
255 %
256 % \DescribeMacro{Pause}
257 % \DescribeMacro{Rx} In the Common Worship Psalter pauses and refrains are
258 % indicated using the \Pause\ and \Rx\ symbols respectively. Support for
259 % these symbols is provided through the |\Pause| and |\Rx| functions:
260 %
261 % \vspace*{1ex}
262 %
263 % \noindent\begin{commandbox}
264 % \textit{\textcolor{red}{Refrain:} The Lord shall keep you from all evil.}
265 % \begin{verse}
266 % \flagverse{1}I lift up my eyes to the hills; \Pause \\
267 % from where is my help to come?
268 %
269 % \flagverse{2}My help comes from the Lord, \Pause \\
270 % the maker of heaven and earth.
271 %
272 % \flagverse{3}He will not suffer your foot to stumble; \Pause \\
273 % he who watches over you will not sleep.
274 %
275 % \flagverse{4}Behold, he who keeps watch over Israel \Pause \\
276 % shall neither slumber nor sleep. \Rx
277 %
278 % \flagverse{5}The Lord himself watches over you; \Pause \\
279 % the Lord is your shade at your right hand,
280 %
281 % \flagverse{6}So that the sun shall not strike you by day, \Pause \\
282 % neither the moon by night.
283 %
284 % \flagverse{7}The Lord shall keep you from all evil; \Pause \\
285 % it is he who shall keep your soul.
286 %
287 % \flagverse{8}The Lord shall keep watch over your going out \\
288 % \vin and your coming in, \Pause \\
289 % from this time forth for evermore.
290 % \end{verse}
291 % \end{commandbox}
292 %
293 % \vspace*{1ex}
294 %
295 % \noindent\begin{resultbox}
296 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
297 % \textit{\textcolor{red}{Refrain:} The Lord shall keep you from all evil.}
298 % \begin{verse}
299 % \flagverse{1}I lift up my eyes to the hills; \Pause \\
300 % from where is my help to come?
301 %
302 % \flagverse{2}My help comes from the Lord, \Pause \\
303 % the maker of heaven and earth.
304 %
305 % \flagverse{3}He will not suffer your foot to stumble; \Pause \\
306 % he who watches over you will not sleep.
307 %
308 % \flagverse{4}Behold, he who keeps watch over Israel \Pause \\
309 % shall neither slumber nor sleep. \Rx
310 %
311 % \flagverse{5}The Lord himself watches over you; \Pause \\
312 % the Lord is your shade at your right hand,
313 %
314 % \flagverse{6}So that the sun shall not strike you by day, \Pause \\
315 % neither the moon by night.
316 %
317 % \flagverse{7}The Lord shall keep you from all evil; \Pause \\
318 % it is he who shall keep your soul.
319 %
320 % \flagverse{8}The Lord shall keep watch over your going out \\
321 % \vin and your coming in, \Pause \\
322 % from this time forth for evermore.
323 % \end{verse}
324 % \end{resultbox}
325 %
326 % \subsubsection{Shortcuts}
327 % A number of shortcuts are provided for frequently used liturical elements.
328 % Two versions are provided for each shortcut. The standard version of each
329 % shortcut typesets the liturgical element as spoken the whole congregation,
330 % i.e. in bold print, preceded by \textit{All}. The starred version typesets
331 % the plain text, as shown below.
332 %
333 % \DescribeMacro{amen} Declaration of affirmation:
334 % {\setmainfont[Ligatures=TeX]{Gill Sans MT}\amen*}
335 %
336 % \DescribeMacro{glorybe} Lesser doxology:
337 %
338 % \vspace*{1ex}
339 %
340 % \noindent\begin{resultbox}
341 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
342 % \glorybe*
343 % \end{resultbox}
344 %
345 % \DescribeMacro{lpc} The contemporary version of the Lord's prayer:
346 %
347 % \vspace*{1ex}
348 %
349 % \noindent\begin{resultbox}
350 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
351 % \lpc*
352 % \end{resultbox}
353 %
354 % \DescribeMacro{lpt} The traditional version of the Lord's prayer:
355 %
356 % \vspace*{1ex}
357 %
358 % \noindent\begin{resultbox}
359 % \setmainfont[Ligatures=TeX]{Gill Sans MT}
360 % \lpt*
361 % \end{resultbox}
362 %
363 % \subsection{Options}
364 % Default formatting options can be applied using
365 % |\usepackage|\oarg{options}|{literature-cw}|.
366 %
367 % \DescribeMacro{font} Sets the document font to Gill Sans MT. If this
368 % typeface is not available on the system, the package will attempt to use
369 % Lato as an alternative. An error will result with this option if neither
370 % of these typefaces are available on the system.
371 %
372 % \DescribeMacro{titles} Formats chapter, section, and subsection titles in
373 % line with the Common Worship design. Note that as chapters, sections, etc.
374 % are not numbered in Common Worship, it is best to use the starred versions
375 % of title commands, i.e |\chapter*|, |\section*|, etc.
376 %
377 % \StopEventually{%
378 % \begin{thebibliography}{1}
379 % \bibitem{commonworship}
380 % \textsc{Church of England}.
381 % \newblock \textit{Common Worship: Services and Prayers for the Church of England}.
382 % \newblock Church House Publishing, London, 2000.
383 % \bibitem{morgan}
384 % \textsc{John Morgan}.
385 % \newblock \textit{An account of the making of Common worship: services and prayers for the Church of England} (Typography papers 5).
386 % \newblock Department of Typography \& Graphic Communication, University of Reading, 2022/2003.
387 % \end{thebibliography}
388 % }
389 % \begin{macrocode}
390 \RequirePackage{array}
391 \RequirePackage{bibleref}
392 \RequirePackage{booktabs}
393 \RequirePackage{calc}
394 \RequirePackage{fontspec}
395 \RequirePackage{geometry}
396 \RequirePackage{framed}
397 \RequirePackage[pagestyles]{titlesec}
398 \RequirePackage{xcolor}
399
400 %% The typeface used in Common Worship is Monotype Gill Sans.
401 \DeclareOption{font}{
402 \IfFontExistsTF{Gill Sans MT}{
403 \setmainfont[Ligatures=TeX]{Gill Sans MT}
404 }{
405 \PackageWarning{liturgy-cw}{%
406 The Gill Sans MT typeface is not available on this system; falling back to Lato.}
407 \setmainfont[Ligatures=TeX]{Lato}
408 }
409 }
410 \DeclareOption{titles}{
411 \ifdefined\chapter
412 \newlength{\@cwpw}
413 \settowidth{\@cwpw}{\huge\P}
414 \titleformat{\chapter}[display]
415 {\huge\color{red}}{\thechapter}{0pt}{\hspace*{\dimexpr-\@cwpw+10mm}\P\hspace*{5mm}\itshape\begin{minipage}[t]{\linewidth-15mm}}[\end{minipage}]
416 \titlespacing{\chapter}{0pt}{1\baselineskip plus .333\baselineskip minus .125\baselineskip}{0pt plus .125\baselineskip minus .125\baselineskip}
417
418 \let\@cwchapter\chapter
419 \renewcommand{\chapter}{\@ifstar{\@cwchapter*}{\@cwchapter*}}
420 \else
421 \PackageWarning{liturgy-cw}{chapter not defined; skipping.}
422 \fi
423 \newcommand{\@cwpadright}[1]{#1\hspace*{15mm}}
424 \titleformat{\section}
425 {\large\raggedleft\bfseries}{\thesection}{0pt}{\@cwpadright}
426 \titlespacing{\section}{0pt}{1\baselineskip plus .333\baselineskip minus .125\baselineskip}{0pt plus .125\baselineskip minus .125\baselineskip}
427
428 \titleformat{\subsection}
429 {\large\raggedleft\color{red}\itshape}{\thesubsection}{0pt}{\@cwpadright}
430 \titlespacing{\subsection}{0pt}{1\baselineskip plus .333\baselineskip minus .125\baselineskip}{0pt plus .125\baselineskip minus .125\baselineskip}
431
432 \titleformat{\subsubsection}
433 {\bfseries}{\thesubsubsection}{0pt}{}
434 \titlespacing{\subsubsection}{15mm}{1\baselineskip plus .333\baselineskip minus .125\baselineskip}{0pt plus .125\baselineskip minus .125\baselineskip}
435
436 \let\@cwsection\section
437 \renewcommand{\section}{\@ifstar{\@cwsection*}{\@cwsection*}}
438
439 \let\@cwsubsection\subsection
440 \renewcommand{\subsection}{\@ifstar{\@cwsubsection*}{\@cwsubsection*}}
441
442 \let\@cwsubsubsection\subsubsection
443 \renewcommand{\subsubsection}{\@ifstar{\@cwsubsubsection*}{\@cwsubsubsection*}}
444
445 \newpagestyle{cwstyle}{\setfoot[\thepage][][]{}{}{\thepage}}
446 \pagestyle{cwstyle}
447 }
448 \ProcessOptions\relax
449
450 \NewDocumentCommand{\all}{sm}{%
451 \ignorespaces\noindent\strut\IfBooleanTF#1%
452 {\hspace*{15mm}}%
453 {\parbox[t]{10mm}%
454 {\raggedleft\normalfont\textcolor{red}{\textit{All}}}%
455 \hspace*{5mm}}%
456 \begin{minipage}[t]{\dimexpr\linewidth-15mm}%
457 \bfseries #2
458 \end{minipage}\ignorespacesafterend}
459
460 \def\changemargin#1#2{\list{}{\topsep0pt\parskip0pt\partopsep0pt\parsep0pt\itemsep0pt\rightmargin#2\leftmargin#1}\item[]}
461 \let\endchangemargin=\endlist
462
463 \newcommand{\attrib}[2][15mm]{%
464 \nopagebreak{\raggedleft\itshape #2\hspace*{#1}\par}}
465
466 \NewDocumentCommand{\minister}{O{}m}{%
467 \ignorespaces\noindent\begin{changemargin}{-15mm}{0mm}\item[]%
468 \parbox[t]{25mm}%
469 {\raggedleft\normalfont\textcolor{red}{\textit{#1}}}%
470 \hspace*{5mm}%
471 \begin{minipage}[t]{\dimexpr\linewidth-15mm}%
472 \normalfont #2
473 \end{minipage}\strut\end{changemargin}\ignorespacesafterend}
474
475 \NewDocumentCommand{\rubric}{m}{%
476 \noindent\hspace*{15mm}\begin{minipage}[t]{\dimexpr\linewidth-15mm}%
477 {\textcolor{red}{\itshape #1}}
478 \end{minipage}\strut}
479
480 \NewDocumentCommand{\alternative}{}{\rubric{\textit{(or)}}}
481 %% Shortcuts
482 \NewDocumentCommand{\amen}{s}{%
483 \IfBooleanTF#1%
484 {Amen.}%
485 {\all{\amen*}}%
486 }
487 \NewDocumentCommand{\glorybe}{s}{%
488 \IfBooleanTF#1%
489 {Glory to the Father and to the Son\\
490 and to the Holy Spirit;\\
491 as it was in the beginning is now\\
492 and shall be for ever. \amen*}%
493 {\all{\glorybe*}}%
494 }
495 \NewDocumentCommand{\lpt}{s}{%
496 \IfBooleanTF#1%
497 {Our Father, who art in heaven,\\
498 hallowed be thy name;\\
499 thy kingdom come;\\
500 thy will be done;\\
501 on earth as it is in heaven.\\
502 Give us this day our daily bread.\\
503 And forgive us our trespasses,\\
504 as we forgive those who trespass against us.\\
505 And lead us not into temptation;\\
506 but deliver us from evil.\\
507 For thine is the kingdom,\\
508 the power and the glory,\\
509 for ever and ever.\\
510 \amen*}%
511 {\all{\lpt*}}%
512 }
513 \NewDocumentCommand{\lpc}{s}{%
514 \IfBooleanTF#1%
515 {Our Father in heaven,\\
516 hallowed be your name,\\
517 your kingdom come,\\
518 your will be done,\\
519 on earth as in heaven.\\
520 Give us today our daily bread.\\
521 Forgive us our sins\\
522 as we forgive those who sin against us.\\
523 Lead us not into temptation\\
524 but deliver us from evil.\\
525 For the kingdom, the power,\\
526 and the glory are yours\\
527 now and for ever.\\
528 \amen*}%
529 {\all{\lpc*}}%
530 }
531
532 \newlength{\vbarhskip}
533 \setlength\vbarhskip{-51pt}
534 \newenvironment{required}{%
535 \def\FrameCommand{%
536 {\hskip\vbarhskip\color{red}\vrule width 3pt}%
537 \fboxsep=\FrameSep\hspace{\dimexpr\vbarhskip*-1-3pt}%
538 }%
539 \MakeFramed{\advance\hsize-\width\FrameRestore}%
540 }
541 {\endMakeFramed}
542
543 \IfFontExistsTF{Noto Sans Liturgy}{%
544 \newfontface{\nsl}{Noto Sans Liturgy}
545 \NewDocumentCommand{\Rx}{}{{\nsl\itshape\textcolor{red}{\char"211E}}}
546 \NewDocumentCommand{\Pause}{}{{\nsl\textcolor{red}{\char"2666}}}
547 \NewDocumentCommand{\Cross}{}{{\nsl\textcolor{red}{\char"2720}}}
548 }{
549 \PackageWarning{liturgy-cw}{%
550 The Noto Sans Liturgy typeface is not available on this system which
551 means liturgical symbols are not defined.}
552 }
553
554 \newbiblerefstyle{cw}{ % Common Worship reference style
555 \biblerefstyle{default}
556 \renewcommand{\BRchvsep}{.}
557 \renewcommand{\BRvrsep}{--}
558 }
559
560 \biblerefstyle{cw}
561
562 \setlength{\parindent}{0pt}
563 % \end{macrocode}
564 %
565 % \Finale
566 \endinput