0

In Philex, you can refer locally to an example (2b) by just typing \rnx{label} and it will return just (b), otherwise just type \rn{label} and it returns (2b).

Here is the syntax of the two commands:

\newcommand{\rf}[2][]{%%
\ifhyperref%%
(\hyperlink{#2}{\csname#2\endcsname}#1)%
\else%%
(\csname#2\endcsname#1)%
\fi}

%Cross-reference to subsentence without main number:% \newcommand{\rfx}[2][]{% \ifhyperref% (\hyperlink{#2}{\csname#2q\endcsname}#1)% \else% (\csname#2q\endcsname#1)% \fi}

As you may know, when referring to subsubexamples such as (1a.i), I'm looking for a way to also skip the sublevel and return just (i),

My question is quite straightforward. I would like to know what \csname#2q actually does, so I can use it to also skip the sublevel label, without having to worry about the presence of a delimiter as in Ulrich's \gobbletodot suggestion.

Edit

I found this line :

\refstepcounter{altsub}\label{#2q}

So this is only a label for the sublevel.

But then we find :

\refstepcounter{altsubsub}\label{#2q}

So the problem is that #2q is one and the same label for the sub- and subsub- levels.

I guess the way the package is written, I could not refer to the sublabel and only keep the subsublabel.

  • 1
    Remark, these are primitive TeX commands whose documentation/explanation can be found in the TeXbook or TeX by Topic etc.. – user202729 Mar 23 '22 at 17:24
  • 1
    \csname#2q\endcsname builds a command name, if e.g. #2 is abc this would call the command \abcq. – Ulrike Fischer Mar 23 '22 at 17:28
  • 1
    \csname anything\endcsname becomes \anything. Adding a q makes \anythingq. In both commands, #1 is the optional (by default empty) argument, and #2 is the second, mandatory argument. When you write \rf{label} it becomes (if hyperref is not loaded) (\csname label\endcsname) which is (\label) which seems very weird, since \label is a LaTeX command. \rfx{label} then becomes (\labelq). – Phelype Oleinik Mar 23 '22 at 17:28
  • Yes, that's what I thought. So it's an arbitrary way to call an alternative label, which must be defined higher in the code. – Vincent Krebs Mar 23 '22 at 17:32
  • 1
    @PhelypeOleinik philex has a quite unsafe method to handle command names, see https://tex.stackexchange.com/a/634309/2388 – Ulrike Fischer Mar 23 '22 at 17:42
  • 1
    @UlrikeFischer ew... – Phelype Oleinik Mar 23 '22 at 17:45
  • You mean this is completely crazy... For each label you define (and there are hundreds of them in a thesis), you take the risk of ruining an existing command !... – Vincent Krebs Mar 23 '22 at 18:02

0 Answers0