separators in label names

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

separators in label names

Murray Eisenberg
From George Grätzer’s “More Math into LaTeX” (or earlier versions of it), I adopted the convention of using as label names phrases of the form “type:description”, e.g.:

        \label{thm:law-lare-numbers}
        \label{eq:prod-of-sums}

For a book, I’m using, among many other packages, babel and crossreftools. Recently I’ve discovered that the “french” option to babel gives a conflict with mnay commands from crossreftools when label names include colons. (The trouble is caused by babel-french.ldf, where the colon is made an active character along with semicolon, exclamation mark, and question mark.)

I could replace those colons by hyphens, but then that destroys the visual distinction between the type of object (theorem, equation, etc.) being labeled and the description, including hyphens, of the particular object of that type.

The colon was, for me, the perfect separator to use, as it nicely separates the two parts of the label names yet is not obtrusive.

Do you have any recommendation for what character to use —  one that is suitable for the purposes my use of it as author yet is safe in that it is unlikely to be made active by some package and thereby cause the same clash as the colon?

I considered the vertical bar “|” but am concerned that something could make it active as well as that it is somewhat obtrusive.

(For reference, please see https://tex.stackexchange.com/questions/511030/another-babel-french-incompatibility-with-crossreftools and the other posts it references.)

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Ettore Aldrovandi
Why not an underscore?

\label{thm_law-lare-numbers}

But I feel the pain: Emacs + AUCTeX automatically uses a colon (by default) as a separator.

—Ettore

Ettore Aldrovandi
Department of Mathematics, Florida State University
1017 Academic Way                *   http://www.math.fsu.edu/~ealdrov
Tallahassee, FL 32306-4510, USA * * aldrovandi at math dot fsu dot edu

On Oct 5, 2019, at 15:24, Murray Eisenberg <[hidden email]> wrote:

From George Grätzer’s “More Math into LaTeX” (or earlier versions of it), I adopted the convention of using as label names phrases of the form “type:description”, e.g.:

\label{thm:law-lare-numbers}
\label{eq:prod-of-sums}

For a book, I’m using, among many other packages, babel and crossreftools. Recently I’ve discovered that the “french” option to babel gives a conflict with mnay commands from crossreftools when label names include colons. (The trouble is caused by babel-french.ldf, where the colon is made an active character along with semicolon, exclamation mark, and question mark.)

I could replace those colons by hyphens, but then that destroys the visual distinction between the type of object (theorem, equation, etc.) being labeled and the description, including hyphens, of the particular object of that type.

The colon was, for me, the perfect separator to use, as it nicely separates the two parts of the label names yet is not obtrusive.

Do you have any recommendation for what character to use —  one that is suitable for the purposes my use of it as author yet is safe in that it is unlikely to be made active by some package and thereby cause the same clash as the colon?

I considered the vertical bar “|” but am concerned that something could make it active as well as that it is somewhat obtrusive.

(For reference, please see https://tex.stackexchange.com/questions/511030/another-babel-french-incompatibility-with-crossreftools and the other posts it references.)

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
               https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex



----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Piet van Oostrum-4
In reply to this post by Murray Eisenberg
Murray Eisenberg <[hidden email]> writes:

> From George Grätzer’s “More Math into LaTeX” (or earlier versions of it), I adopted the convention of using as label names phrases of the form “type:description”, e.g.:
>
> \label{thm:law-lare-numbers}
> \label{eq:prod-of-sums}
>
> For a book, I’m using, among many other packages, babel and crossreftools. Recently I’ve discovered that the “french” option to babel gives a conflict with mnay commands from crossreftools when label names include colons. (The trouble is caused by babel-french.ldf, where the colon is made an active character along with semicolon, exclamation mark, and question mark.)
>
> I could replace those colons by hyphens, but then that destroys the visual distinction between the type of object (theorem, equation, etc.) being labeled and the description, including hyphens, of the particular object of that type.
>
> The colon was, for me, the perfect separator to use, as it nicely separates the two parts of the label names yet is not obtrusive.
>
> Do you have any recommendation for what character to use —  one that is suitable for the purposes my use of it as author yet is safe in that it is unlikely to be made active by some package and thereby cause the same clash as the colon?
>
> I considered the vertical bar “|” but am concerned that something could make it active as well as that it is somewhat obtrusive.
>
> (For reference, please see https://tex.stackexchange.com/questions/511030/another-babel-french-incompatibility-with-crossreftools and the other posts it references.)

I posted this solution on stackexchange:

\edef\myoldcatcode{\the\catcode`\:}
\let\myoriglabel\label
\def\label{\catcode`\:=11 \mynewlabel}
\def\mynewlabel#1{\myoriglabel{#1}\catcode`\:=\myoldcatcode}

--
Piet van Oostrum <[hidden email]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Murray Eisenberg
That redefinition of \label seems not to be robust — see my comment to https://tex.stackexchange.com/a/511212/13492 .

On 6 Oct2019, at 3:06 PM, Piet van Oostrum <[hidden email]> wrote:

Murray Eisenberg <[hidden email]> writes:

From George Grätzer’s “More Math into LaTeX” (or earlier versions of it), I adopted the convention of using as label names phrases of the form “type:description”, e.g.:

\label{thm:law-lare-numbers}
\label{eq:prod-of-sums}

For a book, I’m using, among many other packages, babel and crossreftools. Recently I’ve discovered that the “french” option to babel gives a conflict with mnay commands from crossreftools when label names include colons. (The trouble is caused by babel-french.ldf, where the colon is made an active character along with semicolon, exclamation mark, and question mark.)

I could replace those colons by hyphens, but then that destroys the visual distinction between the type of object (theorem, equation, etc.) being labeled and the description, including hyphens, of the particular object of that type.

The colon was, for me, the perfect separator to use, as it nicely separates the two parts of the label names yet is not obtrusive.

Do you have any recommendation for what character to use —  one that is suitable for the purposes my use of it as author yet is safe in that it is unlikely to be made active by some package and thereby cause the same clash as the colon?

I considered the vertical bar “|” but am concerned that something could make it active as well as that it is somewhat obtrusive.

(For reference, please see https://tex.stackexchange.com/questions/511030/another-babel-french-incompatibility-with-crossreftools and the other posts it references.)

I posted this solution on stackexchange:

\edef\myoldcatcode{\the\catcode`\:}
\let\myoriglabel\label
\def\label{\catcode`\:=11 \mynewlabel}
\def\mynewlabel#1{\myoriglabel{#1}\catcode`\:=\myoldcatcode}

--
Piet van Oostrum <[hidden email]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Murray Eisenberg
In reply to this post by Ettore Aldrovandi
Thanks for the suggestion.

Alas, the underscore in labels is also not robust, causing the same error with babel-french and some macros built up from crossreftools functions.

Also, even if it works, I think it would be a nightmare with TeXShop, where by default typing _ automatically inserts _{} and moves the cursor back between the pair of braces. I certainly want to preserve that behavior given my need for multi-character subscripts.

On 6 Oct2019, at 1:04 PM, Ettore Aldrovandi <[hidden email]> wrote:

Why not an underscore?

\label{thm_law-lare-numbers}

But I feel the pain: Emacs + AUCTeX automatically uses a colon (by default) as a separator.

—Ettore

Ettore Aldrovandi
Department of Mathematics, Florida State University
1017 Academic Way                *   http://www.math.fsu.edu/~ealdrov
Tallahassee, FL 32306-4510, USA * * aldrovandi at math dot fsu dot edu

On Oct 5, 2019, at 15:24, Murray Eisenberg <[hidden email]> wrote:

From George Grätzer’s “More Math into LaTeX” (or earlier versions of it), I adopted the convention of using as label names phrases of the form “type:description”, e.g.:

\label{thm:law-lare-numbers}
\label{eq:prod-of-sums}

For a book, I’m using, among many other packages, babel and crossreftools. Recently I’ve discovered that the “french” option to babel gives a conflict with mnay commands from crossreftools when label names include colons. (The trouble is caused by babel-french.ldf, where the colon is made an active character along with semicolon, exclamation mark, and question mark.)

I could replace those colons by hyphens, but then that destroys the visual distinction between the type of object (theorem, equation, etc.) being labeled and the description, including hyphens, of the particular object of that type.

The colon was, for me, the perfect separator to use, as it nicely separates the two parts of the label names yet is not obtrusive.

Do you have any recommendation for what character to use —  one that is suitable for the purposes my use of it as author yet is safe in that it is unlikely to be made active by some package and thereby cause the same clash as the colon?

I considered the vertical bar “|” but am concerned that something could make it active as well as that it is somewhat obtrusive.

(For reference, please see https://tex.stackexchange.com/questions/511030/another-babel-french-incompatibility-with-crossreftools and the other posts it references.)

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
               https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
               https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Ross Moore-3
In reply to this post by Murray Eisenberg
Hi again Murray,

On 7 Oct 2019, at 8:27 am, Murray Eisenberg <[hidden email]> wrote:

That redefinition of \label seems not to be robust — see my comment to https://tex.stackexchange.com/a/511212/13492 .

I’ve read that, and see that you really don’t want to edit at 1000s of locations.

In that case, you need to alter some of the macro-commands that you are using.
Babel provides commands: 
   \bbl@deactivate   \bbl@activate
to return active characters to inactive, and vice versa.

So patch how you use commands like:   \MakeTextLowercase{\crtrefname{thm:main}}
e.g.

\makeatletter
%%
%%  save a pointer to the existing LaTeX command
\let\LTX@MakeTextLowercase\MakeTextLowercase
%%
%%% IMPORTANT:  change the status of : before it is read as an argument !!!
\def\myMakeTextLowercase{\bbl@deactivate:\relax \doMyMakeTextLowercase}
%%
%% now do the work, and set the active status back afterwards
\def\doMyMakeTextLowercase #1{\LTX@MakeTextLowercase{#1}\bbl@activate:\relax}
%%
%% rebid the command-name to use this extra coding
\let\MakeTextLowercase\myMakeTextLowercase

\makeatother


You can do this kind of pre-/post-processing to any command.
But you’ll need to check how well it works, when the commands are hidden inside
expansions of other commands.
Note that the catcode change has to occur *before* the : character is read from your document source.
So it may take some work to determine just which commands need to be patched.


On 6 Oct2019, at 3:06 PM, Piet van Oostrum <[hidden email]> wrote:

Murray Eisenberg <[hidden email]> writes:

From George Grätzer’s “More Math into LaTeX” (or earlier versions of it), I adopted the convention of using as label names phrases of the form “type:description”, e.g.:

\label{thm:law-lare-numbers}
\label{eq:prod-of-sums}

For a book, I’m using, among many other packages, babel and crossreftools. Recently I’ve discovered that the “french” option to babel gives a conflict with mnay commands from crossreftools when label names include colons. (The trouble is caused by babel-french.ldf, where the colon is made an active character along with semicolon, exclamation mark, and question mark.)

I could replace those colons by hyphens, but then that destroys the visual distinction between the type of object (theorem, equation, etc.) being labeled and the description, including hyphens, of the particular object of that type.

The colon was, for me, the perfect separator to use, as it nicely separates the two parts of the label names yet is not obtrusive.

Do you have any recommendation for what character to use —  one that is suitable for the purposes my use of it as author yet is safe in that it is unlikely to be made active by some package and thereby cause the same clash as the colon?

I considered the vertical bar “|” but am concerned that something could make it active as well as that it is somewhat obtrusive.

(For reference, please see https://tex.stackexchange.com/questions/511030/another-babel-french-incompatibility-with-crossreftools and the other posts it references.)

I posted this solution on stackexchange:

\edef\myoldcatcode{\the\catcode`\:}
\let\myoriglabel\label
\def\label{\catcode`\:=11 \mynewlabel}
\def\mynewlabel#1{\myoriglabel{#1}\catcode`\:=\myoldcatcode}

--
Piet van Oostrum <[hidden email]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



Hope this helps.


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Piet van Oostrum-4
In reply to this post by Murray Eisenberg
Murray Eisenberg <[hidden email]> writes:

> That redefinition of \label seems not to be robust — see my comment to
> https://tex.stackexchange.com/a/511212/13492 .

Yes, the real solution should be in crossreftools. The normal LaTeX \label command is redefined by Babel such that it works around this problem. The way that works is that in the french style colon is defined as:

\active@prefix :\normal@char:

\active@prefix chooses either the active definition of : or the character : depending on the value of \protect. So in some protected environments (which includes \label and \ref) : will be interpreted as just the character :.
However crossreftools redefines the \label command and it seems it doesn't take these kind of precautions. So it should be amended to be compatible with Babel.
--
Piet van Oostrum <[hidden email]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Herbert Schulz
> On Oct 7, 2019, at 10:01 AM, Piet van Oostrum <[hidden email]> wrote:
>
> Murray Eisenberg <[hidden email]> writes:
>
>> That redefinition of \label seems not to be robust — see my comment to
>> https://tex.stackexchange.com/a/511212/13492 .
>
> Yes, the real solution should be in crossreftools. The normal LaTeX \label command is redefined by Babel such that it works around this problem. The way that works is that in the french style colon is defined as:
>
> \active@prefix :\normal@char:
>
> \active@prefix chooses either the active definition of : or the character : depending on the value of \protect. So in some protected environments (which includes \label and \ref) : will be interpreted as just the character :.
> However crossreftools redefines the \label command and it seems it doesn't take these kind of precautions. So it should be amended to be compatible with Babel.
> --
> Piet van Oostrum <[hidden email]>
> WWW: http://piet.vanoostrum.org/
> PGP key: [8DAE142BE17999C4]

Howdy,

How about > instead of : (at least until it gets fixed in crossreftools). Not quite as neat but it gets the meaning across.

PS: sorry about this late post. I had to reset a preference on Mail to default to the account registered to the list. It appears that things I've written to the list since September 19th have been lost. Sigh...

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Piet van Oostrum-4
In reply to this post by Murray Eisenberg
There is now a solution at https://tex.stackexchange.com/a/510641/113546

--
Piet van Oostrum <[hidden email]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Murray Eisenberg
As I just commented on that tex.stackexchange answer:

While that does fix the crossreftools+babel-french incompatibility for the crossreftoolscommand crtlistoflabelsthat I raised, it does not fix the incompatibility with the other commands from that package, including its redefinition of the version of \cref(from cleveref).

For example, the following generates the same error:

\documentclass{article}

\usepackage[french,main=english]{babel}

\usepackage{amsthm}
\newtheorem{thm}{Theorem}

\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{crossreftools}

\begin{document}

\begin{thm}\label{thm:first}
A first result.
\end{thm}

See \cref{thm:first}.

\end{document}

On 11 Oct2019, at 11:11 AM, Piet van Oostrum <[hidden email]> wrote:


---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Piet van Oostrum-4
Murray Eisenberg <[hidden email]> writes:

> As I just commented on that tex.stackexchange answer:
>
> While that does fix the crossreftools+babel-french incompatibility for the crossreftoolscommand
> crtlistoflabelsthat I raised, it does not fix the incompatibility with the other commands from
> that package, including its redefinition of the version of \cref(from cleveref).
>
> For example, the following generates the same error:
[snip]
Strange, I don't get an error with your example.
--
Piet van Oostrum <[hidden email]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Piet van Oostrum-4
Piet van Oostrum <[hidden email]> writes:

> Murray Eisenberg <[hidden email]> writes:
>
>> As I just commented on that tex.stackexchange answer:
>>
>> While that does fix the crossreftools+babel-french incompatibility for the crossreftoolscommand
>> crtlistoflabelsthat I raised, it does not fix the incompatibility with the other commands from
>> that package, including its redefinition of the version of \cref(from cleveref).
>>

There are more places where the \detokenize trick should be applied, e.g.

\renewcommand{\@@crtextr@ct@ref}[2]{%
  \@@@crtextr@ct@ref{#1}{\detokenize{#2}}%
}
\newcommand{\@@@crtextr@ct@ref}[2]{%
  \expandafter\ifx\csname r@{#2}\endcsname\relax
  \crt@refundefined%
  \else
  \expandafter\expandafter\csname crt@ref@splitter@#1\endcsname\csname r@#2\endcsname%
  \fi
}

Actually it might be necessary to apply this trick in all/some places where this pattern is used:

\expandafter\ifx\csname ...#1...\endcsname
--
Piet van Oostrum <[hidden email]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

jfbu
Le 12/10/2019 à 22:19, Piet van Oostrum a écrit :

> Piet van Oostrum <[hidden email]> writes:
>
>> Murray Eisenberg <[hidden email]> writes:
>>
>>> As I just commented on that tex.stackexchange answer:
>>>
>>> While that does fix the crossreftools+babel-french incompatibility for the crossreftoolscommand
>>> crtlistoflabelsthat I raised, it does not fix the incompatibility with the other commands from
>>> that package, including its redefinition of the version of \cref(from cleveref).
>>>
>
> There are more places where the \detokenize trick should be applied, e.g.
>
> \renewcommand{\@@crtextr@ct@ref}[2]{%
>    \@@@crtextr@ct@ref{#1}{\detokenize{#2}}%
> }
> \newcommand{\@@@crtextr@ct@ref}[2]{%
>    \expandafter\ifx\csname r@{#2}\endcsname\relax
>    \crt@refundefined%
>    \else
>    \expandafter\expandafter\csname crt@ref@splitter@#1\endcsname\csname r@#2\endcsname%
>    \fi
> }
>
> Actually it might be necessary to apply this trick in all/some places where this pattern is used:
>
> \expandafter\ifx\csname ...#1...\endcsname
>


Hi,

sorry if completely off the mark, but doesn't babel provide the

\@safe@activestrue

toggle precisely for such \csname...\endcsname expansions ?

Couldn't crossreftools in presence of babel do

\@safe@activestrue
...

\@safe@activesfalse

or see hyperref code on how to do this in a way which will work
even without babel \if@safe@actives

I don't read tex.sx, so perhaps this has been mentioned

I hardly read this thread either, so I may be making noise.

But clearly, it is on crossreftools to adapt to babel shorthands

Jean-François

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Murray Eisenberg
Jean-François,

I have utterly no understanding of where and how to use \@safe@activestrue.

Could you show me an example of where and how relevant to my crossreftools problems?

Murray

> On 12 Oct2019, at 4:38 PM, jfbu <[hidden email]> wrote:
>
> Le 12/10/2019 à 22:19, Piet van Oostrum a écrit :
>> Piet van Oostrum <[hidden email]> writes:
>>> Murray Eisenberg <[hidden email]> writes:
>>>
>>>> As I just commented on that tex.stackexchange answer:
>>>>
>>>> While that does fix the crossreftools+babel-french incompatibility for the crossreftoolscommand
>>>> crtlistoflabelsthat I raised, it does not fix the incompatibility with the other commands from
>>>> that package, including its redefinition of the version of \cref(from cleveref).
>>>>
>> There are more places where the \detokenize trick should be applied, e.g.
>> \renewcommand{\@@crtextr@ct@ref}[2]{%
>>   \@@@crtextr@ct@ref{#1}{\detokenize{#2}}%
>> }
>> \newcommand{\@@@crtextr@ct@ref}[2]{%
>>   \expandafter\ifx\csname r@{#2}\endcsname\relax
>>   \crt@refundefined%
>>   \else
>>   \expandafter\expandafter\csname crt@ref@splitter@#1\endcsname\csname r@#2\endcsname%
>>   \fi
>> }
>> Actually it might be necessary to apply this trick in all/some places where this pattern is used:
>> \expandafter\ifx\csname ...#1...\endcsname
>
>
> Hi,
>
> sorry if completely off the mark, but doesn't babel provide the
>
> \@safe@activestrue
>
> toggle precisely for such \csname...\endcsname expansions ?
>
> Couldn't crossreftools in presence of babel do
>
> \@safe@activestrue
> ...
>
> \@safe@activesfalse
>
> or see hyperref code on how to do this in a way which will work
> even without babel \if@safe@actives
>
> I don't read tex.sx, so perhaps this has been mentioned
>
> I hardly read this thread either, so I may be making noise.
>
> But clearly, it is on crossreftools to adapt to babel shorthands
>
> Jean-François
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
> List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
>               https://email.esm.psu.edu/pipermail/macosx-tex/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Piet van Oostrum-4
In reply to this post by jfbu
jfbu <[hidden email]> writes:

>
> Hi,
>
> sorry if completely off the mark, but doesn't babel provide the
>
> \@safe@activestrue
>
> toggle precisely for such \csname...\endcsname expansions ?
>
> Couldn't crossreftools in presence of babel do
>
> \@safe@activestrue
> ...
>
> \@safe@activesfalse
>
I have tried that, but because there are all kinds of expansions going on at different times, I couldn't get it working.

However, I found that I had made an error in my code. There was a r@{#1} that should be r@#1.

So the code should be:

\renewcommand{\@@crtextr@ct@ref}[2]{%
  \expandafter\@@@crtextr@ct@ref\expandafter{\detokenize{#2}}{#1}%
}
\newcommand{\@@@crtextr@ct@ref}[2]{%
  \expandafter\ifx\csname r@#1\endcsname\relax
  \crt@refundefined%
  \else
  \expandafter\expandafter\csname crt@ref@splitter@#2\endcsname\csname r@#1\endcsname%
  \fi
}
--
Piet van Oostrum <[hidden email]>
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

[SPAM] Re: separators in label names

jfbu
In reply to this post by Murray Eisenberg
Hi Murray,

I belatedly learn that crossreftools is a package which
provides **expandable** macros.

This means that it can not turn on or off the babel
provided toggle \if@safe@actives

My proposal was a shot in the dark, where dark is to be
read as black hole.

You got an expandable construct on TeX-Live list from D.C.

Do you really need **expandable** macros ???

Anyway glad it appeared to be solved for you.

Best,

Jean-François

Le 12/10/2019 à 22:55, Murray Eisenberg a écrit :

> Jean-François,
>
> I have utterly no understanding of where and how to use \@safe@activestrue.
>
> Could you show me an example of where and how relevant to my crossreftools problems?
>
> Murray
>
>> On 12 Oct2019, at 4:38 PM, jfbu <[hidden email]> wrote:
>>
>> Le 12/10/2019 à 22:19, Piet van Oostrum a écrit :
>>> Piet van Oostrum <[hidden email]> writes:
>>>> Murray Eisenberg <[hidden email]> writes:
>>>>
>>>>> As I just commented on that tex.stackexchange answer:
>>>>>
>>>>> While that does fix the crossreftools+babel-french incompatibility for the crossreftoolscommand
>>>>> crtlistoflabelsthat I raised, it does not fix the incompatibility with the other commands from
>>>>> that package, including its redefinition of the version of \cref(from cleveref).
>>>>>
>>> There are more places where the \detokenize trick should be applied, e.g.
>>> \renewcommand{\@@crtextr@ct@ref}[2]{%
>>>    \@@@crtextr@ct@ref{#1}{\detokenize{#2}}%
>>> }
>>> \newcommand{\@@@crtextr@ct@ref}[2]{%
>>>    \expandafter\ifx\csname r@{#2}\endcsname\relax
>>>    \crt@refundefined%
>>>    \else
>>>    \expandafter\expandafter\csname crt@ref@splitter@#1\endcsname\csname r@#2\endcsname%
>>>    \fi
>>> }
>>> Actually it might be necessary to apply this trick in all/some places where this pattern is used:
>>> \expandafter\ifx\csname ...#1...\endcsname
>>
>>
>> Hi,
>>
>> sorry if completely off the mark, but doesn't babel provide the
>>
>> \@safe@activestrue
>>
>> toggle precisely for such \csname...\endcsname expansions ?
>>
>> Couldn't crossreftools in presence of babel do
>>
>> \@safe@activestrue
>> ...
>>
>> \@safe@activesfalse
>>
>> or see hyperref code on how to do this in a way which will work
>> even without babel \if@safe@actives
>>
>> I don't read tex.sx, so perhaps this has been mentioned
>>
>> I hardly read this thread either, so I may be making noise.
>>
>> But clearly, it is on crossreftools to adapt to babel shorthands
>>
>> Jean-François
>>
>> ----------- Please Consult the Following Before Posting -----------
>> TeX FAQ: http://www.tex.ac.uk/faq
>> List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
>> List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
>>                https://email.esm.psu.edu/pipermail/macosx-tex/
>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
>
> ---
> Murray Eisenberg [hidden email]
> 503 King Farm Blvd #101 Home (240)-246-7240
> Rockville, MD 20850-6667 Mobile (413)-427-5334
>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
> List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
>                  https://email.esm.psu.edu/pipermail/macosx-tex/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
>


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

jfbu
In reply to this post by Piet van Oostrum-4
Hi Piet,

Le 13/10/2019 à 14:21, Piet van Oostrum a écrit :

> jfbu <[hidden email]> writes:
>
>>
>> Hi,
>>
>> sorry if completely off the mark, but doesn't babel provide the
>>
>> \@safe@activestrue
>>
>> toggle precisely for such \csname...\endcsname expansions ?
>>
>> Couldn't crossreftools in presence of babel do
>>
>> \@safe@activestrue
>> ...
>>
>> \@safe@activesfalse
>>
> I have tried that, but because there are all kinds of expansions going on at different times, I couldn't get it working.

It was impossible to get it working while maintaining the main aspect of crossreftools which is to provide expandable macros.

I wonder why Murray needs this package, but my hint at \if@safe@actives babel toggle was under such circumstances misleading as it can't be applied without breaking expandability.

I of course did that without having read the numerous exchanges on tex.sx, and here, and belatedly understood crossreftools is a package providing expandable macros.

Seems Murray got it solved by David, anyway,

Best,

Jean-François


>
> However, I found that I had made an error in my code. There was a r@{#1} that should be r@#1.
>
> So the code should be:
>
> \renewcommand{\@@crtextr@ct@ref}[2]{%
>    \expandafter\@@@crtextr@ct@ref\expandafter{\detokenize{#2}}{#1}%
> }
> \newcommand{\@@@crtextr@ct@ref}[2]{%
>    \expandafter\ifx\csname r@#1\endcsname\relax
>    \crt@refundefined%
>    \else
>    \expandafter\expandafter\csname crt@ref@splitter@#2\endcsname\csname r@#1\endcsname%
>    \fi
> }
>


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Murray Eisenberg
I need crossreftools in order to pull apart cross-references to theorem-like constructs (with thmtools) that produce environments with outputs beginning

Theorem (an important result of Newton}

or

Fundamental Theorem of Calculus

so as to create macros that give the parenthesized name in the first type, preserving the upper-case letters of marked names (via \NoCaseChange from textcase), and the name in the second type but with initial letters lower-cased (again, with the exception of marked names; and so that the entries from all such environments in the \listoftheorems will keep that lower-casing except for the very first letter.

So, for example, in the first example, if it has label, say \label{thm:important}, then my macro \thmnameref* has output 

an important result of Newton

from \thmnameref*{thm:important}; and if the second example has label \label{thm:FTC}, then my macro \thmref* gives output

fundamental theorem of calculus 

from \thmref*{thm:FTC}. And in the list of theorems created by \listoftheorems, those two theorem-like environments will produce entries:

An important result of Newton
Fundamental theorem of calculus

This is all, among other reasons, due to customary Amer Math Soc and Math Assoc America math book (and journal) styles that prefer, or insist upon, lower-casing such theorem names, at least when referred to in the body of the text.

On 13 Oct2019, at 3:44 PM, jfbu <[hidden email]> wrote:

Hi Piet,

Le 13/10/2019 à 14:21, Piet van Oostrum a écrit :
jfbu <[hidden email]> writes:

Hi,

sorry if completely off the mark, but doesn't babel provide the

\@safe@activestrue

toggle precisely for such \csname...\endcsname expansions ?

Couldn't crossreftools in presence of babel do

\@safe@activestrue
...

\@safe@activesfalse

I have tried that, but because there are all kinds of expansions going on at different times, I couldn't get it working.

It was impossible to get it working while maintaining the main aspect of crossreftools which is to provide expandable macros.

I wonder why Murray needs this package, but my hint at \if@safe@actives babel toggle was under such circumstances misleading as it can't be applied without breaking expandability.

I of course did that without having read the numerous exchanges on tex.sx, and here, and belatedly understood crossreftools is a package providing expandable macros.

Seems Murray got it solved by David, anyway,

Best,

Jean-François


However, I found that I had made an error in my code. There was a r@{#1} that should be r@#1.
So the code should be:
\renewcommand{\@@crtextr@ct@ref}[2]{%
  \expandafter\@@@crtextr@ct@ref\expandafter{\detokenize{#2}}{#1}%
}
\newcommand{\@@@crtextr@ct@ref}[2]{%
  \expandafter\ifx\csname r@#1\endcsname\relax
  \crt@refundefined%
  \else
  \expandafter\expandafter\csname crt@ref@splitter@#2\endcsname\csname r@#1\endcsname%
  \fi
}


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
              https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: separators in label names

Ross Moore-3
Hi Murray,

On 14 Oct 2019, at 7:50 am, Murray Eisenberg <[hidden email]> wrote:

I need crossreftools in order to pull apart cross-references to theorem-like constructs (with thmtools) that produce environments with outputs beginning

Theorem (an important result of Newton}

or

Fundamental Theorem of Calculus

so as to create macros that give the parenthesized name in the first type, preserving the upper-case letters of marked names (via \NoCaseChange from textcase), and the name in the second type but with initial letters lower-cased (again, with the exception of marked names; and so that the entries from all such environments in the \listoftheorems will keep that lower-casing except for the very first letter.

So, for example, in the first example, if it has label, say \label{thm:important}, then my macro \thmnameref* has output 

an important result of Newton

from \thmnameref*{thm:important}; and if the second example has label \label{thm:FTC}, then my macro \thmref* gives output

fundamental theorem of calculus 

from \thmref*{thm:FTC}. And in the list of theorems created by \listoftheorems, those two theorem-like environments will produce entries:

An important result of Newton
Fundamental theorem of calculus

This is all, among other reasons, due to customary Amer Math Soc and Math Assoc America math book (and journal) styles that prefer, or insist upon, lower-casing such theorem names, at least when referred to in the body of the text.

This all sounds really good, to be able to construct extra meaningful text, 
by taking hints from the \label  strings.
I’m sure this will be extremely useful for accessibility; e.g.,
even if the theorem displays on-screen as:   Theorem (Newton)  
there can be alternative text that can be passed to a screen-reader to say:
   “an important theorem of Newton” .

And of course if the visual text says ‘FTC’ there can be an internal expansion of the acronym
to pass the full phrase ‘Fundamental Theorem of Calculus’ (with or without capitalisation)
to the screen reader or Braille-based assistive technology.

These extra non-displayed strings need to be created using (La)TeX macros, 
and stored in the appropriate places within the PDF being constructed. 
It is then up to PDF reader software to detect their presence and access them when appropriate,
perhaps according to personalised preferences or key-strokes, provided by the (visually impaired) human reader.

This is a direction in which mathematical publishing really does need to go,
to properly support Accessibility in highly technical documents.


So when you think you are close to having a well-worked and robust set of macros,
I’d be very interested in using your package, and creating the extra coding needed 
to build a fully-tagged accessible PDF from some real-world example documents.



On 13 Oct2019, at 3:44 PM, jfbu <[hidden email]> wrote:

Hi Piet,


I wonder why Murray needs this package, but my hint at \if@safe@actives babel toggle was under such circumstances misleading as it can't be applied without breaking expandability.

I of course did that without having read the numerous exchanges on tex.sx, and here, and belatedly understood crossreftools is a package providing expandable macros.

Seems Murray got it solved by David, anyway,

Best,

Jean-François


However, I found that I had made an error in my code. There was a r@{#1} that should be r@#1.

Yep. That’s a mistake that’s really easy to make.
There are contexts where {#1} and #1 do exactly the same thing; but not here.  :-)


So the code should be:
\renewcommand{\@@crtextr@ct@ref}[2]{%
  \expandafter\@@@crtextr@ct@ref\expandafter{\detokenize{#2}}{#1}%
}
\newcommand{\@@@crtextr@ct@ref}[2]{%
  \expandafter\ifx\csname r@#1\endcsname\relax
  \crt@refundefined%
  \else
  \expandafter\expandafter\csname crt@ref@splitter@#2\endcsname\csname r@#1\endcsname%
  \fi
}



---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



All the best.

Ross

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex