summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cleveref-forward
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-02-27 03:01:34 +0000
committerNorbert Preining <norbert@preining.info>2024-02-27 03:01:34 +0000
commita64a01e8eaa2c096e7879421f075ebfa2a8bb7f0 (patch)
tree3726ebc26eeba6cb1b670adbd12559561ed8d72a /macros/latex/contrib/cleveref-forward
parent8dfcb0935597571483db587639fb662c93d775b1 (diff)
CTAN sync 202402270301
Diffstat (limited to 'macros/latex/contrib/cleveref-forward')
-rw-r--r--macros/latex/contrib/cleveref-forward/README.md18
-rw-r--r--macros/latex/contrib/cleveref-forward/cleveref-forward.sty56
-rw-r--r--macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.pdfbin58724 -> 65462 bytes
-rw-r--r--macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.tex18
4 files changed, 49 insertions, 43 deletions
diff --git a/macros/latex/contrib/cleveref-forward/README.md b/macros/latex/contrib/cleveref-forward/README.md
index 4a67b0cdd3..aab25e04a5 100644
--- a/macros/latex/contrib/cleveref-forward/README.md
+++ b/macros/latex/contrib/cleveref-forward/README.md
@@ -2,24 +2,26 @@
# `cleveref-forward` — Forward-referencing functionality for cleveref
-`cleveref-forward` aims at providing the forward-referencing functionality to `cleveref`.
+`cleveref-forward` aims at providing the forward-referencing functionality for the package `cleveref`.
-This package is derived from the package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon), with several fixes and enhancements.
+> This package is derived from the package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon), with several fixes and enhancements.
+
+> Package dependencies: [`cleveref`](https://ctan.org/pkg/cleveref), [*`crefthe`*](https://ctan.org/pkg/crefthe), [`iflang`](https://ctan.org/pkg/iflang), [`regexpatch`](https://ctan.org/pkg/regexpatch).
## Regarding the usage
It might be a good idea to start with the [demo documents](https://github.com/Jinwen-XU/cleveref-forward/tree/main/demo).
-> The documentation and examples written by Sven Pistre for the original package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon) are also very inspiring (but be aware that the usage has changed a lot, so some of the code there may no longer work here).
+> The [documentation](http://mirrors.ctan.org/macros/latex/contrib/cleveref-usedon/cleveref-usedon.pdf) and [examples](https://github.com/SvenPistre/cleveref-usedon/tree/main/examples) written by Sven Pistre for the original package `cleveref-usedon` are also very inspiring (but be aware that the usage has changed a lot, so some of the code there may no longer work here).
## Known issues / what to do next
-- The multilingual support is not yet perfect.
-- The code is somewhat messy for now, and the naming of many macros should be made better.
-- The support for displayed maths is still not perfect.
-- Not all configuration yields nice result, more examples are needed.
+- This package currently works for English, French, German, Italian and Spanish — certainly more languages would be added to this list in the future.
+- The code is somewhat messy for now, and the naming of many macros could be improved.
+- The support for displayed maths is still not perfect: currently, if you choose to print the forward-referencing message outside the math environment, then for `equation`, `multline` and `dmath`, it works nicely (you may need to configure `cleveref` to make it work with `dmath`); but for `align`, `flalign`, `alignat` and `gather`, it would only show the message for the last labeled line. The inside-math mode has no such limitation, but it would require sufficient margin width.
+- Not all configuration yields nice result, more appealing examples are needed.
-The original package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon) is better in terms of documentation, while the current package is slightly more advanced in terms of code. It is hoped that one day they can be combined into a better version.
+The original package [`cleveref-usedon`](https://ctan.org/pkg/cleveref-usedon) is nicer in terms of documentation, while the current package is slightly more advanced in terms of code. It is hoped that one day they can be combined into a better version.
## Acknowledgement
diff --git a/macros/latex/contrib/cleveref-forward/cleveref-forward.sty b/macros/latex/contrib/cleveref-forward/cleveref-forward.sty
index b40f53fd44..c23612adc0 100644
--- a/macros/latex/contrib/cleveref-forward/cleveref-forward.sty
+++ b/macros/latex/contrib/cleveref-forward/cleveref-forward.sty
@@ -13,7 +13,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage{cleveref-forward}
- {2024/02/24} {}
+ {2024/02/25} {}
{Forward-referencing functionality for cleveref}
\keys_define:nn { cleveref-forward }
@@ -21,28 +21,28 @@
, default .tl_set:N = \l__crfwd_default_package_option_tl
, default .initial:n = { }
, default .value_required:n = true
- , Used-On .meta:n = { default = UsedOn }
- , Used~On .meta:n = { default = UsedOn }
- , Used On .meta:n = { default = UsedOn }
- , used-on .meta:n = { default = UsedOn }
- , used~on .meta:n = { default = UsedOn }
- , used on .meta:n = { default = UsedOn }
- , uo .meta:n = { default = UsedOn }
- , Used-By .meta:n = { default = UsedBy }
- , Used~By .meta:n = { default = UsedBy }
- , Used By .meta:n = { default = UsedBy }
- , used-by .meta:n = { default = UsedBy }
- , used~by .meta:n = { default = UsedBy }
- , used by .meta:n = { default = UsedBy }
- , ub .meta:n = { default = UsedBy }
- , Used-By-And-On .meta:n = { default = UsedByAndOn }
- , Used~By~And~On .meta:n = { default = UsedByAndOn }
- , Used By And On .meta:n = { default = UsedByAndOn }
- , used-by-and-on .meta:n = { default = UsedByAndOn }
- , used~by~and~on .meta:n = { default = UsedByAndOn }
- , used by and on .meta:n = { default = UsedByAndOn }
- , ubao .meta:n = { default = UsedByAndOn }
- , ubo .meta:n = { default = UsedByAndOn }
+ , Used-On .meta:n = { default = used-on }
+ , Used~On .meta:n = { default = used-on }
+ , Used On .meta:n = { default = used-on }
+ , used-on .meta:n = { default = used-on }
+ , used~on .meta:n = { default = used-on }
+ , used on .meta:n = { default = used-on }
+ , uo .meta:n = { default = used-on }
+ , Used-By .meta:n = { default = used-by }
+ , Used~By .meta:n = { default = used-by }
+ , Used By .meta:n = { default = used-by }
+ , used-by .meta:n = { default = used-by }
+ , used~by .meta:n = { default = used-by }
+ , used by .meta:n = { default = used-by }
+ , ub .meta:n = { default = used-by }
+ , Used-By-And-On .meta:n = { default = used-by-and-on }
+ , Used~By~And~On .meta:n = { default = used-by-and-on }
+ , Used By And On .meta:n = { default = used-by-and-on }
+ , used-by-and-on .meta:n = { default = used-by-and-on }
+ , used~by~and~on .meta:n = { default = used-by-and-on }
+ , used by and on .meta:n = { default = used-by-and-on }
+ , ubao .meta:n = { default = used-by-and-on }
+ , ubo .meta:n = { default = used-by-and-on }
, crefthe .bool_set:N = \l__crfwd_crefthe_enabled_bool
, crefthe .initial:n = { false }
@@ -57,14 +57,16 @@
\RequirePackage { crefthe }
}
-\newcommand*{\@setcpagerefrange}[3]{%
+% Fix for cleveref in order to work with long range of pages
+% See https://tex.stackexchange.com/a/620066
+\providecommand*{\@setcpagerefrange}[3]{%
\@@setcpagerefrange{#1}{#2}{cref}{#3}}
-\newcommand*{\@setCpagerefrange}[3]{%
+\providecommand*{\@setCpagerefrange}[3]{%
\@@setcpagerefrange{#1}{#2}{Cref}{#3}}
-\newcommand*{\@setlabelcpagerefrange}[3]{%
+\providecommand*{\@setlabelcpagerefrange}[3]{%
\@@setcpagerefrange{#1}{#2}{labelcref}{#3}}
-% Temporary fix for cleveref in order to work with xr-hyper
+% Fix for cleveref in order to work with xr-hyper
% See https://tex.stackexchange.com/a/708445
\def\cref@getref#1#2{%
\expandafter\let\expandafter#2\csname r@#1@cref\endcsname%
diff --git a/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.pdf b/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.pdf
index 1c7bfaedba..96eb808702 100644
--- a/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.pdf
+++ b/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.pdf
Binary files differ
diff --git a/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.tex b/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.tex
index 8c3595ce26..fec042a3a6 100644
--- a/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.tex
+++ b/macros/latex/contrib/cleveref-forward/demo/cleveref-forward-demo.tex
@@ -1,5 +1,5 @@
\documentclass[
- use style = plain,
+ % use style = plain,
title in boldface,
% title in sffamily,
emphasize theorems,
@@ -8,6 +8,8 @@
]{einfart}
\usepackage{ProjLib}
+\setmonofont[Scale=.9]{Iosevka}
+
\usepackage[crefthe]{cleveref-forward}
\usepackage{changepage,todonotes,marginnote}
@@ -32,7 +34,7 @@
breaklines = true,
frame = lines,
backgroundcolor = \color{code-background},
- flexiblecolumns = true,
+ basewidth = .5em,
escapeinside = {(*}{*)},
alsoletter = {_,:},
% numbers = left,
@@ -81,8 +83,8 @@
\lstnewenvironment{code}{\setstretch{1.05}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}}
\lstnewenvironment{code*}{\setstretch{1.05}\lstset{numbers=left}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}}
-\newcommand{\packageoption}[1]{\texttt{\textcolor{code-option}{#1}}}
-\newcommand{\commandoption}[1]{\texttt{\textcolor{code-keys}{#1}}}
+\newcommand{\packageoption}[1]{\textcolor{code-option}{\texttt{#1}}}
+\newcommand{\commandoption}[1]{\textcolor{code-keys}{\texttt{#1}}}
%%================================
%% tip
@@ -157,7 +159,7 @@ It can also be used for some other types, such as items in \texttt{enumerate} li
\section{Specify a default option}
-If you wish to apply the mode \commandoption{used on}, or \commandoption{used by}, or \commandoption{used by and on} to all \lstinline|\cref| (and \lstinline|\labelcref|, etc.), you can use the package option \packageoption{default = }\meta{mode}. Then you don't need to write it everywhere. And if you wish to manually change this \meta{mode} somewhere, you can still specify it as the command option; and if you don't want the message to display for some references, you may also use the option \commandoption{no use} on the corresponding \lstinline|\label| to disable the related messages.
+If you wish to apply the mode \commandoption{used on}, or \commandoption{used by}, or \commandoption{used by and on} to all \lstinline|\cref| (and \lstinline|\labelcref|, etc.), you can use the package option \packageoption{default=}\meta{mode}. Then you don't need to write it everywhere. And if you wish to manually change this \meta{mode} somewhere, you can still specify it as the command option; and if you don't want the message to display for some references, you may also use the option \commandoption{no use} on the corresponding \lstinline|\label| to disable the related messages.
\section{Customizations}
@@ -177,7 +179,7 @@ Here is how you change the appearing text:
\SetUsedByAndOnMessageText{Appears in~#1 on~#2.}
\bigskip
-And here is an example of setting the message style with \textsf{todonotes}:
+And here is an example of setting the message style with the package \textsf{todonotes}:
\begin{code}
\SetForwardReferenceStyle
@@ -263,7 +265,7 @@ We use the same example:
\bigskip
As you might have noticed, \lstinline|\SetForwardReferenceStyleOutsideMath| is for setting the style of those messages that appear outside the equations.
-There is also a \lstinline|\SetForwardReferenceStyleInsideMath|, which triggers the message immediately at where you placed the label. This way it is only plausible to put the message inside the margin. For example, you may configure:
+There is also a \lstinline|\SetForwardReferenceStyleInsideMath|, which triggers the message immediately at where you placed the label. This way it is only plausible to put the message inside the margin. For example, with the package \textsf{marginnote} loaded, you may configure:
\begin{code}
\SetForwardReferenceStyle
@@ -348,7 +350,7 @@ By the way, here is the default setting for the style:
%% You can safely ignore the code between \ExplSyntaxOn and \ExplSyntaxOff
%% They are just for resetting the theorem referencing style for the rest of the document
\ExplSyntaxOn
-\input{create-theorem-preset-names} % simple-name mode is not suitable for French, German, etc.
+\input{create-theorem-preset-names-cleveref} % simple-name mode is not suitable for French, German, etc.
\exp_args:No \SetTheorem { \c_projlib_theorem_supported_clist, theorem-with-name } % remove the text style in the references
{
name style = {