[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] LaTeX-style `emph'
From: |
Robert D. Goulding |
Subject: |
Re: [Groff] LaTeX-style `emph' |
Date: |
Wed, 4 Dec 2002 15:50:27 -0500 (EST) |
On Wed, 4 Dec 2002, Werner LEMBERG wrote:
> > Has anyone come up with a good way to implement a LaTeX-style emph -
> > i.e., switches to italic font if the current font is roman, but
> > roman if it is italic. I thought of the following:
> >
> > .ds emph \R'nF (3-\\n(.f)'\f[\\n(nF]\\$1\fP
> >
> What about this:
>
> .ds emphTR TI
> .ds emphTI TR
> .ds emphTB TBI
> .ds emphTBI TB
> .
> .ds emphHR HI
> .ds emphHI HR
> .ds emphHB HBI
> .ds emphHBI HB
> .
> .ds Emph \E*[emph]
> .ds emph \f[\\*[emph\\n[.fn]]]
> .
...
>
>
> The following lengthy solution works for all families. In a macro
> package, the first four lines of the `emph' string should be called
> while selecting the font family.
>
> .ds emph \
> \f[R]\R'tmp \\n[.f]'\f[]\
> \f[I]\R'emph\\n[tmp] \\n[.f]'\R'emph\\n[.f] \\n[tmp]'\f[]\
> \f[B]\R'tmp \\n[.f]'\f[]\
> \f[BI]\R'emph\\n[tmp] \\n[.f]'\R'emph\\n[.f] \\n[tmp]'\f[]\
> \f[\\n[emph\\n[.f]]]
>
I'm amazed - thanks very much for coming up with this solution. I'll test
it out with refer - it will be very useful for book titles within book
titles etc.
>
> > (BTW, as I play around with inline macros like this, I keep thinking
> > that groff needs some kind of inline conditional - is this
> > possible?)
>
> Make some syntax suggestions.
I was thinking about something along the lines of
\i'test''iftrue''iffalse'.
Perhaps there could be a short form using the standard conditional
operators. E.g., \it'iftroff''ifnottroff'
But I have no idea whether this is feasible/desirable.
Robert.