From e4585f6ce56ce0d037a0f545f21f9c7d28767386 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sun, 17 Mar 2019 18:19:05 +0100 Subject: [PATCH] done documenting and added a section on icite and classics. new functions \AuthorTitleDelim and \TitlePageDelim --- Makefile | 48 +++++++++++------------- icite.dtx | 59 +++++++++++++++++++++++++---- samples/icite-biblatex.tex | 23 ++++++------ samples/icite-minimal.tex | 72 ++++++++++++++++++++++++++++++++++++ samples/icite-nobiblatex.tex | 23 ++++++------ 5 files changed, 170 insertions(+), 55 deletions(-) create mode 100644 samples/icite-minimal.tex diff --git a/Makefile b/Makefile index 028aea7..35bf3e4 100644 --- a/Makefile +++ b/Makefile @@ -6,13 +6,27 @@ LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) UTREE = $(shell kpsewhich --var-value TEXMFHOME) exts := md bib ins dtx html -extsi := tex +texsamples := $(basename $(wildcard $(PWD)/samples/*.tex)) findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)") -findoptsi := $(foreach ext,$(extsi),-or -iname "*.$(ext)") + + +# Look into this later +# $(if $(wildcard $(PWD)/TMP/$(notdir $1).bcf),biber $(PWD)/TMP/$(notdir $1),) + +define dosamples + lualatex --output-dir=$(PWD)/TMP --shell-escape $1 >/dev/null + lualatex --output-dir=$(PWD)/TMP --shell-escape $1 >/dev/null + if [ -f $(PWD)/TMP/$(notdir $1)-primary.idx ]; \ + then texindy -M $(PWD)/TMP/$(notdir $1).xdy $(PWD)/TMP/$(notdir $1)-primary.idx >/dev/null; fi + if [ -f $(PWD)/TMP/$(notdir $1).bcf ]; then biber $(PWD)/TMP/$(notdir $1) >/dev/null; fi + lualatex --output-dir=$(PWD)/TMP --shell-escape $1 >/dev/null + lualatex --output-dir=$(PWD)/TMP --shell-escape $1 >/dev/null +endef all: $(NAME).pdf # test -e README.md || exit 0 $(NAME).pdf: $(NAME).dtx + @ echo "Make documentation..." lualatex --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null biber $(NAME) >/dev/null lualatex --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null @@ -22,35 +36,16 @@ $(NAME).pdf: $(NAME).dtx if [ -f primary.idx ]; then texindy -M icite.xdy primary.idx >/dev/null; fi lualatex --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null lualatex --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null + @ echo "Make sample files..." if [ ! -d $(PWD)/TMP ]; then mkdir $(PWD)/TMP; fi cp $(PWD)/samples/*.bib $(PWD)/TMP - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - texindy -M $(PWD)/TMP/icite-biblatex.xdy $(PWD)/TMP/pr-sources.idx - biber $(PWD)/TMP/icite-biblatex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex - texindy -M $(PWD)/TMP/icite-nobiblatex.xdy $(PWD)/TMP/pr-sources.idx - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex + $(foreach file,$(texsamples), $(call dosamples, $(file))) mv TMP/*.pdf samples/ samples: if [ ! -d $(PWD)/TMP ]; then mkdir $(PWD)/TMP; fi cp $(PWD)/samples/*.bib $(PWD)/TMP - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - texindy -M $(PWD)/TMP/icite-biblatex.xdy $(PWD)/TMP/pr-sources.idx - biber $(PWD)/TMP/icite-biblatex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex - texindy -M $(PWD)/TMP/icite-nobiblatex.xdy $(PWD)/TMP/pr-sources.idx - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex - lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex + $(foreach file,$(texsamples), $(call dosamples, $(file))) mv TMP/*.pdf samples/ lualatex: @@ -109,9 +104,10 @@ package: distclean all cp -r samples/ doc/latex/$(NAME)/ mkdir -p source/latex/$(NAME)/ cp Makefile README.md $(NAME).{dtx,ins} source/latex/$(NAME)/ - zip -r $(NAME).tds.zip tex doc source + # zip -r $(NAME).tds.zip tex doc source rm -rf tex/ source/ doc/ - tar czf $(NAME)-$(VERS).tar.gz $(NAME).tds.zip $(NAME)/ + # tar czf $(NAME)-$(VERS).tar.gz $(NAME).tds.zip $(NAME)/ + tar czf $(NAME)-$(VERS).tar.gz $(NAME)/ rm -rf $(NAME)/ .PHONY: all lualatex clean distclean inst local uninst install uninstall zip package samples diff --git a/icite.dtx b/icite.dtx index 57a8bd4..3202594 100644 --- a/icite.dtx +++ b/icite.dtx @@ -349,10 +349,10 @@ Running "make install" installs the files in the local TeX tree. \newunicodechar{Ǧ}{Ǧ} % \usepackage{arabluatex} \SetTranslitConvention{loc} -\usepackage{varioref} \usepackage{xurl} \usepackage{uri} \usepackage{hyperxmp} +\usepackage{varioref} \usepackage[numbered]{hypdoc} \hypersetup{unicode=true, colorlinks, allcolors=blue, linktocpage=true, pdfauthor={Robert Alessi}, pdftitle={The @@ -367,9 +367,10 @@ Running "make install" installs the files in the local TeX tree. pdflicenseurl={https://creativecommons.org/licenses/by-sa/4.0/legalcode}, pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={bibtex, biblatex, indexing}} +\usepackage{amsmath} +\usepackage{cleveref} \CodelineIndex \usepackage[citecmd=autocite,defaultindex]{\jobname} -\usepackage{cleveref} \IndexSubtypeAs{classical}{primary} \bibinput{icite} \usepackage[nonewpage,xindy]{imakeidx} @@ -670,6 +671,8 @@ Running "make install" installs the files in the local TeX tree. % % \fi % +% \subsection{Preamble-only commands} +% The following commands may be found in the preamble only. % \paragraph{Styling the titles} % \DescribeMacro{\SetTitleStyle} By default, \package{icite} prints % the titles of the works cited in italics.\\ @@ -688,6 +691,21 @@ Running "make install" installs the files in the local TeX tree. % As this example shows, |#1| is the token that is replaced with the % actual title in the formatting directives of the \cs{SetTitleStyle} % command. +% +% \paragraph{Delimiters} +% \NEWfeature{v1.2}\DescribeMacro{\AuthorTitleDelim} +% \cs{AuthorTitleDelim}\marg{delimiter} sets the delimiter between +% authors and titles in the body text when the |nobibengine| option is +% set to |true|. The default delimiter is a comma and a space. +% +% \DescribeMacro{\TitlePageDelim} +% \cs{TitlePageDelim}\marg{delimiter} sets the delimiter between +% titles and pages in the body text when the |nobibengine| option is +% set to |true|. The default delimiter is a comma and a space. +% +% \subsection[\textsf{icite} for the Impatient]% +% {\package{icite} for the Impatient} +% Read \href{samples/icite-minimal.pdf}{\texttt{icite-minimal.pdf}}. % % \subsection{Entry fields} % \label{sec:entry-fields} @@ -1004,7 +1022,7 @@ Running "make install" installs the files in the local TeX tree. % \subsection[The \textsf{classics} package]% % {The \package{classics} package} % % \label{sec:classics-usage} -% As said above on \cpageref{ref:classics-pkg}, it is advisable to use +% As said above \vpageref{ref:classics-pkg}, it is advisable to use % the \package{classics} package to format volume, page, column, line % numbers and the like which are inserted in the \meta{post} optional % argument of the \cs{icite} command\autocite{classics}. An example of @@ -1219,7 +1237,32 @@ Running "make install" installs the files in the local TeX tree. } \@onlypreamble\SetTitleStyle % \end{macrocode} -% +% \DescribeMacro{\AuthorTitleDelim} +% \changes{v1.2}{2019/03/16}{\cs{AuthorTitleDelim}: delimiter +% between authors and titles}\cs{AuthorTitleDelim}\marg{delimiter} +% sets the delimiter between authors and titles in the body text when +% the |nobibengine| option is set to |true|. The default delimiter is +% a comma. +% \begin{macrocode} +\def\ic@authtitdelim{, } +\NewDocumentCommand{\AuthorTitleDelim}{m}{% + \def\ic@authtitdelim{#1} +} +\@onlypreamble\AuthorTitleDelim +% \end{macrocode} +% \DescribeMacro{\TitlePageDelim} +% \changes{v1.2}{2019/03/16}{\cs{TitlePageDelim}: the delimiter +% between titles and pages}\cs{TitlePageDelim}\marg{delimiter} sets +% the delimiter between titles and pages in the body text when the +% |nobibengine| option is set to |true|. The default delimiter is a +% comma. +% \begin{macrocode} +\def\ic@titpgdelim{, } +\NewDocumentCommand{\TitlePageDelim}{m}{% + \def\ic@titpgdelim{#1} +} +\@onlypreamble\TitlePageDelim +% \end{macrocode} % \DescribeMacro{\icite} \cs{icite} both inserts a formatted citation % and an entry in the \emph{index locorum citatorum}. It is to be used % in place of any \hologo{BibTeX} or Bib\LaTeX\ citation command the @@ -1292,7 +1335,7 @@ Running "make install" installs the files in the local TeX tree. \fi}} \ifno@bibengine \ifx\@shorthand\empty% - \@useauthor, \TitleStyle{\@usetitle}% + \@useauthor\ic@authtitdelim\TitleStyle{\@usetitle}% \else% \@shorthand% \fi% @@ -1324,7 +1367,8 @@ Running "make install" installs the files in the local TeX tree. \fi}}% \ifno@bibengine \ifx\@shorthand\empty% - \@useauthor, \TitleStyle{\@usetitle}, {#1}% + \@useauthor\ic@authtitdelim\TitleStyle{\@usetitle}% + \ic@titpgdelim{#1}% \else% \@shorthand, {#1}% \fi% @@ -1355,7 +1399,8 @@ Running "make install" installs the files in the local TeX tree. \fi}}% \ifno@bibengine \ifx\@shorthand\empty% - #1 \@useauthor, \TitleStyle{\@usetitle}, {#2}% + #1 \@useauthor\ic@authtitdelim\TitleStyle{\@usetitle}% + \ic@titpgdelim{#2}% \else% #1 \@shorthand, {#2}% \fi diff --git a/samples/icite-biblatex.tex b/samples/icite-biblatex.tex index 678f9f4..b49bc34 100644 --- a/samples/icite-biblatex.tex +++ b/samples/icite-biblatex.tex @@ -22,7 +22,7 @@ \setlist[enumerate,2]{label=\roman*.} \usepackage[citecmd=autocite, defaultindex=none]{icite} -\IndexSubtypeAs{ancient}{pr-sources} +\IndexSubtypeAs{ancient}{\jobname-primary} \bibinput{bibsample} \usepackage{classics} @@ -30,7 +30,7 @@ \newclassic{arist}{#1|\textit{#1}|#1} \usepackage[xindy,nonewpage]{imakeidx} -\makeindex[name=pr-sources, title={Index locorum citatorum}] +\makeindex[name=\jobname-primary, title={Index locorum citatorum}] \usepackage[style=oxnotes]{biblatex} \addbibresource{bibsample.bib} @@ -49,7 +49,7 @@ index of passages cited in combination with Bib\LaTeX. The relevant part of the preamble which is used here follows: \begin{Verbatim} \usepackage[citecmd=autocite, defaultindex=none]{icite} -\IndexSubtypeAs{ancient}{pr-sources} +\IndexSubtypeAs{ancient}{icite-biblatex-primary} \bibinput{bibsample} \usepackage{classics} @@ -57,7 +57,7 @@ The relevant part of the preamble which is used here follows: \newclassic{arist}{#1|\textit{#1}|#1} \usepackage[xindy]{imakeidx} -\makeindex[name=pr-sources, title={Index locorum citatorum}] +\makeindex[name=icite-biblatex-primary, title={Index locorum citatorum}] \usepackage[style=oxnotes]{biblatex} \addbibresource{bibsample.bib} @@ -68,12 +68,13 @@ The relevant part of the preamble which is used here follows: \item |citecmd=autocite| instructs \textsf{icite} to use the |\autocite| command to insert the citations in the body text. \item |defaultindex=none| disables indexing by default. -\item |\IndexSubtypeAs{ancient}{pr-sources}| makes an exception for - authors whose |entrysubtype| field matches the string |ancient| and - instructs \textsf{icite} to have them indexed in an index named - |pr-sources|. -\item To actually produce the index, |\printindex[pr-sources]| is needed - at the end of the document. +\item |\IndexSubtypeAs{ancient}{icite-biblatex-primary}| makes an + exception for authors whose |entrysubtype| field matches the string + |ancient| and instructs \textsf{icite} to have them indexed in an + index named\\ |icite-biblatex-primary|. +\item To actually produce the index, + |\printindex[icite-biblatex-primary]| is needed at the end of the + document. \end{enumerate} \section*{Body text} @@ -94,7 +95,7 @@ another\icite[\arist{1253}[a][30--39]]{Aristotle:Politica}. This passage should not be indexed\icite[44--78]{Reynolds.Wilson1994}. -\printindex[pr-sources] +\printindex[\jobname-primary] \section*{Bibliographical database} \VerbatimInput{bibsample.bib} diff --git a/samples/icite-minimal.tex b/samples/icite-minimal.tex new file mode 100644 index 0000000..32bb4a2 --- /dev/null +++ b/samples/icite-minimal.tex @@ -0,0 +1,72 @@ +\documentclass{article} +\usepackage[english]{babel} + +\usepackage[small]{titlesec} + +\usepackage{latexcolors} +\usepackage[outputdir=TMP/]{minted} +\setminted{bgcolor=lavendermist} + +\usepackage{ccicons} +\usepackage{enumitem} +\setlist{nosep} +\setlist[itemize]{label=\textendash} +\setlist[enumerate,1]{label=(\alph*)} +\setlist[enumerate,2]{label=\roman*.} + +\usepackage{xurl} +\usepackage[colorlinks]{hyperref} + +\begin{document} +\vspace*{-.5in} +\noindent +\textbf{\textsf{icite sample file}} --- \cczero\ This +file is public domain + +\section*{Instructions} +\begin{enumerate} +\item Start a new document, copy and paste the code that follows. +\item The default citation command used by \textsf{icite} has been set + to \verb|autocite|. Adapt. +\item The \textsf{biblatex} style file selected is + \verb|oxnotes|. Adapt. +\item Insert the citations in the body text with + \mint{latex}|\icite[
][]{}|
+\item Compile the document with \verb|--shell-escape|.\footnote{More
+    information on how to do this: \url{https://texfaq.org/FAQ-spawnprog}}
+\end{enumerate}
+
+\begin{minted}{latex}
+\RequirePackage{filecontents}
+\begin{filecontents*}{\jobname.xdy}
+(merge-rule "\*" "" :eregexp)
+\end{filecontents*}
+%
+\documentclass{article}
+\usepackage[english]{babel}
+
+% load icite
+\usepackage[citecmd=autocite, defaultindex=loccit]{icite}
+\bibinput{bibliography}
+
+% prepare the index
+\usepackage[xindy]{imakeidx}
+\makeindex[%
+  name=loccit,
+  title={Index locorum citatorum},
+  options=-M \jobname.xdy]
+
+% load biblatex
+\usepackage[style=oxnotes]{biblatex}
+\addbibresource{bibliography.bib}
+
+\begin{document}
+
+Your document goes here.
+
+\printindex[loccit]
+\printbibliography
+\end{document}
+\end{minted}
+
+\end{document}
diff --git a/samples/icite-nobiblatex.tex b/samples/icite-nobiblatex.tex
index baf2973..d6f824d 100644
--- a/samples/icite-nobiblatex.tex
+++ b/samples/icite-nobiblatex.tex
@@ -23,7 +23,7 @@
 \setlist[enumerate,2]{label=\roman*.}
 
 \usepackage[defaultindex=none, nobibengine]{icite}
-\IndexSubtypeAs{ancient}{pr-sources}
+\IndexSubtypeAs{ancient}{\jobname-primary}
 \bibinput{bibsample}
 
 \usepackage{classics}
@@ -31,7 +31,7 @@
 \newclassic{arist}{#1|\textit{#1}|#1}
 
 \usepackage[xindy,nonewpage]{imakeidx}
-\makeindex[name=pr-sources, title={Index locorum citatorum}]
+\makeindex[name=\jobname-primary, title={Index locorum citatorum}]
 
 \begin{document}
 \DefineShortVerb{\|}
@@ -48,7 +48,7 @@ Bib\LaTeX.
 The relevant part of the preamble which is used here follows:
 \begin{Verbatim}
 \usepackage[defaultindex=none, nobibengine]{icite}
-\IndexSubtypeAs{ancient}{pr-sources}
+\IndexSubtypeAs{ancient}{icite-nobiblatex-primary}
 \bibinput{bibsample}
 
 \usepackage{classics}
@@ -56,7 +56,7 @@ The relevant part of the preamble which is used here follows:
 \newclassic{arist}{#1|\textit{#1}|#1}
 
 \usepackage[xindy]{imakeidx}
-\makeindex[name=pr-sources, title={Index locorum citatorum}]
+\makeindex[name=icite-nobiblatex-primary, title={Index locorum citatorum}]
 \end{Verbatim}
 
 \paragraph{Remarks}
@@ -64,12 +64,13 @@ The relevant part of the preamble which is used here follows:
 \item |defaultindex=none| disables indexing by default.
 \item |nobibengine| instructs \textsf{icite} to insert the citations
   in the body text without using either \hologo{BibTeX} or Bib\LaTeX.
-\item |\IndexSubtypeAs{ancient}{pr-sources}| makes an exception for
-  authors whose |entrysubtype| field matches the string |ancient| and
-  instructs \textsf{icite} to have them indexed in an index named
-  |pr-sources|.
-\item To actually produce the index, |\printindex[pr-sources]| is
-  needed at the end of the document.
+\item |\IndexSubtypeAs{ancient}{icite-nobiblatex-primary}| makes an
+  exception for authors whose |entrysubtype| field matches the string
+  |ancient| and instructs \textsf{icite} to have them indexed in an
+  index named\\ |icite-nobiblatex-primary|.
+\item To actually produce the index,
+  |\printindex[icite-nobiblatex-primary]| is needed at the end of the
+  document.
 \end{enumerate}
 
 \section*{Body text}
@@ -92,7 +93,7 @@ and another.\footnote{%
 This passage should not be
 indexed.\footnote{\icite[44--78]{Reynolds.Wilson1994}.}
 
-\printindex[pr-sources]
+\printindex[\jobname-primary]
 
 \section*{Bibliographical database}
 \VerbatimInput{bibsample.bib}