Consider the following MWE:






\typeout{4.=\meaning \csname abx@macro@name:first-last \endcsname}
\typeout{5.=\expandafter\meaning \csname abx@macro@name:first-last \endcsname}
\typeout{6.=\expandafter\expandafter\expandafter\meaning \csname abx@macro@name:first-last \endcsname}


Running this with pdflatex, results with:

1.=\protected macro:#1->\ifcsundef {abx@macro@\detokenize {#1}} {\blx@error {Bi
bliography macro '\detokenize {#1}' undefined} {Use '\string \newbibmacro ' to 
define this macro}} {\csuse {abx@macro@\detokenize {#1}}}

2.=\protected macro:#1->\ifcsundef {abx@macro@\detokenize {#1}} {\blx@error {Bi
bliography macro '\detokenize {#1}' undefined} {Use '\string \newbibmacro ' to 
define this macro}} {\csuse {abx@macro@\detokenize {#1}}}{name:first-last}


4.=\csnameabx@macro@name:first-last \endcsname 



... which is to say, the closest I can get to the definition of \abx@macro@name:first-last here is \relax; but I'm pretty sure that is not the case, because:

Even if \abx@macro@name:first-last is not defined verbatim under that name in biblatex.sty, look what texdef reports:

$ texdef -t latex -c book -p biblatex abx@macro@name:first-last  -f
\abx@macro@name:first-last first defined in "biblatex.sty".

macro:#1#2#3#4->\usebibmacro {name:delim}{#2#3#1}\usebibmacro {name:hook}{#2#3#1}\ifblank {#2}{}{\mkbibnamefirst {#2}\isdot \bibnamedelimd }\ifblank {#3}{}{\mkbibnameprefix {#3}\isdot \ifpunctmark {'} {} {\ifuseprefix {\bibnamedelimc }{\bibnamedelimd }}}\mkbibnamelast {#1}\isdot \ifblank {#4}{}{\bibnamedelimd \mkbibnameaffix {#4}\isdot }

... which is exactly what I was looking for!

One would think the \protect here (as in macros - How can I see the "implementation" of the \LaTeX command? - TeX - LaTeX) would be appropriate - yet I cannot see that \abx@macro@name:first-last is protected; the only thing I can see as problem is use of colon character in name (which should then be handled by the \csname/endcsname approach, but isn't).

Can anyone point out, how can I list this \abx@macro@name:first-last macro (and similar ones) from within Latex?


Taking your steps in order:

  1. Shows the meaning of \usebibmacro, which is a protected macro
  2. Does exactly the same as (1), as \meaning does not expand the next token at all
  3. Shows the meaning of the non-existent macro \abx@macro@name, as : is not a 'letter'
  4. Shows the meaning of \csname (due to (2))
  5. Shows the meaning of the non-existent macro \abx@macro@name:first-last, where there is a space at the end
  6. Is the same as (5)

What you want here is

\expandafter\meaning\csname abx@macro@name:first-last\endcsname

with no space between last and \endcsname. This gives

macro:#1#2#3#4->\usebibmacro {name:delim}{#2#3#1}\usebibmacro {name:hook}{#2
#3#1}\ifblank {#2}{}{\mkbibnamefirst {#2}\isdot \bibnamedelimd }\ifblank {#3}{}
{\mkbibnameprefix {#3}\isdot \ifpunctmark {'} {} {\ifuseprefix {\bibnamedelimc 
}{\bibnamedelimd }}}\mkbibnamelast {#1}\isdot \ifblank {#4}{}{\bibnamedelimd \m
kbibnameaffix {#4}\isdot }

This has nothing to do with protection: you need simply to watch spaces.

(By the way, biblatex does definitions in biblatex.def and the standard styles, rather than in biblatex.sty.)

  • Ah, those damn spaces! :/ whowoulddathunkit :) Many thanks for the answer, @JosephWright - cheers! – sdaau Jun 20 '12 at 18:18

Your test number 5 is the closest:

\typeout{5.=\expandafter\meaning \csname abx@macro@name:first-last\endcsname}

would be correct (you have a space before \endcsname that is significant).

The \expandafter is necessary so that \meaning finds the right token; in example 4 you get simply the meaning of \csname.

The following input, compiled from the terminal,




will give

> \abx@macro@name:first-last=macro:
#1#2#3#4->\usebibmacro {name:delim}{#2#3#1}\usebibmacro {name:hook}{#2#3#1}\ifb
lank {#2}{}{\mkbibnamefirst {#2}\isdot \bibnamedelimd }\ifblank {#3}{}{\mkbibna
meprefix {#3}\isdot \ifpunctmark {'} {} {\ifuseprefix {\bibnamedelimc }{\bibnam
edelimd }}}\mkbibnamelast {#1}\isdot \ifblank {#4}{}{\bibnamedelimd \mkbibnamea
ffix {#4}\isdot }.

With the xpatch package you have also available


which are the analog of \patchcmd, \pretocmd and \apptocmd provided by etoolbox.

The first argument to these commands is the string that one would use as argument to \usebibmacro. There's no \xmeaning: such debugging is best done from the terminal.

  • Many thanks for that @egreg - difficult to choose this time, but added accept to JosephWright's answer, as it provides a breakdown of my mistakes.. Although both of you point out the mistake with the spaces - and I truly appreciate the pointer to xpatch in this answer! (btw, I also tried show2es \showcmd, it also reports \relax). Many thanks again - cheers! – sdaau Jun 20 '12 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.