Use of § in refstyle
I’m a big fan of the refstyle package. (Before I knew it existed, I started writing something similar myself. I’m glad I found refstyle before it was too late!)
The refstyle package automates the use of cross references; while vanilla LaTeX would have us write Figure~\ref{xyz}
, this is written in refstyle as \figref{xyz}
. Far more flexible and this syntax lends itself to many clever extensions such as referring to ranges of figures with \figrangeref
or multiple individual ones using comma-lists. (And sections, and chapters, and equations, etc.)
From memory, The LaTeX Companion does not mention refstyle; I don’t recommend the use of prettyref or fancyref these days, as they’re both very limited in comparison. There is a rival to refstyle named cleveref which I have not used; it has been actively developed for a number of years and is worth checking out.
I’ll talk about refstyle’s syntax vs cleveref another day, perhaps. If we were to chose one of them to emulate for a LaTeX3 package, which would we choose? I do not know. We’re not at that stage now, so I’ll put off thinking about it.
What I do want to discuss here is the use of the section sign, §. By default, writing
see \secref{foo} for foo and we know about bar already (\secref*{bar}).
results in the output
see section §1 for foo and we know about bar already (§2).
In this case, I’m (ab)using the default appearance of the section sign to use \secref*
as a ‘short reference’ that’s nice and tidy within parentheses, while preferring to spell out ‘section’ explicitly in text within a sentence.
My PhD supervisor has pointed out to me, however, that writing ‘section §1’ is like writing ‘section section 1’ — not really the thing to do. Luckily refstyle provides hooks (namely, \ifRSstar
) that allow us to define a reference that defaults to ‘section 1’ but shifts to ‘§1’ when the star form is used.
In the configuration file that defines the refcmd
for sections, simply write
refcmd = {\ifRSstar\S\fi\ref{#1}},
and we’re all set.
(At the same time, I switch all of the lowercase alternatives to uppercase so that cross-references are always ‘Section 1’ and so on — this is probably a regional preference.)