Compare commits

..

7 Commits

Author SHA1 Message Date
Bastien Dumont
cd1601abe0 Revert "Use t-crossrefenum.tex in the tests" (explained in t-crossrefenum.tex)
This reverts commit c0460c15a8.
2024-04-13 12:35:27 +02:00
Bastien Dumont
77de7e82ce Updated metatada in t-crossrefenum.tex 2024-04-13 12:35:24 +02:00
Bastien Dumont
9ee5e7efa3 Bump version number 2024-04-13 12:27:53 +02:00
Bastien Dumont
81d9cd4bde Fixes in typesetting the manual 2024-04-13 12:14:35 +02:00
Bastien Dumont
c3dd41d8e6 Added convenience macros to add types 2024-04-13 11:55:19 +02:00
Bastien Dumont
c0460c15a8 Use t-crossrefenum.tex in the tests 2024-04-13 10:49:25 +02:00
Bastien Dumont
f98bd8927e Fixes in the manual 2024-04-13 10:48:01 +02:00
6 changed files with 29 additions and 20 deletions

View File

@ -10,3 +10,6 @@
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 2023/02/20 v1.0.2 # crossrefenum 2024/04/13 v1.1
Smart typesetting of enumerated cross-references for various TeX formats. Smart typesetting of enumerated cross-references for various TeX formats.
Copyright (C) 2022-2023 Copyright (C) 2022-2024
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-2023 by Bastien Dumont (bastien.dumont@posteo.net) Copyright 2022-2024 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][linuxbiolinumo] \definefontfamily[mainface][ss][libertinussans]
\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-2023 Bastien Dumont. Copyright (C) 2022-2024 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: 2023/02/20 date: 2024/04/13
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_); must be called after _nameref_ if you use _hyperref_`\kern1.5pt`{=context});
* `\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 `\crfnmDefaultBeforeLastInEnumInSecond`. and `\crfnmDefaultBeforeLastInSecond`.
By default, these macros fall back respectively By default, these macros fall back respectively
on `\crfnmDefaultEnumDelim` and `\crfnmDefaultBeforeLastInEnum`. on `\crfnmDefaultEnumDelim` and `\crfnmDefaultBeforeLastInEnum`.
@ -215,6 +215,8 @@ 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!
@ -226,10 +228,8 @@ if this feature were not already included in _crossrefenum_.
\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@newListFrom[\crfnm@simpleRefTypes][\crfnm@line] -> \crfnm@simpleRefTypes \crfnm@declareType[simple][\crfnm@line]
\crfnm@newListFrom[\crfnm@doubleRefTypes][\crfnm@pageline] -> \crfnm@doubleRefTypes \crfnm@declareType[double][\crfnm@pageline]
\crfnm@newListFrom[\crfnm@supportedTypes][\crfnm@line] -> \crfnm@supportedTypes
\crfnm@newListFrom[\crfnm@supportedTypes][\crfnm@pageline] -> \crfnm@supportedTypes
``` ```
```{.tex} ```{.tex}
@ -244,6 +244,7 @@ if this feature were not already included in _crossrefenum_.
% 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
@ -275,7 +276,7 @@ If you have wishes or hints about this, please contact me.
## Compatibility issues ## Compatibility issues
With LaTeX, the _nameref_ package (required by _hyperref_) With LaTeX, the _nameref_ package (required by _hyperref_`\kern1.5pt`{=context})
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{2023/02/20} \def\crfnmDate{2024/04/13}
\def\crfnmVersion{1.0.2} \def\crfnmVersion{1.1}
% %
% Copyright 2022-2023 by Bastien Dumont (bastien.dumont@posteo.net) % Copyright 2022-2024 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,8 +472,7 @@
\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 a reference. % #2 is the reference appended to #1.
% #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}}%
@ -481,6 +480,12 @@
\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=%TODO, %D url=https://ctan.org/tex-archive/macros/generic/crossrefenum/tex/t-crossrefenum.tex,
%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]