[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Converting \page-ref value to number type
From: |
Benjamin Bruce |
Subject: |
Re: Converting \page-ref value to number type |
Date: |
Wed, 24 Apr 2024 12:23:19 -0600 |
User-agent: |
Cyrus-JMAP/3.11.0-alpha0-386-g4cb8e397f9-fm-20240415.001-g4cb8e397 |
Here is an updated (tinier) example:
\version "2.24"
{
\label #'myLabel
c4 c c
}
\markup #(markup #:page-ref 'myLabel "0" "?")
This displays the label's page number, but I still can't figure out how to
extract that value so I can do things with it. Looking forward to your ideas.
𐑪𐑯 2024-04-24 𐑨𐑑 08:47, Benjamin Bruce <benjamin@koine.gr> 𐑮𐑴𐑑:
> Hello all,
> I am just now learning how to use labels and \page-ref to retrieve the
> page number where a label is located.
> I would like to use the value returned by \page-ref to do simple math
> in Scheme. I am able to pass the label to a markup command, but I can't
> figure out how to get it into a number format so I can manipulate it.
> Any tips? Here is my tiny example:
>
> \version "2.24"
>
> {
> \label #'myLabel
> c4 c c
> }
>
> #(define-markup-command
> (page-number-calculations layout props label) (markup?)
> ; Throws error "Wrong type argument in position 1"
> (interpret-markup layout props (+ label 1))
> )
>
> myLabel = \markup { \page-ref #'myLabel "0" "?" }
> \markup \page-number-calculations \myLabel