All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Alejandro Colomar <colomar.6.4.3@gmail.com>
Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com>,
	linux-man <linux-man@vger.kernel.org>
Subject: Re: Format inline code
Date: Thu, 5 Nov 2020 22:37:10 +0100	[thread overview]
Message-ID: <CAKgNAkiWYUM1qg2HPRczMyd6hQFjhxPAcyRadOGZ6HLNeHuw1A@mail.gmail.com> (raw)
In-Reply-To: <eb1afb92-9327-43e4-c4bf-6593289c9c3d@gmail.com>

Hi Alex,

On Thu, 5 Nov 2020 at 15:59, Alejandro Colomar <colomar.6.4.3@gmail.com> wrote:
>
>
>
> On 2020-11-05 12:36, Michael Kerrisk (man-pages) wrote:
> > So, suppose I want to produce output as follows, where XXXXXXXXX is
> > the start of a hanging list (.TP):
> >
> > [[
> > xxx(2)                     System Calls Manual                     xxx(2)
> >
> >         XXXXXXXXXX
> >                Lorem  ipsum  dolor  sit amet, consectetur adipiscing elit,
> >                sed do eiusmod tempor incididunt ut labore et dolore  magna
> >                aliqua.  Ut enim ad minim veniam, quis nostrud exercitation
> >                ullamco laboris nisi ut aliquip ex ea commodo consequat.
> >
> >                    int
> >                    main(int argc, char *argv[])
> >                    {
> >                        return 0;
> >                    }
> >
> > zzz                                yyy                             xxx(2)
> > ]]
> >
> > The way I currently produce that is markup something like:
> >
> > [[
> > .TH xxx 2 yyy zzz
> > .TP
> > XXXXXXXXXX
> > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
> > eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
> > enim ad minim veniam, quis nostrud exercitation ullamco laboris
> > nisi ut aliquip ex ea commodo consequat.
> > .IP
> > .in +4n
> > .EX
> > int
> > main(int argc, char *argv[])
> > {
> >      return 0;
> > }
> > .EE
> > .in
> > ]]
> >
> > Downside: in the above, I need to know whether to use .IP or .PP,
> > depending on whether I'm currently in an indented text block.
> >
> > I think you are suggesting that instead, I could do something like:
> >
> > [[
> > .TH xxx 2 yyyyy zzzzz
> > .TP
> > XXXXXXXXXX
> > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
> > eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
> > enim ad minim veniam, quis nostrud exercitation ullamco laboris
> > nisi ut aliquip ex ea commodo consequat.
> > .RS
> > .PP
> > .RS +4n
> > .EX
> > int
> > main(int argc, char *argv[])
> > {
> >      return 0;
> > }
> > .EE
> > .RE
> > .RE
> > ]]
> >
> > I agree that this works, and has the virtue that I can consistently use
> >
> > .PP
> > .RS +4n
> > .EX
> > ...
> > .EE
> > .RE
> >
> > everywhere. The downside is that I have to add an extra .RS/.RE pair,
> > and that's quite a bit of mark-up to add each time (to a construct
> > that is already quite mark-up heavy). I don't totally object to the
> > extra mark-up, but it would be nice if there was a way to accomplish
> > the desired result (consistent mark-up everywhere) without requiring
> > su much mark-up.
>
> Hi Michael,
>
> On one hand, yes, it adds some lines of markup, i.e., a bit of noise.
> On the other hand, I just see .RS/.RE as {/} in C scopes:
> they clearly delimit logic blocks of text,
> and also help in greatly reducing the quantity of .IP needed,
> needing only .PP for most things, which simplifies logic.
>
> Choose your poison :p

So, suppose we change this. Really, what I should have written is:

[[
.TH xxx 2 yyyyy zzzzz
.TP
XXXXXXXXXX
.RS           <----- I moved this .RS
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
.PP
.RS +4n
.EX
int
main(int argc, char *argv[])
{
    return 0;
}
.EE
.RE
.RE
]]

So, any time we have a .TP block that might have inline code (or
perhaps just multiple paragraphs), then the proposal is that we write

[[
.TP
HEADWORD
.RS
...
.RE
]]

But, what about the .TP blocks that contain just a single paragraph
and no inline code? Do we omit the .RS/.RE? That's a little
inconsistent and possibly confusing. On the other hand, if we add the
.RS/.RE to such blocks, that's a lot of clutter. Do you see what I
mean? It looks like there's no simple answer here.

Thanks,

Michael
-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

  reply	other threads:[~2020-11-05 21:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 10:19 Format inline code Alejandro Colomar
2020-11-05 11:36 ` Michael Kerrisk (man-pages)
2020-11-05 14:59   ` Alejandro Colomar
2020-11-05 21:37     ` Michael Kerrisk (man-pages) [this message]
2020-11-05 22:01       ` Alejandro Colomar
2020-11-06  9:38         ` Alejandro Colomar
2020-11-06 16:00           ` Michael Kerrisk (man-pages)
2020-11-06 16:36             ` Alejandro Colomar
2020-11-08 12:22               ` Michael Kerrisk (man-pages)
2020-11-12 11:32                 ` Alejandro Colomar
2020-11-12 21:17                 ` Alejandro Colomar
2020-11-13  8:28                   ` G. Branden Robinson
2020-11-13  9:00                     ` Michael Kerrisk (man-pages)
2020-11-13  9:47                       ` G. Branden Robinson
2020-11-13 10:11                         ` Michael Kerrisk (man-pages)
2020-11-13 10:21                       ` Alejandro Colomar
     [not found]                 ` <fbaf2a56-3f2e-e5ce-6ca2-e8f30156947d@gmail.com>
2020-11-12 21:20                   ` Alejandro Colomar
2020-11-12 22:55                     ` [RFC v1] perf_event_open.2: srcfix + ffix Alejandro Colomar
2020-11-13  9:21                       ` Michael Kerrisk (man-pages)
2020-11-13 10:26                         ` Alejandro Colomar
2020-11-13 10:39                           ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKgNAkiWYUM1qg2HPRczMyd6hQFjhxPAcyRadOGZ6HLNeHuw1A@mail.gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=colomar.6.4.3@gmail.com \
    --cc=g.branden.robinson@gmail.com \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.