groff
[Top][All Lists]

## Re: [Groff] Using variables from register within fractions or equations

 From: maouinin Subject: Re: [Groff] Using variables from register within fractions or equations Date: Fri, 10 Feb 2012 20:36:14 -0800 (PST)


ted.harding-3 wrote:
>
> On 10-Feb-2012 maouinin wrote:
>> What would be the best way to use a regularly incremented
>> variable within fractions?
>>
>> I teach ESL and I hope to typeset cloze tests where selected
>> individual words are replaced by a blank space (a short line
>> or underscore) which has the question number printed below it.
>> I have done this in LaTeX by using fractions within the math
>> environment paired with a counter as the denominator:
>>
>> \newcommand{\pq}{\hspace{1mm} \stepcounter{qnum}
>>                     \begin{math}
>>                               _\frac{\hspace{3cm}}{\theqnum}
>>                     \end{math}
>> and the following:
>>
>> I am honored to be with you today at your commencement...
>>
>> becomes:
>> I am h_______ to be with you today at your c________ ...
>>              1                                                      2
>>
>> Is this possible with groff, using eqn perhaps? Is it possible
>> to use variables from number registers within equations or
>> fractions?
>> --
>
> For the particular effect which you describe, it is not necessary
> to use fractions and eqn. You can do it perfectly well using
> basic troff primitives. The following produces the above result:
>
>
> .nr subno 0 1
> .ds qline \v'0.25m'\D'l 5m 0'\v'1.00m'\\n+[subno]\v'-1.25m'
> .LP
> I am h\*[qline] to be with you today at your c\*[qline]...
> ...
>
> The various paramaters in \*[qline] can be varied according
> to precisely how you would like the result to appear.
> ...
> but, as I said, that sort of thing is not needed for your
> application as described.
>
> Hoping this helps,
> Ted.
>
>

Thanks for the help. What you gave works brilliantly for what
I described. However, the effect I described was only partial
to what I hope to achieve. I hope to be able to achieve one
of three possibilities:

1) for strong students: a blank line with the question number below -- no
first letter given

2) for weaker students: a blank line with the question number below -- first
letter given
-- this is what i described in the original post

3) for the weakest students: a line with the first letter and an additional
smaller line for each
letter of the word being tested  --

I am honored to be with you today at your commencement...

becomes:

I am h __ __ __ __ __ __ __ to be with you today at your c __ __ __ __ __ __
__ __ __ __ __ ...

with a line below the entire question.
This is why I ended up using fractions in LaTeX : I can put the first
letter and the blanks for each subsequent letter in the numerator
and the question number in the denominator. The bar stays the right
length for each word.

--
View this message in context:
http://old.nabble.com/Using-variables-from-register-within-fractions-or-equations-tp33299025p33304793.html
Sent from the Groff - General mailing list archive at Nabble.com.