Skip to content
Snippets Groups Projects
Commit 8209d0f7 authored by Lorenzo Ferron's avatar Lorenzo Ferron
Browse files

Migliorato \lref.

parent eba1231f
No related branches found
No related tags found
No related merge requests found
%! Author = lorenzo %! Author = lorenzo
%! Date = 11/08/2022 %! Date = 22/08/22
\newcommand{\lref}[1]{{\csname cref@line@name\endcsname}~\hyperlink{#1}{\ref*{#1}}}
\newcommand{\lrefrange}[2]{{\csname cref@line@name@plural\endcsname}~\hyperlink{#1}{\ref*{#1}}--\hyperlink{#2}{\ref*{#2}}} \newcommand{\lrefrange}[2]{{\csname cref@line@name@plural\endcsname}~\hyperlink{#1}{\ref*{#1}}--\hyperlink{#2}{\ref*{#2}}}
%% Use ONLY \lref NOT \lreflst
\ExplSyntaxOn
\NewDocumentCommand{\lref}{m}
{
\clist_set:Nn \l_jour_command_input_clist { #1 }
\exp_args:Nf \lreflst { \clist_use:Nn \l_jour_command_input_clist {,} }
}
\clist_new:N \l_jour_command_input_clist
\ExplSyntaxOff
\newcommand{\lreflst}[1]{%
\count255=0%
\def\do##1{\advance\count255 1 \chardef\finalitem=\count255 }%
\docsvlist{#1}%
\ifnum\count255=1
{\csname cref@line@name\endcsname}~%
\else
{\csname cref@line@name@plural\endcsname}~%
\fi%
\count255=0%
\def\do##1{\advance\count255 1
\ifnum\finalitem=1
\else
\ifnum\count255=\finalitem
\space e\space%
\else
\ifnum\count255=1
\else
,\space%
\fi%
\fi\fi\hyperlink{##1}{\ref*{##1}}}%
\docsvlist{#1}}%
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment