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. 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. 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> by Bastien Dumont <bastien.dumont@posteo.net>
CTAN: `macros/generic/crossrefenum` CTAN: `macros/generic/crossrefenum`
@ -66,7 +66,7 @@ and put in it `crossrefenum.tex` and, if required,
## License ## 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 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

@ -22,7 +22,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][linuxbiolinumo]
\definefontfamily[mainface][tt][nimbusmonops][features=none] \definefontfamily[mainface][tt][nimbusmonops][features=none]
\setupbodyfont[mainface,12pt] \setupbodyfont[mainface,12pt]
@ -116,7 +116,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-2023 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;
@ -136,4 +136,4 @@ $endif$
$body$ $body$
\stoptext \stoptext

View File

@ -2,7 +2,7 @@
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 date: 2023/02/20
lang: en-US lang: en-US
toc: true toc: true
license: true license: true
@ -40,7 +40,7 @@ you can do:
* `\input{crossrefenum}` (generic); * `\input{crossrefenum}` (generic);
* `\usepackage{crossrefenum}` (LaTeX; * `\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). * `\usemodule[crossrefenum]` (ConTeXt).
## Basic invocation ## 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`), 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`). and a comma if it is comes in second in a double reference (e.g. in `pagenote`).
To achieve this, you should redefine `\crfnmDefaultEnumDelimInSecond` To achieve this, you should redefine `\crfnmDefaultEnumDelimInSecond`
and `\crfnmDefaultBeforeLastInSecond`. and `\crfnmDefaultBeforeLastInEnumInSecond`.
By default, these macros fall back respectively By default, these macros fall back respectively
on `\crfnmDefaultEnumDelim` and `\crfnmDefaultBeforeLastInEnum`. 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. 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 Here is a commented example that would add support for references to lines in ConTeXt
if this feature were not already included in _crossrefenum_. 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} ```{.tex}
% Register the types. Take care about capitalization! % 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} \def\crfnm@pageline{Pageline}
%% Add them to the lists of known types. %% Add them to the lists of known types.
\crfnm@declareType[simple][\crfnm@line] \crfnm@newListFrom[\crfnm@simpleRefTypes][\crfnm@line] -> \crfnm@simpleRefTypes
\crfnm@declareType[double][\crfnm@pageline] \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} ```{.tex}
@ -244,7 +244,6 @@ i.e. `\someline` for line references and `\pagereference` for page references.
% Define the macro used by \crossrefenum internally % Define the macro used by \crossrefenum internally
% to retrieve the raw reference number without typesetting it. % to retrieve the raw reference number without typesetting it.
% This macro must be purely expandable.
% If you want to support multiple formats, % If you want to support multiple formats,
% see how the macro \crfnm@case is used in crossrefenum.tex. % see how the macro \crfnm@case is used in crossrefenum.tex.
% Note: the Lua function get_raw_ref_number is defined % 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 ## 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_. must be loaded explicitely before _crossrefenum_.
However, if the links in the output of `\crossrefenum` (not the numbers) However, if the links in the output of `\crossrefenum` (not the numbers)
point to a wrong location, you may wish to patch the macro point to a wrong location, you may wish to patch the macro

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{2023/02/20}
\def\crfnmVersion{1.1} \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 % 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
@ -472,7 +472,8 @@
\def\crfnm@newListFrom[#1][#2] -> #3{% \def\crfnm@newListFrom[#1][#2] -> #3{%
% #1 is either a list or a reference. % #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. % #3 is the control sequence which the resulting list will be bound to.
\crfnm@ifIsList[#1]{% \crfnm@ifIsList[#1]{%
\edef#3{#1{#2}}% \edef#3{#1{#2}}%
@ -480,12 +481,6 @@
\edef#3{{#1}{#2}}% \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{% \def\crfnm@replaceFirstInList[#1]#2{%
% #1 is a token, #2 is a list of tokens % #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 subtitle=Smart typesetting of enumerated cross-references for various TeX formats,
%D author=Bastien Dumont, %D author=Bastien Dumont,
%D date=2022/11/11, %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 copyright=Bastien Dumont,
%D license=GNU Public License v. 3.0 or higher] %D license=GNU Public License v. 3.0 or higher]