[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ref macro works as expected for html and info, but not pdf?
From: |
Gavin Smith |
Subject: |
Re: ref macro works as expected for html and info, but not pdf? |
Date: |
Sat, 5 Aug 2023 16:16:52 +0100 |
On Sat, Aug 05, 2023 at 08:07:31AM -0700, Raymond Toy wrote:
> I have a set of simple macros:
>
> |@macro kwd {keyword} @code{:\keyword\} @end macro @c Macro to generate a
> cross-reference to a keyword. @macro keyref {arg} @xref{\arg\, @kwd{\arg\}}
> @end macro |
>
> And I use it like |@keyref{context-declarations}|. In the html doc, I see a
> link with text “:context-declarations” in a fixed-width font. That’s what I
> was expecting. In the info file, I also see “:context-declarations”, as
> desired.
>
> However, in the pdf, I only see “context-declarations” without the colon,
> and the text appears to be the default serif font, and not a fixed-width
> font.
>
> Is this expected behavior?
>
The reason is that the second argument of @xref is not used for printed
cross-references, only the third argument. The following uses the fixed-width
font (linebreaks fixed):
@macro kwd {keyword}
@code{:\keyword\}
@end macro
@c Macro to generate a cross-reference to a keyword.
@macro keyref {arg}
@xref{\arg\,, @kwd{\arg\}}
@end macro
@anchor{context-declaration}
@keyref{context-declaration}
See how there are two commas in the @xref usage to get to the third
argument.