[OS X TeX] separators in label names

Ross Moore ross.moore at mq.edu.au
Mon Oct 7 00:38:34 CEST 2019


Hi again Murray,

On 7 Oct 2019, at 8:27 am, Murray Eisenberg <murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>> wrote:

That redefinition of \label seems not to be robust — see my comment to https://tex.stackexchange.com/a/511212/13492<https://protect-au.mimecast.com/s/6SJbCgZ05JfmDP6OuNJxwo?domain=tex.stackexchange.com> .

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 at deactivate   \bbl at 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 at MakeTextLowercase\MakeTextLowercase
%%
%%% IMPORTANT:  change the status of : before it is read as an argument !!!
\def\myMakeTextLowercase{\bbl at deactivate:\relax \doMyMakeTextLowercase}
%%
%% now do the work, and set the active status back afterwards
\def\doMyMakeTextLowercase #1{\LTX at MakeTextLowercase{#1}\bbl at 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 <piet-l at vanoostrum.org<mailto:piet-l at vanoostrum.org>> wrote:

Murray Eisenberg <murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>> 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<https://protect-au.mimecast.com/s/JokrCjZ12Rf3VlEKhRBYJ_?domain=tex.stackexchange.com> 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 <piet-l at vanoostrum.org<mailto:piet-l at vanoostrum.org>>
WWW: http://piet.vanoostrum.org/<https://protect-au.mimecast.com/s/3LnTCk815RCrPYl8FQs-E-?domain=piet.vanoostrum.org>
PGP key: [8DAE142BE17999C4]

---
Murray Eisenberg murrayeisenberg at gmail.com<mailto:murrayeisenberg at gmail.com>
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



Hope this helps.

Ross

Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
http://www.maths.mq.edu.au
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>
<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/macostex-archives/attachments/20191006/3dfd0afa/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://tug.org/pipermail/macostex-archives/attachments/20191006/3dfd0afa/attachment-0001.png>
-------------- next part --------------
----------- 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


More information about the macostex-archives mailing list