[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] how to use .GETST in a figure caption?
From: |
Anton Shterenlikht |
Subject: |
Re: [Groff] how to use .GETST in a figure caption? |
Date: |
Wed, 22 Aug 2012 16:45:15 +0100 (BST) |
From address@hidden Wed Aug 22 16:36:13 2012
Anton Shterenlikht:
> > Also, you can use the second argument to .GETST
> > to save the reference into a string and use that
> > in the caption.
>
> Thanks, this works:
>
> .PSPIC rep-cold-mises-mesh.ps 6.0
> .ds caption "Mises stress in the 0.3 mm notch model
> .as caption " at \*[cold]\"
> .as caption " at \*[ep02]\"
> .as caption " at the notch root.
> .as caption " The fine grain material is at the top,\"
> .as caption " and the coarse grain material is at the\"
> .as caption " bottom. The discontinuity of stress at\"
> .as caption " the boundary is cleary visible.\"
> .FG "\*[caption]" "" 0 fig:cold-mises-mesh
> .SETR fig:cold-mises-mesh
> .DE
>
> .DS CB
> .PSPIC rep-cold-mises-nomesh.ps 6.0
> .ds caption "Same as Fig.\"
> .as caption " .GETST fig:cold-mises-mesh,\"
> .as caption " but with mesh not shown for clarity.\"
> .FG "\*[caption]" "" 0 fig:cold-mises-nomesh
> .SETR fig:cold-mises-nomesh
> .DE
But it's not what I meant. A couple of notes:
a. The calls of .SETR in your example are redun-
dant in both cases because the corresponding
references are already set by the previous
call of .FG via its fourth argument.
b. Your version works only because .FG, when
called from within a display, uses
address@hidden instead of address@hidden
The former relies on delayed expantion (see
escape '\!') which causes a macro call within
a string to be interpreted.
I was suggesting to call
.ds rsql\" to smother an error message on first pass
.GETST fig:cold-mises-mesh ref:cmm
in the beginning of the ducument and then use the
resulting string \*[ref:cmm] in captions.
Thanks. I actually sent you the wrong
snippet. Except for ".ds rsql" bit,
which I don't know yet, I did what you
suggested, e.g.:
********************************************************************
.GETST fig:model fig:model:s
.H 1 "The model"
The model used in this work is shown in Fig. \*[fig:model:s] below.
.DS CB
.PS 3
copy "model.pic"
.PE
.DE
.ds caption "Schematic of the 3-point bend model,\"
.as caption " showing the bar with the notch in the top layer\"
.as caption " and the cylindrical pins.\"
.as caption " The notch is not to scale.\"
.FG "\*[caption]" "" 0 fig:model
********************************************************************
or this one
********************************************************************
.DS
.PSPIC rep-cold-mises-mesh.ps 6.0
.DE
.ds caption "Mises stress in the 0.3 mm notch model\"
.as caption " at \*[cold]\"
.as caption " at \*[ep02]\"
.as caption " at the notch root.\"
.as caption " The fine grain material is at the top,\"
.as caption " and the coarse grain material is at the\"
.as caption " bottom. The discontinuity of stress at\"
.as caption " the boundary is cleary visible.\"
.FG "\*[caption]" "" 0 fig:cold-mises-mesh
.GETST fig:cold-mises-mesh fig:cold-mises-mesh:s
.DS
.PSPIC rep-cold-mises-nomesh.ps 6.0
.DE
.ds caption "Same as Fig. \*[fig:cold-mises-mesh:s],\"
.as caption " but with mesh not shown for clarity.\"
.FG "\*[caption]" "" 0 fig:cold-mises-nomesh
********************************************************************
But you are right, the second example wouldn't
work if the reference is made from before
.GETST, so it's better to move to the beginning of the
document.
Many thanks for your informative replies!
Anton