Search code examples
racketcross-referencescribble

Scribble documentation: cross-references between two simple files


The documentation for scribble (the Racket documentation tool) says that “Cross references within […] documents rendered together are always resolved”, but the file a.scrbl below fails to reference the section in file b.scrbl

a.scrbl:

#lang scribble/base
@secref["sectag" #:doc "b.scrbl"]

b.scrbl:

#lang scribble/base
@section[#:tag "sectag"]{A section}

When compiling them with scribble --html a.scrbl b.scrbl, I get:

Warning: some cross references may be broken due to undefined tags:
 (part ("/path/to/b.scrbl" "sectag"))

How do I reference a section in b.scrbl from a.scrbl?


Solution

  • It seems to work if you remove the #:doc argument.

    #lang scribble/base
    @secref["sectag"]
    

    This might create an ambiguity though if you use the same tags in both documents, so you may have to change tag names or use your own tag prefixes.

    I'm not sure why the relative path for #:doc doesn't work as you expect. Maybe it is only used for referring to collection-installed documents.