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, 17 Feb 2012 05:45:16 -0800 (PST)

>
>
> How about this, just to throw some ideas into the pool:
> (Of course there's lots of stuff that can be tweaked.
> For example, I left out the extra line in the "easy" case
> because I personally didn't like it.)
>
>
>
> .\"
> .\"
> ------------------------------------------------------------------------
> .de Z
> .sp 2
> .nr n 1
> ..
> .\"
> ------------------------------------------------------------------------
> .\" mode register m: 1 = easy, 2 = medium, 3 = hard
> .\"
> ------------------------------------------------------------------------
> .\" You could also use .X in modes 2 & 3
> .de Q
> .if \\nm=1 .X \\\$@
> .if \\nm=2 .Y \\\$@
> .if \\nm=3 .Y \\\$@
> ..
> .\"
> ------------------------------------------------------------------------
> .\" Using blanks of variable length
> .de X
> .ds n \s'-2'\\nn\s'0'
> .if \\nm=1 .char _ \v'.2m'\h'.1m'\D'l .8m 0'\h'.1m'\v'-.2m'
> .if \\nm=2 .char _ \v'.2m'\D'l 1m 0'\v'-.2m'
> .if \\nm=3 .char _ \v'.2m'\D'l 1m 0'\v'-.2m'
> .tr a_b_c_d_e_f_g_h_i_j_k_l_m_n_o_p_q_r_s_t_u_v_w_x_y_z_
> .nr w (\w'\\\$1'-\w'\\*n')/2
> \Z'\\\$1'\c
> .ds x \\\$1
> .substring x 0 0
> .if \\nm=1 \Z'\o'_\\*x''\c
> .if \\nm=2 \Z'\o'_\\*x''\c
> \h'\\nwu'\v'1m'\\*n\v'-1m'\h'\\nwu'\\\$2
> .nr n +1
> ..
> .\"
> ------------------------------------------------------------------------
> .\" Using blanks of fixed length
> .de Y
> .if \\nm=1 .tm Please use .X instead of .Y in "easy" mode
> .ds W \v'.2m'\D'l 3.5c 0'\v'-.2m'
> .ds n \s'-2'\\nn\s'0'
> .nr w (\w'\\*W'-\w'\\*n')/2
> .ds x \\\$1
> .substring x 0 0
> .if \\nm=1 \Z'\|\\*x'\c
> .if \\nm=2 \Z'\|\\*x'\c
> \Z'\\*W'\c
> \h'\\nwu'\v'1m'\\*n\v'-1m'\h'\\nwu'\\\$2
> .nr n +1
> ..
> .\"
> ------------------------------------------------------------------------
> .sp 3c
> .ps 12
> .vs 14
> .\"
> ------------------------------------------------------------------------
> .nr m 1
> .Z
> I am
> .Q honored
> to be with you today at your
> .Q commencement .
> .nr m 2
> .Z
> I am
> .Q honored
> to be with you today at your
> .Q commencement .
> .nr m 3
> .Z
> I am
> .Q honored
> to be with you today at your
> .Q commencement .
>
>
> ... I left out the extra line in the "easy" case
> because I personally didn't like it.)
>

I didn't really like it either, but this was all I was able to come up with.
I love the way this solution works.
If it isn't obvious by now, I am a complete novice to groff specifically
and typesetting in general, but I like what it makes possible. That said,
I would really appreciate it if someone would  walk me through exactly what
is
happening in the following lines:

> if \\nm=1 .X \\\$@
>
I follow the front, but what is address@hidden

the following also loses me:

> \h'\\nwu'\v'1m'\\*n\v'-1m'\h'\\nwu'\\\$2
>
what exactly  is \\nwu?
--
View this message in context:
http://old.nabble.com/Using-variables-from-register-within-fractions-or-equations-tp33299025p33342743.html
Sent from the Groff - General mailing list archive at Nabble.com.

reply via email to