# HG changeset patch # User wenzelm # Date 1673736613 -3600 # Node ID d60dbb325535ed0e408ea159d29ac4553e933fcc # Parent ac92a7c948b147175889880d50990ff0f835f5d2 update documentation: prefer control-symbol-cartouche form of "cite" antiquotations; diff -r ac92a7c948b1 -r d60dbb325535 NEWS --- a/NEWS Sat Jan 14 22:37:15 2023 +0100 +++ b/NEWS Sat Jan 14 23:50:13 2023 +0100 @@ -22,7 +22,20 @@ Isabelle/jEdit Document panel. * Support for more "cite" antiquotations, notably for \nocite and -natbib's \citet / \citep. +natbib's \citet / \citep. The antiquotation syntax now supports +control-symbol-cartouche form, with an embedded argument: +\<^cite>\arg\. The embedded argument syntax supports both the optional +and mandatory argument of the underlying \cite-like macro. + +Examples: + + \<^cite>\\\S1.2\ in "isabelle-system"\ + \<^cite>\"isabelle-system" and "isabelle-jedit"\ + \<^nocite>\"isabelle-isar-ref"\ + +The command-line tool "isabelle update -u cite_commands -l HOL" helps to +update former uses of raw \cite commands or old @{cite "name"} +antiquotations. *** HOL *** diff -r ac92a7c948b1 -r d60dbb325535 lib/texinputs/isabellesym.sty --- a/lib/texinputs/isabellesym.sty Sat Jan 14 22:37:15 2023 +0100 +++ b/lib/texinputs/isabellesym.sty Sat Jan 14 23:50:13 2023 +0100 @@ -495,3 +495,8 @@ \newcommand{\isactrlifUNDERSCOREmacos}{\isakeywordcontrol{if{\isacharunderscore}macos}} \newcommand{\isactrlifUNDERSCOREwindows}{\isakeywordcontrol{if{\isacharunderscore}windows}} \newcommand{\isactrlifUNDERSCOREunix}{\isakeywordcontrol{if{\isacharunderscore}unix}} + +\newcommand{\isactrlcite}{\isakeywordcontrol{cite}} +\newcommand{\isactrlnocite}{\isakeywordcontrol{nocite}} +\newcommand{\isactrlcitet}{\isakeywordcontrol{citet}} +\newcommand{\isactrlcitep}{\isakeywordcontrol{citep}} diff -r ac92a7c948b1 -r d60dbb325535 src/Doc/Isar_Ref/Document_Preparation.thy --- a/src/Doc/Isar_Ref/Document_Preparation.thy Sat Jan 14 22:37:15 2023 +0100 +++ b/src/Doc/Isar_Ref/Document_Preparation.thy Sat Jan 14 23:50:13 2023 +0100 @@ -221,7 +221,8 @@ @@{antiquotation "file"} options @{syntax name} | @@{antiquotation dir} options @{syntax name} | @@{antiquotation url} options @{syntax embedded} | - @@{antiquotation cite} options @{syntax cartouche}? (@{syntax name} + @'and') + (@@{antiquotation cite} | @@{antiquotation nocite} | + @@{antiquotation citet} | @@{antiquotation citep}) @{syntax embedded} ; styles: '(' (style + ',') ')' ; @@ -344,18 +345,26 @@ \<^descr> \@{url name}\ produces markup for the given URL, which results in an active hyperlink within the text. - \<^descr> \@{cite name}\ produces a citation \<^verbatim>\\cite{name}\ in {\LaTeX}, where the - name refers to some Bib{\TeX} database entry. This is only checked in - batch-mode session builds. + \<^descr> \@{cite arg}\ produces the Bib{\TeX} citation macro \<^verbatim>\\cite[...]{...}\ + with its optional and mandatory argument. The analogous \<^verbatim>\\nocite\, and the + \<^verbatim>\\citet\ and \<^verbatim>\\citep\ variants from the \<^verbatim>\natbib\ + package\<^footnote>\\<^url>\https://ctan.org/pkg/natbib\\ are supported as well. Further + versions can be defined easily in Isabelle/ML, by imitating the ML + definitions behind the existing antiquotations. - The variant \@{cite \opt\ name}\ produces \<^verbatim>\\cite[opt]{name}\ with some - free-form optional argument. Multiple names are output with commas, e.g. - \@{cite foo \ bar}\ becomes \<^verbatim>\\cite{foo,bar}\. + The argument syntax is uniform for all variants and is usually presented in + control-symbol-cartouche form: \\<^cite>\arg\\. The formal syntax of the + nested argument language is defined as follows: \<^rail>\arg: (embedded + @'in')? (name + 'and')\ - The {\LaTeX} macro name is determined by the antiquotation option - @{antiquotation_option_def cite_macro}, or the configuration option - @{attribute cite_macro} in the context. For example, \@{cite [cite_macro = - nocite] foobar}\ produces \<^verbatim>\\nocite{foobar}\. + Here the embedded text is free-form {\LaTeX}, which becomes the optional + argument of the \<^verbatim>\\cite\ macro. The named items are Bib{\TeX} database + entries and become the mandatory argument (separated by comma). + + The validity of Bib{\TeX} database entries is only partially checked in + Isabelle/PIDE, when the corresponding \<^verbatim>\.bib\ files are open. Ultimately, + the \<^verbatim>\bibtex\ program will complain about bad input in final document + preparation. \<^descr> @{command "print_antiquotations"} prints all document antiquotations that are defined in the current context; the ``\!\'' option indicates extra