Compare commits

..

No commits in common. "cd1601abe011cfe75ed0cb1034260d79d01b9192" and "ff8d8136370e14bc1ce11dfa45a6df76cd1c14e1" have entirely different histories.

6 changed files with 20 additions and 29 deletions

View File

@ -10,6 +10,3 @@
Fixed some minor issues in version numbers and in the manual.
### 2024/04/13: Version 1.1
Various fixes in the documentation and new convenience macro `\crfnm@declareType`.

View File

@ -1,8 +1,8 @@
# crossrefenum 2024/04/13 v1.1
# crossrefenum 2023/02/20 v1.0.2
Smart typesetting of enumerated cross-references for various TeX formats.
Copyright (C) 2022-2024
Copyright (C) 2022-2023
by Bastien Dumont <bastien.dumont@posteo.net>
CTAN: `macros/generic/crossrefenum`
@ -66,7 +66,7 @@ and put in it `crossrefenum.tex` and, if required,
## License
Copyright 2022-2024 by Bastien Dumont (bastien.dumont@posteo.net)
Copyright 2022-2023 by Bastien Dumont (bastien.dumont@posteo.net)
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

View File

@ -22,7 +22,7 @@ $endif$
\setupbodyfontenvironment[default][em=italic]
\definefontfamily[mainface][rm][cochineal]
\definefontfamily[mainface][ss][libertinussans]
\definefontfamily[mainface][ss][linuxbiolinumo]
\definefontfamily[mainface][tt][nimbusmonops][features=none]
\setupbodyfont[mainface,12pt]
@ -116,7 +116,7 @@ $endif$
$if(license)$
\startlicensepagemakeup
\inframed[frame=off, width=0.66\textwidth, align=normal]{%
Copyright (C) 2022-2024 Bastien Dumont.
Copyright (C) 2022-2023 Bastien Dumont.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;

View File

@ -2,7 +2,7 @@
title: "crossrefenum"
subtitle: "Smart typesetting of enumerated cross-references for various TeX formats"
author: Bastien Dumont
date: 2024/04/13
date: 2023/02/20
lang: en-US
toc: true
license: true
@ -40,7 +40,7 @@ you can do:
* `\input{crossrefenum}` (generic);
* `\usepackage{crossrefenum}` (LaTeX;
must be called after _nameref_ if you use _hyperref_`\kern1.5pt`{=context});
must be called after _nameref_ if you use _hyperref_);
* `\usemodule[crossrefenum]` (ConTeXt).
## Basic invocation
@ -164,7 +164,7 @@ for instance, you may want to use the word “and”
before the last note number if the reference type is a simple one (`note`),
and a comma if it is comes in second in a double reference (e.g. in `pagenote`).
To achieve this, you should redefine `\crfnmDefaultEnumDelimInSecond`
and `\crfnmDefaultBeforeLastInSecond`.
and `\crfnmDefaultBeforeLastInEnumInSecond`.
By default, these macros fall back respectively
on `\crfnmDefaultEnumDelim` and `\crfnmDefaultBeforeLastInEnum`.
@ -215,8 +215,6 @@ use an empty group (e.g. `\def\crfnmPageEnumDelim{}`).
Adding support for new types consists in defining the related macros in your preamble.
Here is a commented example that would add support for references to lines in ConTeXt
if this feature were not already included in _crossrefenum_.
We suppose that the labels are inserted in the document using the standard ConTeXt macros,
i.e. `\someline` for line references and `\pagereference` for page references.
```{.tex}
% Register the types. Take care about capitalization!
@ -228,8 +226,10 @@ i.e. `\someline` for line references and `\pagereference` for page references.
\def\crfnm@pageline{Pageline}
%% Add them to the lists of known types.
\crfnm@declareType[simple][\crfnm@line]
\crfnm@declareType[double][\crfnm@pageline]
\crfnm@newListFrom[\crfnm@simpleRefTypes][\crfnm@line] -> \crfnm@simpleRefTypes
\crfnm@newListFrom[\crfnm@doubleRefTypes][\crfnm@pageline] -> \crfnm@doubleRefTypes
\crfnm@newListFrom[\crfnm@supportedTypes][\crfnm@line] -> \crfnm@supportedTypes
\crfnm@newListFrom[\crfnm@supportedTypes][\crfnm@pageline] -> \crfnm@supportedTypes
```
```{.tex}
@ -244,7 +244,6 @@ i.e. `\someline` for line references and `\pagereference` for page references.
% Define the macro used by \crossrefenum internally
% to retrieve the raw reference number without typesetting it.
% This macro must be purely expandable.
% If you want to support multiple formats,
% see how the macro \crfnm@case is used in crossrefenum.tex.
% Note: the Lua function get_raw_ref_number is defined
@ -276,7 +275,7 @@ If you have wishes or hints about this, please contact me.
## Compatibility issues
With LaTeX, the _nameref_ package (required by _hyperref_`\kern1.5pt`{=context})
With LaTeX, the _nameref_ package (required by _hyperref_)
must be loaded explicitely before _crossrefenum_.
However, if the links in the output of `\crossrefenum` (not the numbers)
point to a wrong location, you may wish to patch the macro

View File

@ -2,10 +2,10 @@
\def\crfnmName{crossrefenum}
\def\crfnmShortDesc{Smart typesetting of enumerated cross-references for various TeX formats}
\def\crfnmAuthor{Bastien Dumont}
\def\crfnmDate{2024/04/13}
\def\crfnmVersion{1.1}
\def\crfnmDate{2023/02/20}
\def\crfnmVersion{1.0.2}
%
% Copyright 2022-2024 by Bastien Dumont (bastien.dumont@posteo.net)
% Copyright 2022-2023 by Bastien Dumont (bastien.dumont@posteo.net)
%
% 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
@ -472,7 +472,8 @@
\def\crfnm@newListFrom[#1][#2] -> #3{%
% #1 is either a list or a reference.
% #2 is the reference appended to #1.
% #2 is a reference.
% #2 is appended to #1.
% #3 is the control sequence which the resulting list will be bound to.
\crfnm@ifIsList[#1]{%
\edef#3{#1{#2}}%
@ -480,12 +481,6 @@
\edef#3{{#1}{#2}}%
}%
}
\def\crfnm@addToList[#1][#2]{\crfnm@newListFrom[#1][#2] -> #1}
\def\crfnm@declareType[#1][#2]{%
% #1 is "simple" or "double", #2 is the type
\expandafter\crfnm@addToList\expandafter[\csname crfnm@#1RefTypes\endcsname][#2]%
\crfnm@addToList[\crfnm@supportedTypes][#2]%
}
\def\crfnm@replaceFirstInList[#1]#2{%
% #1 is a token, #2 is a list of tokens

View File

@ -5,7 +5,7 @@
%D subtitle=Smart typesetting of enumerated cross-references for various TeX formats,
%D author=Bastien Dumont,
%D date=2022/11/11,
%D url=https://ctan.org/tex-archive/macros/generic/crossrefenum/tex/t-crossrefenum.tex,
%D url=%TODO,
%D copyright=Bastien Dumont,
%D license=GNU Public License v. 3.0 or higher]