summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/classics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/classics
Initial commit
Diffstat (limited to 'macros/latex/contrib/classics')
-rw-r--r--macros/latex/contrib/classics/README29
-rw-r--r--macros/latex/contrib/classics/classics.pdfbin0 -> 205811 bytes
-rw-r--r--macros/latex/contrib/classics/classics.sty146
-rw-r--r--macros/latex/contrib/classics/classics.tex296
4 files changed, 471 insertions, 0 deletions
diff --git a/macros/latex/contrib/classics/README b/macros/latex/contrib/classics/README
new file mode 100644
index 0000000000..0369f2472e
--- /dev/null
+++ b/macros/latex/contrib/classics/README
@@ -0,0 +1,29 @@
+Package: classics
+Description: Cite classic works
+
+This package provides a basic framework to cite classic works in accordance
+with traditional pagination systems. It can also be used in conjunction with
+other citation packages.
+
+2013/02/02 v0.1
+ Initial version
+
+--------------------------------------------------------------------------------
+Installation:
+
+*Copy classics.sty to a location where LaTeX will find it.
+ See http://www.tex.ac.uk/faq
+
+--------------------------------------------------------------------------------
+Usage:
+
+*See classics.pdf
+
+--------------------------------------------------------------------------------
+Copyright (C) 2013 Eduardo C. Lourenço de Lima
+
+This material is subject to the LaTeX Project Public License. See
+http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+for the details of that license
+
+This work has the LPPL maintenance status "author-maintained"
diff --git a/macros/latex/contrib/classics/classics.pdf b/macros/latex/contrib/classics/classics.pdf
new file mode 100644
index 0000000000..89f6e16b4a
--- /dev/null
+++ b/macros/latex/contrib/classics/classics.pdf
Binary files differ
diff --git a/macros/latex/contrib/classics/classics.sty b/macros/latex/contrib/classics/classics.sty
new file mode 100644
index 0000000000..6c8a413ac6
--- /dev/null
+++ b/macros/latex/contrib/classics/classics.sty
@@ -0,0 +1,146 @@
+%% Copyright (C) 2013 Eduardo C. Lourenço de Lima
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any later
+%% version. The latest version of this license is in
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%\NeedsTeXFormat{LaTeX2e}[1996/06/01]
+\RequirePackage{expl3}
+\RequirePackage{xparse}
+\ProvidesExplPackage {classics} {2013/02/02} {0.1} {Cite classic works}
+
+\tl_new:N \g_classics_style_range_separator_tl
+\tl_new:N \g_classics_style_separator_tl
+
+\tl_set:Nn \g_classics_style_range_separator_tl {--}
+\tl_set:Nn \g_classics_style_separator_tl {|}
+
+\bool_new:N \g__classics_plural_prefix_bool
+
+\cs_generate_variant:Nn \seq_set_split:Nnn {cVn}
+
+% * [<range separator>] {<basename>} {<code>}
+
+\NewDocumentCommand \newclassic {somm}
+ {
+
+ \seq_new:c {g_classics_#3_style_seq}
+ \tl_new:c {g_classics_#3_range_separator_tl}
+
+ \IfValueTF {#2}
+ {\tl_set:cn {g_classics_#3_range_separator_tl} {#2}}
+ {\tl_set:cn {g_classics_#3_range_separator_tl} {\tl_use:N \g_classics_style_range_separator_tl}}
+
+ \classics_style_set:nn {#3} {#4}
+
+% * (<last page>) [<title>] {<page>} [<section>]
+
+ \exp_after:wN \NewDocumentCommand \cs:w #3\cs_end: { sd()omO{}O{}O{}O{}O{} }
+ {
+
+ %Title: Typeset the optional title
+ \IfValueT {##3}
+ {
+ \group_begin:
+ \frenchspacing \classics_title_format:n {##3}
+ \tl_if_blank:nTF {##4} {}{~}
+ \group_end:
+ }
+
+ %Range: Typeset page when last page is provided only if they differ
+ \bool_if:nTF { (! #1) && \str_if_eq_x_p:nn{##2}{##4} }
+ {
+ \classics_style_map:nnnnnnn{#3} {} {##5}{##6}{##7}{##8}{##9}
+ }
+ {
+ \classics_style_map:nnnnnnn{#3}{##4}{##5}{##6}{##7}{##8}{##9}
+ }
+
+ %Starred:
+ \IfBooleanT {##1} {\tl_use:c {g_classics_#3_range_separator_tl}\cs:w #3\cs_end:(##4)}
+
+ }
+ }
+
+% {<code>}
+
+\NewDocumentCommand \DeclareClassicWorkFormat {m} {\cs_set:Npn \classics_title_format:n ##1 {#1}}
+
+% {<string>}
+
+\cs_new:Npn \classics_title_format:n #1 {\textit{#1}}
+
+% {<basename>} {<string>}
+
+\cs_new:Npn \classics_style_set:nn #1#2
+ {
+ \seq_set_split:cVn {g_classics_#1_style_seq} \g_classics_style_separator_tl {#2}
+ }
+
+% {<basename>} {<value>}
+
+\cs_new:Npn \classics_style_map:nnnnnnn #1#2#3#4#5#6#7
+ {
+ \seq_set_split:Nnn \l_tmpa_seq {} {{#2} {#3} {#4} {#5} {#6} {#7}}
+
+ \cs_generate_variant:Nn \seq_mapthread_function:NNN {cNN}
+ \seq_mapthread_function:cNN {g_classics_#1_style_seq} \l_tmpa_seq \classics_style_apply:nn
+ }
+
+% {<style>} {<value>}
+
+\cs_new:Npn \classics_style_apply:nn #1#2
+ {
+ \tl_if_blank:nTF {#2}
+ {}
+ {
+ \cs_set:Npn \__classics_style_apply:n ##1 {#1}
+ \__classics_style_apply:n {#2}
+ }
+ }
+
+% {<code>}
+
+\cs_new:Npn \__classics_style_apply:n #1 {}
+
+% ********************************** Misc *************************************
+
+\NewDocumentCommand \classicsalph {m} {\int_to_alph:n {#1}}
+\NewDocumentCommand \classicsAlph {m} {\int_to_Alph:n {#1}}
+\NewDocumentCommand \classicsroman {m} {\int_to_roman:n{#1}}
+\NewDocumentCommand \classicsRoman {m} {\int_to_Roman:n{#1}}
+
+% ------------------------------ Plural prefix --------------------------------
+
+% {<command>} {<singular>} {<plural>} {<and>}
+
+\NewDocumentCommand \newpagination {mmmm}
+ {
+% \exp_after:wN \NewDocumentCommand \cs:w #1\cs_end: {m}
+ \NewDocumentCommand #1 {m}
+ {
+ \classics_plural_prefix:nnnn {#2} {#3} {#4} {##1}
+ {~##1}
+ }
+ }
+
+% {<singular>} {<plural>} {<and>} {<string>}
+
+\cs_new:Npn \classics_plural_prefix:nnnn #1#2#3#4
+ {
+ \bool_set_false:N \g__classics_plural_prefix_bool
+
+ \tl_if_in:nnT {#4} {#3} {\bool_set_true:N \g__classics_plural_prefix_bool}
+ \tl_if_in:nnT {#4} {-} {\bool_set_true:N \g__classics_plural_prefix_bool}
+ \tl_if_in:nnT {#4} {,} {\bool_set_true:N \g__classics_plural_prefix_bool}
+
+ \bool_if:nTF \g__classics_plural_prefix_bool {#2} {#1}
+ }
+
+\endinput
diff --git a/macros/latex/contrib/classics/classics.tex b/macros/latex/contrib/classics/classics.tex
new file mode 100644
index 0000000000..978283d489
--- /dev/null
+++ b/macros/latex/contrib/classics/classics.tex
@@ -0,0 +1,296 @@
+% Copyright (C) 2013 Eduardo C. Lourenço de Lima
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3 of this license or (at your option) any later
+% version. The latest version of this license is in
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+\documentclass{ltxdoc}
+
+\newcommand\fileversion{0.1}
+\newcommand\filedate{February 2, 2013}
+
+\usepackage{color}
+\usepackage{classics}
+
+\newpagination \books {book} {books} { and }
+\newpagination \parts {part} {parts} { and }
+\newpagination \sections {section} {sections} { and }
+\newpagination \lines {line} {lines} { and }
+
+\newclassic[ to ]{Homer} {\books{\classicsRoman{#1}}|, \lines{#1}}
+\newclassic{Plato} {#1|#1|#1}
+\newclassic{Aristotle} {#1|\textit{#1}|#1}
+\newclassic{Stephanus} {#1|\textit{#1}|#1}
+\newclassic{Bekker} {#1|\textit{#1}|#1}
+\newclassic{Hume} {#1|.#1|.#1}
+\newclassic{HumeExample} {\books{#1}|, \parts{#1}|, \sections{#1}}
+\newclassic{HomerExample} {\books{\classicsRoman{#1}}|, \lines{#1}}
+
+\definecolor{myblue}{rgb}{0,0.2,0.6}
+
+\newenvironment {Macros} {\begin{list}{}{\setlength\itemsep{0pt}\setlength\leftmargin{0pt}}}{\end{list}}
+\newcommand\Macro [2] {\item[\llap{\textsf{\color{myblue}\texttt{\char92}#1}}]#2}
+\newcommand\MacroExample [2] {\item[\llap{\textsf{\texttt{\char92}#1}}]#2}
+\newcommand\Note {\par\textbf{Note:} }
+\newcommand\etc {\mbox{etc.}}
+\newcommand\work [1] {\textit{#1}}
+\newcommand\badcite [1] {\begingroup(\frenchspacing #1)\endgroup}
+
+\begin{document}
+\title{The \textsf{\color{myblue} classics} package,\thanks{This document
+corresponds to \textsf{classics}~\fileversion, dated~\filedate. I am grateful
+to Joseph Wright and Scott \mbox{H.} for suggestions.}\\{or the end of
+anachronism}}
+\author{Eduardo C. Louren\c{c}o de Lima \\ \texttt{elourenco@phi.pro.br}}
+\maketitle
+
+
+ \begin{abstract}\noindent This package provides a basic framework to
+ cite classic works in accordance with traditional pagination systems.
+ It can also be used in conjunction with other citation
+ packages.\end{abstract}
+
+ \section*{Introduction}
+
+If you feel there is something wrong with ``Plato \badcite{1994: pp. 50--1}'',
+``Aristotle \badcite{\work{Ethics}, 44}'' or ``Hume \badcite{2000: 303}'', this
+package is for you. The |classics| package provides a basic framework to cite
+classic works in compliance with traditional pagination systems. For example:
+ \begin{list}{}{\setlength\itemsep{0pt}\setlength\parskip{0pt}}
+ \item[]\Stephanus [Theaetetus] {142}[d][4--5]
+ \item[]\Bekker* [Nic. Eth.] {1179}[b][14]{1180}[a][29]
+ \item[]\Hume[THN]{3}[1][2]
+ \end{list}
+Citation commands created by |classics| can also be used in conjunction with
+other citations engines such as standard |\cite|, |biblatex|, |natbib|, \etc
+
+ \section{Synopsis}
+
+
+\begin{Macros}
+\Macro{newclassic}{\oarg{range separator} \marg{classic} \marg{list of formatting directives}}
+\Macro{|<|classic|>| }{\oarg{work} \marg{page} \oarg{section}}
+\Macro{|<|classic|>*|}{\oarg{work} \marg{page} \oarg{section} \marg{last page} \oarg{section}}
+\Macro{newpagination}{\marg{pagination} \marg{singular} \marg{plural} \marg{conjunction}}
+\Macro{|<|pagination|>|}{\marg{range}}
+\Macro{DeclareClassicWorkFormat}{\marg{formatting directive}}
+
+\end{Macros}
+
+\newpage
+
+ \section{Basic usage}
+
+\setlength\parindent{0pt}
+\setlength\parskip{1ex}
+
+ \begin{Macros}
+ \Macro{newclassic}{\oarg{range separator} \marg{classic} \marg{list of formatting directives}}
+ \end{Macros}
+
+Creates a citation command |\|\meta{classic} based on a \meta{list of
+formatting directives} separated by vertical bars. Each formatting directive
+has its own |#1| and is used to declare the format in which to typeset the
+reference to a subdivision of a classic work. There can be at most six such
+directives. As an example:
+
+ \begin{verbatim}\newclassic {Aristotle} {#1|\textit{#1}|#1}\end{verbatim}
+would create a new citation command |\Aristotle|:
+
+ \begin{Macros}
+ \MacroExample{Aristotle}{\oarg{work} \marg{page} \oarg{column} \oarg{line}}
+ \MacroExample{Aristotle*}{\oarg{work} \marg{page} \oarg{column} \oarg{line} \marg{last page} \oarg{column} \oarg{line}}
+ \end{Macros}
+to typeset references in which letters for \meta{column} are printed in italic
+type. The starred version |\Aristotle*| is used to cite a range of two pages
+separated by \meta{range separator}.
+
+\Note |\Aristotle*| will not typeset \meta{last page} if \meta{page} and
+\meta{last page} are the same. However, \meta{last page} will be preserved if
+|\Aristotle*| is created by the starred version |\newclassic*|.
+
+ \begin{Macros}
+ \Macro{newpagination} \marg{pagination} \marg{singular} \marg{plural} \marg{conjunction}
+ \end{Macros}
+
+Creates a command \meta{pagination} to typeset \meta{singular} or \meta{plural}
+depending on whether subsequent arguments to \meta{pagination} are
+singular or plural. As an example:
+
+\begin{verbatim}\newpagination {\pages} {page} {pages} { and }\end{verbatim}
+would create the command |\pages|:
+ \begin{Macros}
+ \MacroExample{pages} \marg{range}
+ \end{Macros}
+
+that automatically typesets |page| \meta{range} if \meta{range} is singular, or
+|pages| \meta{range} if \meta{range} is plural, that is, if it contains a
+comma, a hyphen, a dash, or \meta{conjunction}.
+
+{\Note} \meta{conjunction} might need to be enclosed in spaces.
+
+ \begin{Macros}
+ \Macro{DeclareClassicWorkFormat}{\marg{formatting directive}}
+ \end{Macros}
+Defines the format to typeset classic titles in. The default \meta{formatting directive} is |\textit{#1}|.
+
+\newpage
+
+ \begin{Macros}
+ \Macro{classicsalph}{\marg{integer}}
+ \Macro{classicsAlph}{\marg{integer}}
+ \Macro{classicsroman}{\marg{integer}}
+ \Macro{classicsRoman}{\marg{integer}}
+ \end{Macros}
+
+These commands may come in handy if you want to typeset a subdivision as a
+letter or Roman numeral, lowercase or uppercase.
+
+ \section{Advanced usage}
+
+\begingroup
+\DeclareClassicWorkFormat{\textit{#1},}
+
+You may combine |\newclassic| and |\newpagination| to create complex
+citation styles. For example:
+ \begin{Macros}
+ \Macro{Hume}{\oarg{work} \marg{book} \oarg{part} \oarg{section}}
+ \end{Macros}
+can be created by:
+ \begin{verbatim}
+\DeclareClassicWorkFormat{\textit{#1},}
+\newpagination {\books} {book} {books} { and }
+\newpagination {\parts} {part} {parts} { and }
+\newpagination {\sections} {section} {sections} { and }
+\newclassic {Hume} {\books{#1}|, \parts{#1}|, \sections{#1}}
+\end{verbatim}
+so that: \begin{verbatim}\Hume[Treatise]{3}[1][2]\end{verbatim}would typeset
+``\HumeExample[Treatise]{3}[1][2]''.
+
+\begin{Macros}
+\Macro{Homer}{\oarg{work} \marg{book} \oarg{lines}}
+\end{Macros}
+can be created by:
+
+\begin{verbatim}
+\DeclareClassicWorkFormat{\textit{#1},}
+\newpagination {\books} {book} {books} { and }
+\newpagination {\lines} {line} {lines} { and }
+\newclassic {Homer} {\books{\classicsRoman{#1}}|, \lines{#1}}
+\end{verbatim}
+so that:
+\begin{verbatim}\Homer[Odyssey]{3}[100--2]\end{verbatim}
+will typeset: ``\HomerExample[Odyssey]{3}[100--2]''.
+\endgroup
+
+
+ \subsection{Caveat}
+
+Citation styles created by the |classics| package can also be used in
+conjunction with standard |\cite|, |biblatex|, |natbib|, \etc
+
+A simple |classics| pagination command created by |\newpagination| can be used
+directly within the optional argument to |\cite|:
+
+\begin{Macros}
+\Macro{cite} |[\pages|\marg{number}|]| \marg{key}
+\end{Macros}
+
+However, a complex |classics| citation command created by |\newclassic| can be
+used within the optional argument to |\cite| only if it is enclosed in braces.
+
+\begin{Macros}
+\Macro{cite} |[{\Homer|\marg{book}\oarg{line}|}]| \marg{key}
+\end{Macros}
+
+For example:
+\begin{verbatim}
+\documentclass{article}
+\usepackage{classics}
+\newclassic{Homer}{#1|:#1}
+\begin{document}
+
+\cite[{\Homer{3}[100--2]}]{Odyssey}
+
+\begin{thebibliography}{10}
+ \bibitem[Od.]{Odyssey} Homer. \textit{Odyssey}.
+\end{thebibliography}
+
+\end{document}
+\end{verbatim}
+
+
+
+ \section{Examples}
+
+\begingroup
+\setlength\parindent{0pt}
+\small
+
+ \subsection{Plato}
+
+
+\verb=\newclassic{Plato}{#1|#1|#1}=
+
+|\Plato {142}[a] |\Plato {142}[a]\par
+|\Plato {142}[a][3] |\Plato {142}[a][3]\par
+|\Plato {142}[a][3--4] |\Plato {142}[a][3--4]\par
+|\Plato*{142}[a][3]{142}[b] |\Plato* {142}[a][3]{142}[b]\par
+|\Plato*{142}[a][3]{142}[b][4] |\Plato* {142}[a][3]{142}[b][4]\par
+|\Plato*{142}[a][3]{143}[b] |\Plato* {142}[a][3]{143}[b]\par
+|\Plato*{142}[a][3]{143}[b][4] |\Plato* {142}[a][3]{143}[b][4]\par
+|\Plato [Theaet.]{142}[a][3] |\Plato [Theaet.]{142}[a][3]\par
+|\Plato*[Theaet.]{142}[a][3]{143}[b][4] |\Plato* [Theaet.]{142}[a][3]{143}[b][4]\par
+
+ \subsection{Aristotle}
+
+\verb=\newclassic {Aristotle} {#1|\textit{#1}|#1}=\par\medskip
+
+|\Aristotle {185} |\Aristotle {185}\par
+|\Aristotle {185}[a] |\Aristotle {185}[a]\par
+|\Aristotle* {185}[a]{185}[b] |\Aristotle* {185}[a]{185}[b]\par
+|\Aristotle* {185}[a]{185}[b][2] |\Aristotle* {185}[a]{185}[b][2]\par
+|\Aristotle* {185}[a]{186} |\Aristotle* {185}[a]{186}\par
+|\Aristotle* {185}[a]{186}[a] |\Aristotle* {185}[a]{186}[a]\par
+|\Aristotle* {185}[a]{186}[a][3] |\Aristotle* {185}[a]{186}[a][3]\par
+|\Aristotle [Phys.]{} |\Aristotle [Phys.]{}\par
+|\Aristotle [Phys.]{185} |\Aristotle [Phys.]{185}\par
+|\Aristotle [Phys.]{185}[a] |\Aristotle [Phys.]{185}[a]\par
+|\Aristotle*[Phys.]{185}[a]{185}[b] |\Aristotle*[Phys.]{185}[a]{185}[b]\par
+|\Aristotle*[Phys.]{185}[a]{185}[b][2] |\Aristotle*[Phys.]{185}[a]{185}[b][2]\par
+|\Aristotle*[Phys.]{185}[a]{186} |\Aristotle*[Phys.]{185}[a]{186}\par
+|\Aristotle*[Phys.]{185}[a]{186}[a] |\Aristotle*[Phys.]{185}[a]{186}[a]\par
+|\Aristotle*[Phys.]{185}[a]{186}[a][3] |\Aristotle*[Phys.]{185}[a]{186}[a][3]\par
+|\Aristotle*[Phys.]{185}[a]{186}[a][3--5] |\Aristotle*[Phys.]{185}[a]{186}[a][3--5]\par
+|\Aristotle [Phys.]{185}[a][10] |\Aristotle [Phys.]{185}[a][10]\par
+|\Aristotle [Phys.]{185}[a][10--2] |\Aristotle [Phys.]{185}[a][10--2]\par
+|\Aristotle*[Phys.]{185}[a][10]{185}[b] |\Aristotle*[Phys.]{185}[a][10]{185}[b]\par
+|\Aristotle*[Phys.]{185}[a][10]{185}[b][2] |\Aristotle*[Phys.]{185}[a][10]{185}[b][2]\par
+|\Aristotle*[Phys.]{185}[a][10]{186} |\Aristotle*[Phys.]{185}[a][10]{186}\par
+|\Aristotle*[Phys.]{185}[a][10]{186}[a] |\Aristotle*[Phys.]{185}[a][10]{186}[a]\par
+|\Aristotle*[Phys.]{185}[a][10]{186}[a][3] |\Aristotle*[Phys.]{185}[a][10]{186}[a][3]\par
+|\Aristotle*[Phys.]{185}[a][10]{186}[a][3--5] |\Aristotle*[Phys.]{185}[a][10]{186}[a][3--5]\par
+
+ \subsection{Homer}
+
+\begingroup
+\DeclareClassicWorkFormat{\textbf{#1},}
+
+\verb=\DeclareClassicWorkFormat{\textbf{#1},}=\par
+\verb=\newclassic[ to ]{Homer}{\books{\classicsRoman{#1}}|, \lines{#1}}=\par
+
+|\Homer {2}[100] |\Homer {2}[100]\par
+|\Homer {2}[100--4] |\Homer {2}[100--4]\par
+|\Homer*{2}[100]{3}[80] |\Homer*{2}[100]{3}[80]\par
+|\Homer [Iliad]{2}[100] |\Homer [Iliad]{2}[100]\par
+|\Homer*[Iliad]{2}[100]{3}[80] |\Homer*[Iliad]{2}[100]{3}[80]\par
+\endgroup
+
+\endgroup
+
+\end{document}