Compare commits

...

10 Commits

10 changed files with 246 additions and 42 deletions

View File

@ -20,13 +20,14 @@ Various fixes in the documentation and new convenience macro `\crfnm@declareType
The test suite now uses _lualatex_. The test suite now uses _lualatex_.
### Version 1.2 <!-- TODO : date --> ### 2025/08/07: Version 1.2
The last argument of `\crossrefenum` can now be a comma-delimited list The last argument of `\crossrefenum` can now be a comma-delimited list
instead of a list of groups. Lists of groups are still supported and will remain so. instead of a list of groups. Lists of groups are still supported and will remain so.
The new macro `\crfnmsetup` now provides a key-value configuration interface, The new macro `\crfnmsetup` now provides a key-value configuration interface,
thanks to Jonathan P. Spratte's [`expkv`](https://ctan.org/pkg/expkv-bundle) package. thanks to Jonathan `\penalty-10000`{=context} P. Spratte's
[`expkv`](https://ctan.org/pkg/expkv-bundle) package.
The dependency to `expkv` can be removed by deactivating the key-value interface. The dependency to `expkv` can be removed by deactivating the key-value interface.
Various improvements in the manual. Various improvements in the manual.

View File

@ -1,8 +1,8 @@
# crossrefenum 2024/04/13 v1.2<!-- TODO : date --> # crossrefenum 2025/08/07 v1.2
Smart typesetting of enumerated cross-references for various TeX formats. Smart typesetting of enumerated cross-references for various TeX formats.
Copyright (C) 2022-2024 Copyright (C) 2022-2025
by Bastien Dumont <bastien.dumont@posteo.net> by Bastien Dumont <bastien.dumont@posteo.net>
CTAN: `macros/generic/crossrefenum` CTAN: `macros/generic/crossrefenum`
@ -54,9 +54,8 @@ the key-value configuration interface in favor of the native configuration macro
* `data-lines.tex`: _Text input to test line numbering._ * `data-lines.tex`: _Text input to test line numbering._
* `data-reledmac.tex`: _Text input for *reledmac*._ * `data-reledmac.tex`: _Text input for *reledmac*._
* `format-specific-defs.tex`: _Definition of the macros used in the test and data files that depend on format-specific macros._ * `format-specific-defs.tex`: _Definition of the macros used in the test and data files that depend on format-specific macros._
* `main-test_context.pdf`: _Test file generated with ConTeXt._ * `main-test.pdf`: _Test file generated with LaTeX._
* `main-test_latex.pdf`: _Test file generated with LaTeX._ * `main-test.tex`: _Main test file (can also be compiled with ConTeXt)._
* `main-test.tex`: _Main test file._
* `Makefile`: _Provides targets to generate the test file (`test` for LaTeX, `test-context`) and to `check` its correctness._ * `Makefile`: _Provides targets to generate the test file (`test` for LaTeX, `test-context`) and to `check` its correctness._
* `validated_output`: _Used by `make check`._ * `validated_output`: _Used by `make check`._
* `tex/` * `tex/`
@ -72,7 +71,7 @@ and put in it `crossrefenum.tex` and, if required,
## License ## License
Copyright 2022-2024 by Bastien Dumont (bastien.dumont@posteo.net) Copyright 2022-2025 by Bastien Dumont (bastien.dumont@posteo.net)
crossrefenum.tex is free software: you can redistribute it and/or modify crossrefenum.tex is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,8 @@ crossrefenum.pdf: crossrefenum-doc.tex
crossrefenum-doc.tex: crossrefenum.md ../CHANGELOG.md \ crossrefenum-doc.tex: crossrefenum.md ../CHANGELOG.md \
TEMPLATE_crossrefenum.context fixes.lua TEMPLATE_crossrefenum.context fixes.lua
pandoc -s -o $@ -t context \ pandoc -s -o $@ -t context-smart \
--template=TEMPLATE_crossrefenum.context \ --template=TEMPLATE_crossrefenum.context \
-L fixes.lua \ -L fixes.lua \
crossrefenum.md ../CHANGELOG.md crossrefenum.md ../CHANGELOG.md
sh ./microfixes-doc.sh $@

View File

@ -23,7 +23,7 @@ $endif$
\setupbodyfontenvironment[default][em=italic] \setupbodyfontenvironment[default][em=italic]
\definefontfamily[mainface][rm][cochineal] \definefontfamily[mainface][rm][cochineal]
\definefontfamily[mainface][ss][libertinussans] \definefontfamily[mainface][ss][libertinussans]
\definefontfamily[mainface][tt][nimbusmonops][features=none] \definefontfamily[mainface][tt][dejavusansmono][features=none, rscale=0.78]
\setupbodyfont[mainface,12pt] \setupbodyfont[mainface,12pt]
\setuptype[lines=no] \setuptype[lines=no]
@ -39,7 +39,7 @@ $endif$
\setuppagenumbering[location=] % Pour que le numéro de page n'apparaisse pas en haut au milieu \setuppagenumbering[location=] % Pour que le numéro de page n'apparaisse pas en haut au milieu
\setupheader[text][leftstyle=\em] \setupheader[text][leftstyle=\em]
\setupheadertexts[section][pagenumber] \setupheadertexts[section][pagenumber]
\setupfootertexts$if(toc)$[{\inframed{\goto{Table of contents}[page(3)]}}]$endif$[{\inframed{\goto{Jump to previous page}[PreviousJump]}}] \setupfootertexts$if(toc)$[{\inframed{\goto{Table of contents}[page(3)]}}]$endif$[{\inframed{\goto{Summary}[page(7)]}}]
\setupbackend[ \setupbackend[
format={pdf/a-1a:2005}, format={pdf/a-1a:2005},
@ -69,7 +69,7 @@ intent=ISO coated v2 300\letterpercent\space (ECI)]
\setupitemize[1][symbol=emdash, width=2.2em, indenting=-0.7em] % cochineal has no bullet \setupitemize[1][symbol=emdash, width=2.2em, indenting=-0.7em] % cochineal has no bullet
\setupitemize[2][symbol=endash, width=1.3em, indenting=-0.3em] \setupitemize[2][symbol=endash, width=1.3em, indenting=-0.3em]
\setupdelimitedtext[blockquote][indenting=no] \setupdelimitedtext[blockquote][indenting=big,style=\tta,before=\blank[big],after=\blank[big]]
\definebreakpoints[lbreakwithouthyphen] \definebreakpoints[lbreakwithouthyphen]
\definebreakpoint[lbreakwithouthyphen][=][type=1] \definebreakpoint[lbreakwithouthyphen][=][type=1]
@ -95,6 +95,7 @@ $endif$
\starttext \starttext
\starttitlepagemakeup \starttitlepagemakeup
\vfil
$if(title)$ $if(title)$
{\tfd\setupinterlinespace $title$} {\tfd\setupinterlinespace $title$}
$if(subtitle)$ $if(subtitle)$
@ -103,12 +104,23 @@ $if(subtitle)$
$endif$ $endif$
$if(author)$ $if(author)$
\blank[force,1cm] \blank[force,1cm]
{\tfa\setupinterlinespace $for(author)$$author$$sep$\crlf $endfor$} {\tfa\setupinterlinespace $author$}
$endif$ $endif$
$if(date)$ $if(version)$
\blank[force,1cm] \blank[force,1cm]
{\tfa\setupinterlinespace $date$} {\tfb\setupinterlinespace v. $version$}
$endif$ $endif$
\vfil
\vskip1cm
$if(date)$
\blank[force,.7cm]
{\tfx\setupinterlinespace Last update of this manual: $date$}
$endif$
$if(email)$
\blank[force,small]
{\tfx Contact: }{\ttx $email$}
$endif$
\vskip-2cm
\stoptitlepagemakeup \stoptitlepagemakeup
\pagebreak \pagebreak
$endif$ $endif$
@ -116,7 +128,7 @@ $endif$
$if(license)$ $if(license)$
\startlicensepagemakeup \startlicensepagemakeup
\inframed[frame=off, width=0.66\textwidth, align=normal]{% \inframed[frame=off, width=0.66\textwidth, align=normal]{%
Copyright (C) 2022-2024 Bastien Dumont. Copyright (C) 2022-2025 Bastien Dumont.
Permission is granted to copy, distribute and/or modify this document Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation; or any later version published by the Free Software Foundation;

View File

@ -2,7 +2,9 @@
title: "crossrefenum" title: "crossrefenum"
subtitle: "Smart typesetting of enumerated cross-references for various TeX formats" subtitle: "Smart typesetting of enumerated cross-references for various TeX formats"
author: Bastien Dumont author: Bastien Dumont
date: "2024/04/13<!-- TODO : mettre à jour -->" email: bastien [dot] dumont [at] posteo [dot] net
date: "2025/08/07"
version: 1.2
lang: en-US lang: en-US
toc: true toc: true
license: true license: true
@ -49,11 +51,105 @@ you can do:
must be called after _nameref_ if you use _hyperref_`\kern1.5pt`{=context}); must be called after _nameref_ if you use _hyperref_`\kern1.5pt`{=context});
* `\usemodule[crossrefenum]` (ConTeXt). * `\usemodule[crossrefenum]` (ConTeXt).
## Basic invocation ## Summary {#summary}
* [`\crossrefenum`](#macro-crossrefenum): the main macro
* [`\crfnmsetup`](#crfnmsetup-macro): configuration macro (default of per type)
```{=context}
\vskip\medskipamount
```
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|**Configuration |**Configuration macro (with `\def`)** |**Meaning** |**Example** |**Page** |
|key (with | | | | |
|`\crfnmsetup`)** | | | | |
+=================+===============================================+=====================+==============+==============================+
|`<type>` _is a single type_ |`page` |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`sg` |`\crfnm<type>` |Singular prefix |`{p. }` |`\at[prefixes]`{=context} |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`pl` |`\crfnm<type>s` |Plural prefix |`{pp. }` |`\at[prefixes]`{=context} |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`delimiter` |`\crfnm<type>EnumDelim` |Delimiter between |`{, }` |`\at[delimiters]`{=context} |
| | |references | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`before last |`\crfnm<type>BeforeLastInEnum` |Delimiter before the |`{ and }` |`\at[delimiters]`{=context} |
|reference` | |last reference | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`range separator`|`\crfnm<type>RangeSep` |Separator between the|`{\tt |`\at[range-sep]`{=context} |
| | |two values in a range|`{=context} | |
| | | |`}`{=context} | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`collapsable?` |`\crfnm<type>Collapsable` |Should consecutive |`yes` or `no` |`\at[collapsable]`{=context} |
| | |numbers (e.g. 2, 3, | | |
| | |4) be merged into a | | |
| | |range? | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`<type>` _is a double type_ |`pagenote` |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`subtypes |`\crfnm<type>SubtypesSep` |Separator between the|`{, }` |`\at[subtypes-sep]`{=context} |
|separator` | |two types of | | |
| | |references in a | | |
| | |double reference | | |
| | |(e.g. between the | | |
| | |page and note numbers| | |
| | |in a reference to a | | |
| | |note including the | | |
| | |page number) | | |
| | | | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`print prefix of |`\crfnm<type>PrintFirstPrefix` |Should the numbers of|`always` or |`\at[fst-pref-dbl]`{=context} |
|first subtype` | |the first subtype be |`once` | |
| | |prefixed always or | | |
| | |only for the first | | |
| | |reference in an | | |
| | |enumeration? | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`group subtypes?`|`\crfnm<type>GroupSubtypes` |Sould all the values |`yes` or `no` |`\at[group-subt]`{=context} |
| | |for each subtype be | | |
| | |printed separately? | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`order` |`\crfnm<type>Order` |Whether the subtypes |`normal` or |`\at[order]`{=context} |
| | |are printed in the |`inverted` | |
| | |same order as in the | | |
| | |name of the double | | |
| | |type | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`<type>` _is a single type; the following options apply when it is used as the second |`page` |
|subtype of a double type_ | |
| | |
| | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`formatting when |`\crfnm<type>FormatInSecond` |`{}` or a macro that |`\textbf` |`\at[fmt-sec-subt]`{=context} |
|second subtype` | |takes the prefixes | | |
| | |and numbers as its | | |
| | |argument | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`print prefix |`\crfnm<type>PrintPrefixInSecond` |Should the prefix be |`yes` or `no` |`\at[rep-pref-dbl]`{=context} |
|when second | |printed? | | |
|subtype?` | | | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`delimiter when |`\crfnm<type>EnumDelimInSecond` |Delimiter between |`{, }` |`\at[delim-sec-dbl]`{=context}|
|second subtype` | |references | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`before last |`\crfnm<type>BeforeLastInSecond` |Delimiter before the |`{ and }` |`\at[delim-sec-dbl]`{=context}|
|reference when | |last reference | | |
|second subtype` | | | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`continuous |`\crfnm<type>NumberingContinuousAcrossDocument`|Is the numbering for |`yes` or `no` |`\at[numb-contin]`{=context} |
|numbering?` | |this type continuous | | |
| | |(i.e. not reset at | | |
| | |every | | |
| | |page/chapter/etc.)? | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
## Basic invocation {#macro-crossrefenum}
The macro `\crossrefenum` has the following syntax: The macro `\crossrefenum` has the following syntax:
> \\crossrefenum\[_type_\]\[_print prefix?_\]{_enumeration_} > \\crossrefenum[\<type\>][\<print prefix?\>]{\<enumeration\>}
* _type_ is the type of the references. Built-in possible values are: * _type_ is the type of the references. Built-in possible values are:
* For LaTeX and ConTeXt: `page`, `note`, `pagenote`; * For LaTeX and ConTeXt: `page`, `note`, `pagenote`;
@ -86,7 +182,7 @@ The same invocations with the group-based syntax:
* `\crossrefenum{{lblone}{lbltwo}{lblthree}}` * `\crossrefenum{{lblone}{lbltwo}{lblthree}}`
* `\crossrefenum{{only-one}}` (even if the enumeration is limited to one item, it can be inside its own group) * `\crossrefenum{{only-one}}` (even if the enumeration is limited to one item, it can be inside its own group)
## Customization ## Customization {#crfnmsetup-macro}
There are two configuration interfaces: There are two configuration interfaces:
one based on key-value lists, the other on (re)defining macros. one based on key-value lists, the other on (re)defining macros.
@ -110,7 +206,7 @@ In this respect, “default” settings may be set be the user.
The key-value interface has the following syntax: The key-value interface has the following syntax:
> \\crfnmsetup\[_“default” or type_\]{ _key1_ = _value1_, _key2_ = _value2_, … } > \\crfnmsetup[<“default” or type>]{ \<key1\> = \<value1\>, <…> }
_type_ is a single or a double type (e.g. `page` or `pagenote`). _type_ is a single or a double type (e.g. `page` or `pagenote`).
The spaces around the equal signs and the commas are optional and ignored; The spaces around the equal signs and the commas are optional and ignored;
@ -141,7 +237,7 @@ correspond to the built-in configuration.
### Prefixes, delimiters and separators ### Prefixes, delimiters and separators
You can define the singular and plural prefixes You can define the [singular and plural prefixes]{#prefixes}
printed before the value of the reference like this: printed before the value of the reference like this:
```{.tex} ```{.tex}
@ -166,7 +262,7 @@ printed before the value of the reference like this:
`\noindentation`{=context} (it would have been more accurate to write `\noindentation`{=context} (it would have been more accurate to write
`\crfnmsetup[edpage]{sg=\crfnmPage, pl=\crfnmPages}`). `\crfnmsetup[edpage]{sg=\crfnmPage, pl=\crfnmPages}`).
The delimiters printed respectively between the successive references in an enumeration The [delimiters]{#delimiters} printed respectively between the successive references in an enumeration
and before the last one are set so: and before the last one are set so:
```{.tex} ```{.tex}
@ -182,7 +278,7 @@ and before the last one are set so:
\def\crfnmDefaultBeforeLastInEnum{ and } \def\crfnmDefaultBeforeLastInEnum{ and }
``` ```
The separator in a range is set like this: The [separator in a range]{#range-sep} is set like this:
```{.tex} ```{.tex}
\crfnmsetup[default]{range separator = } \crfnmsetup[default]{range separator = }
@ -193,7 +289,7 @@ The separator in a range is set like this:
\def\crfnmDefaultRangeSep{} \def\crfnmDefaultRangeSep{}
``` ```
### Collapsable and non-collapsable types {#collapsable-types} ### Collapsable and non-collapsable types {#collapsable}
The configuration option `collapsable?` and The configuration option `collapsable?` and
the macro `\crfnmDefaultCollapsable` define if ranges are allowed. the macro `\crfnmDefaultCollapsable` define if ranges are allowed.
@ -219,7 +315,7 @@ This extends to double types that include a non-collapsable type
### Double types ### Double types
You can set like this the separator between the two values in a double reference You can set like this [the separator between the two values in a double reference]{#subtypes-sep}
(e.g. the page and the note numbers in a `pagenote` reference): (e.g. the page and the note numbers in a `pagenote` reference):
```{.tex} ```{.tex}
@ -232,7 +328,7 @@ You can set like this the separator between the two values in a double reference
``` ```
When more than one reference is cited in an enumeration, When more than one reference is cited in an enumeration,
you may not want the first prefix to be repeated every time [you may not want the first prefix to be repeated every time]{#fst-pref-dbl}
(e.g. you may prefer “pp. 5, n. 2; 7, n. 4” to “p. 5, n. 2; p. 7, n. 4”). (e.g. you may prefer “pp. 5, n. 2; 7, n. 4” to “p. 5, n. 2; p. 7, n. 4”).
In this case, set `print prefix of first subtype` In this case, set `print prefix of first subtype`
or `\crfnmDefaultPrintFirstPrefix` to `once`. or `\crfnmDefaultPrintFirstPrefix` to `once`.
@ -249,7 +345,7 @@ Otherwise you will get:
\def\crfnmDefaultPrintFirstPrefix{always} \def\crfnmDefaultPrintFirstPrefix{always}
``` ```
If you want to format the second subtype in a special way (e.g. in superscript), If you want to [format the second subtype]{#fmt-sec-subt} in a special way (e.g. in superscript),
set the key `formatting when second subtype` either to `{}` (no formatting) set the key `formatting when second subtype` either to `{}` (no formatting)
or to a macro which will take the reference number and all its affixes as its only argument (e.g. `\textsuperscript`). or to a macro which will take the reference number and all its affixes as its only argument (e.g. `\textsuperscript`).
Alternatively, you can define `\crfnmDefaultFormatInSecond` with one argument. Alternatively, you can define `\crfnmDefaultFormatInSecond` with one argument.
@ -264,7 +360,7 @@ What `\crossrefenum` comes with is:
\def\crfnmDefaultFormatInSecond#1{#1} \def\crfnmDefaultFormatInSecond#1{#1}
``` ```
If you don't want any prefix to be printed in the second term of a double reference, [If you don't want any prefix to be printed in the second term of a double reference]{#rep-pref-dbl},
set `print prefix when second subtype?` set `print prefix when second subtype?`
or `\crfnmDefaultPrintPrefixInSecond` to `no` (built-in: yes). or `\crfnmDefaultPrintPrefixInSecond` to `no` (built-in: yes).
@ -287,8 +383,8 @@ when it comes after the corresponding page number:
After that, `\crossrefenum[edpageline]{mylabel}` may return “p. 5^10^”, After that, `\crossrefenum[edpageline]{mylabel}` may return “p. 5^10^”,
whereas `\crossrefenum[edline]{mylabel}` would return “l. 10”. whereas `\crossrefenum[edline]{mylabel}` would return “l. 10”.
You can specify a specific delimiter for the second part of double references and a specific string You can specify a [specific delimiter for the second part of double references]{#delim-sec-dbl}
to be printed before the last reference of the second subtype in a double reference and a specific string to be printed before the last reference of the second subtype in a double reference
(e.g. the last reference to a line in “p. 5, l. 10, 13, 16”, which is “16”). (e.g. the last reference to a line in “p. 5, l. 10, 13, 16”, which is “16”).
For instance, you may want to use the word “and” For instance, you may want to use the word “and”
before the last note number if the reference type is a simple one (`note`) before the last note number if the reference type is a simple one (`note`)
@ -312,12 +408,12 @@ but we could imagine the following:
``` ```
`\noindentation`{=context} which may yield: “n. 1; 2 and 5 = p. 8, n. 1, 2, 5”. `\noindentation`{=context} which may yield: “n. 1; 2 and 5 = p. 8, n. 1, 2, 5”.
When citing a range, the two parts of the reference can [When citing a range, the two parts of the reference]{#group-subt} can
be either split (e.g. “p. 5, l. 3 p. 7, l. 44”) be either split (e.g. “p. 5, l. 3 p. 7, l. 44”)
or grouped (“p. 57, l. 344”). or grouped (“p. 57, l. 344”).
This is controlled via `group subtypes?` (= `\crfnmDefaultGroupSubtypes`), This is controlled via `group subtypes?` (= `\crfnmDefaultGroupSubtypes`),
which can be set to `yes` or `no`. which can be set to `yes` or `no`.
This works only with [collapsable types](#collapsable-types): This works only with [collapsable types](#collapsable):
```{.tex} ```{.tex}
\crfnmsetup[default]{group subtypes? = no} \crfnmsetup[default]{group subtypes? = no}
@ -330,7 +426,7 @@ This works only with [collapsable types](#collapsable-types):
To know if a reference to “p. 6, l. 34” should be merged with “p. 7, l. 35”, To know if a reference to “p. 6, l. 34” should be merged with “p. 7, l. 35”,
_crossrefenum_ needs to know if the lineation is _crossrefenum_ needs to know if the lineation is
continuous (in this case, these lines are consecutive) [continuous]{#numb-contin} (in this case, these lines are consecutive)
or per page (they are not, so they should not be merged). or per page (they are not, so they should not be merged).
You can set accordingly `continuous numbering?` You can set accordingly `continuous numbering?`
(= `\crfnmDefaultNumberingContinuousAcrossDocument`)[^line-numbering] (= `\crfnmDefaultNumberingContinuousAcrossDocument`)[^line-numbering]
@ -344,7 +440,7 @@ if the lineation is not continuous.
or `\crfnmEdlineNumberingContinuousAcrossDocument` or `\crfnmEdlineNumberingContinuousAcrossDocument`
or use `\crfnmsetup` with `[line]` and `[edline]`. or use `\crfnmsetup` with `[line]` and `[edline]`.
In the built-in configuration, the order of the subtypes in the name of a subtype In the built-in configuration, the [order of the subtypes]{#order} in the name of a subtype
(e.g. “page” and “note” in “pagenote”) determines by default (e.g. “page” and “note” in “pagenote”) determines by default
the order in which they are printed (e.g. “p. 6, n. 2” instead of “n. 2, p. 6”). the order in which they are printed (e.g. “p. 6, n. 2” instead of “n. 2, p. 6”).
If you want to change this, set `order` (= `\crfnmDefaultOrder`) to `inverted` (built-in: `normal`). If you want to change this, set `order` (= `\crfnmDefaultOrder`) to `inverted` (built-in: `normal`).

View File

@ -5,10 +5,12 @@ local function set_break_points(code)
local broken_code = {} local broken_code = {}
for a, b in string.gmatch(raw_code, '([^a-zA-Z\\]?)([A-Z\\]?[a-z.]*)') do for a, b in string.gmatch(raw_code, '([^a-zA-Z\\]?)([A-Z\\]?[a-z.]*)') do
if a ~= '' then if a ~= '' then
a = string.gsub(a, ' ', ' ') -- the leading/trailing spaces get gobbled
table.insert(broken_code, ZERO_WD_SP) table.insert(broken_code, ZERO_WD_SP)
table.insert(broken_code, pandoc.Code(a)) table.insert(broken_code, pandoc.Code(a))
end end
if b ~= '' then if b ~= '' then
b = string.gsub(b, ' ', ' ')
table.insert(broken_code, ZERO_WD_SP) table.insert(broken_code, ZERO_WD_SP)
table.insert(broken_code, pandoc.Code(b)) table.insert(broken_code, pandoc.Code(b))
end end

10
doc/microfixes-doc.sh Normal file
View File

@ -0,0 +1,10 @@
sed -i 's/\\startplacetable\[location=none\]//' "$1"
sed -i 's/\\stopplacetable//' "$1"
sed -i 's/\\startxtable$/\\startxtable[toffset=.16\\baselineskip,boffset=.16\\baselineskip,frame=off,split=yes]/' "$1"
sed -i 's/width={0\.13/width={0.25/' "$1"
sed -i 's/width={0\.35/width={0.28/' "$1"
sed -i 's/width={0\.16/width={0.30/' "$1"
sed -i 's/width={0\.11/width={0.12/' "$1"
sed -i 's/width={0\.23/width={0.05/' "$1"
sed -i 's/nc=3/nc=3,topframe=on,bottomframe=on,roffset=1cm/' "$1"
sed -i 's/nc=2/nc=2,topframe=on,bottomframe=on/' "$1"

83
doc/table-config.txt Normal file
View File

@ -0,0 +1,83 @@
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|**Configuration |**Configuration macro (with `\def`)** |**Meaning** |**Example** |**Page** |
|key (with | | | | |
|`\crfnmsetup`)** | | | | |
+=================+===============================================+=====================+==============+==============================+
|`<type>` _is a single type_ |`page` |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`sg` |`\crfnm<type>` |Singular prefix |`{p. }` |`\at[prefixes]`{=context} |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`pl` |`\crfnm<type>s` |Plural prefix |`{pp. }` |`\at[prefixes]`{=context} |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`delimiter` |`\crfnm<type>EnumDelim` |Delimiter between |`{, }` |`\at[delimiters]`{=context} |
| | |references | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`before last |`\crfnm<type>BeforeLastInEnum` |Delimiter before the |`{ and }` |`\at[delimiters]`{=context} |
|reference` | |last reference | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`range separator`|`\crfnm<type>RangeSep` |Separator between the|`{\tt |`\at[range-sep]`{=context} |
| | |two values in a range|`{=context} | |
| | | |`}`{=context} | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`collapsable?` |`\crfnm<type>Collapsable` |Should consecutive |`yes` or `no` |`\at[collapsable]`{=context} |
| | |numbers (e.g. 2, 3, | | |
| | |4) be merged into a | | |
| | |range? | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`<type>` _is a double type_ |`pagenote` |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`subtypes |`\crfnm<type>SubtypesSep` |Separator between the|`{, }` |`\at[subtypes-sep]`{=context} |
|separator` | |two types of | | |
| | |references in a | | |
| | |double reference | | |
| | |(e.g. between the | | |
| | |page and note numbers| | |
| | |in a reference to a | | |
| | |note including the | | |
| | |page number) | | |
| | | | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`print prefix of |`\crfnm<type>PrintFirstPrefix` |Should the numbers of|`always` or |`\at[fst-pref-dbl]`{=context} |
|first subtype` | |the first subtype be |`once` | |
| | |prefixed always or | | |
| | |only for the first | | |
| | |reference in an | | |
| | |enumeration? | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`group subtypes?`|`\crfnm<type>GroupSubtypes` |Sould all the values |`yes` or `no` |`\at[group-subt]`{=context} |
| | |for each subtype be | | |
| | |printed separately? | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`order` |`\crfnm<type>Order` |Whether the subtypes |`normal` or |`\at[order]`{=context} |
| | |are printed in the |`inverted` | |
| | |same order as in the | | |
| | |name of the double | | |
| | |type | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`<type>` _is a single type; the following options apply when it is used as the second |`page` |
|subtype of a double type_ | |
| | |
| | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`formatting when |`\crfnm<type>FormatInSecond` |`{}` or a macro that |`\textbf` |`\at[fmt-sec-subt]`{=context} |
|second subtype` | |takes the prefixes | | |
| | |and numbers as its | | |
| | |argument | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`print prefix |`\crfnm<type>PrintPrefixInSecond` |Should the prefix be |`yes` or `no` |`\at[rep-pref-dbl]`{=context} |
|when second | |printed? | | |
|subtype?` | | | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`delimiter when |`\crfnm<type>EnumDelimInSecond` |Delimiter between |`{, }` |`\at[delim-sec-dbl]`{=context}|
|second subtype` | |references | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`before last |`\crfnm<type>BeforeLastInSecond` |Delimiter before the |`{ and }` |`\at[delim-sec-dbl]`{=context}|
|reference when | |last reference | | |
|second subtype` | | | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+
|`continuous |`\crfnm<type>NumberingContinuousAcrossDocument`|Is the numbering for |`yes` or `no` |`\at[numb-contin]`{=context} |
|numbering?` | |this type continuous | | |
| | |(i.e. not reset at | | |
| | |every | | |
| | |page/chapter/etc.)? | | |
+-----------------+-----------------------------------------------+---------------------+--------------+------------------------------+

View File

@ -37,7 +37,8 @@ for file in crossrefenum.md crossrefenum.pdf fixes.lua LICENSE_FDL_1-3.md Makefi
done done
cd ../test cd ../test
for file in config-crossrefenum.tex config-formats.tex data-common.tex data-lines.tex data-reledmac.tex format-specific-defs.tex main-test_context.pdf main-test_latex.pdf main-test.tex Makefile validated-output ; do cd ../../test/ && make check ; cd -
for file in config-crossrefenum.tex config-formats.tex data-common.tex data-lines.tex data-reledmac.tex format-specific-defs.tex main-test.pdf main-test.tex Makefile validated-output ; do
ln -s ../../test/$file $file ln -s ../../test/$file $file
done done
@ -47,5 +48,4 @@ for file in crossrefenum.sty crossrefenum.tex t-crossrefenum.tex ; do
done done
cd ../.. cd ../..
7z a -l crossrefenum.zip crossrefenum 7z a crossrefenum.zip crossrefenum && rm -r --interactive=never crossrefenum
rm -r --interactive=never crossrefenum

View File

@ -2,10 +2,10 @@
\def\crfnmName{crossrefenum} \def\crfnmName{crossrefenum}
\def\crfnmShortDesc{Smart typesetting of enumerated cross-references for various TeX formats} \def\crfnmShortDesc{Smart typesetting of enumerated cross-references for various TeX formats}
\def\crfnmAuthor{Bastien Dumont} \def\crfnmAuthor{Bastien Dumont}
\def\crfnmDate{2024/04/13} \def\crfnmDate{2025/08/07}
\def\crfnmVersion{1.1} \def\crfnmVersion{1.2}
% %
% Copyright 2022-2024 by Bastien Dumont (bastien.dumont@posteo.net) % Copyright 2022-2025 by Bastien Dumont (bastien.dumont@posteo.net)
% %
% crossrefenum.tex is free software: you can redistribute it and/or modify % crossrefenum.tex is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by % it under the terms of the GNU General Public License as published by