Hi Sebastian,

I'm sorry it's taken a while to follow up with you.

At 2025-01-29T00:57:19-0400, sebastien peterson boudreau wrote:
> The quotes for `i'th and `i+1'th are very important because the parser
> will reject input that uses two right/neutral quotes/apostrophes.

You're right!  Back in November 2020, I "corrected" this example.

commit dfa7b3108f24c30a1fe7b723d2c7fee7ebbd9671
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Wed Nov 4 21:41:11 2020 +1100

    man pages: Convert .nf/fi/nh/hy non[s]ense to .EX/EE.
[...]
    * src/preproc/pic/pic.1.man: Also fix bizarre use of matched,
      directional, single-quote special character escapes in a code example.
      Use the _correct_ special character escape, \[aq], instead.
      e375837773f99ea0de14ebebe5fb69e22b39fb28 (18 September 2014) is a
      perversely fascinating commit, not least for its misleading summary.

However it appears that I only half-corrected the problem I diagnosed.

@@ -1146,15 +1162,14 @@ .SS "Other changes"
 and the
 .BR th .
 .
+.
 For example,
 .IP
-.ft B
-.nf
+.EX
 for i = 1 to 4 do {
-   line from \[oq]i\[cq]th box.nw to \[oq]i+1\[cq]th box.se
+   line from \[aq]i\[aq]th box.nw to \[aq]i+1\[aq]th box.se
 }
-.ft
-.fi
+.EE
 .
 .
 .\" ====================================================================

Obviously the `oq` and `cq` special characters aren't correct, but I
knew very little about pic(1) at the time and didn't understand that it
really does use m4/TeX/troff-style quotation syntax for its embedded
expressions.  I find the decision odd, but I'm probably decades late to
weigh in on it.

One could reasonably chide me for not testing the example before
"correcting" it...unfortunately the example _doesn't work_ in isolation.
You have to give it at least 5 boxes to work with first.

I put together a capsule document for testing.

$ cat EXPERIMENTS/pic-ith.groff 
.mso pic.tmac
.sp 1i
This is a \f[I]pic\f[] example.
.sp
.PS
for i = 1 to 4 do {
   box
   move right 0.5
}
for i = 1 to 3 do {
   arrow from `i'th box.ne to `i+1'th box.sw
}
.PE
.sp
All done\[em]bye!

This compiles and renders without errors or surprises.

(It is likely not the slickest way to achieve the goal; I am a rank
novice with pic.)

Also, I found the overstriking of the lines on the boxes distracting;
possibly they weren't in whatever the context was whence this was
extracted.  Further, using arrows instead of lines makes the picture
more closely resemble some I've seen in books typeset with *roff.

I'll update the example to use the foregoing PS/PE region.

> The double quotes \[lq] and \[rq] were also adjusted as it looked like
> a mistake.

That, too, is a good catch.

I'll apply your fixes.  They should appear in my next Git push and the
forthcoming groff 1.24.0 release.

Thanks for the report and the patch!

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to