Skip to contentSkip to conversation

Linux man-pages PDF book

DISCUSSION Alejandro Colomar 3 participants 31 messages Apr 14, 2024 – Apr 18, 2024 3 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Alejandro Colomar

author maintainer
#0 lore raw

Hi Deri,

Since the conversation in groff's bug report was getting off-topic, I'm opening this email thread.

The makefile target was recently renamed from build-book to build-pdf-book (for consistency reasons).

I also reorganized the files to put them inside the build system. Here are now the files most relevant for generating the book:

	$ find \
		share/mk/configure/build-depends/texlive-fonts-extra/ \
		share/mk/build/fonts/ \
		share/mk/build/pdf/book/ \
		-type f;
	share/mk/configure/build-depends/texlive-fonts-extra/Tinos.pfb.mk
	share/mk/build/fonts/_.mk
	share/mk/build/fonts/TINOR
	share/mk/build/fonts/tinos.mk
	share/mk/build/pdf/book/_.mk
	share/mk/build/pdf/book/prepare.pl
	share/mk/build/pdf/book/front.roff
	share/mk/build/pdf/book/an.tmac

I removed the Tinos.pfa file, since now I generate it at build time from the Tinos.pfb file (installed with Debian's texlive-fonts-extra).

Either the reorganization, or the generation of the font results in a new warning:

troff:<standard input>:1649: error: cannot load font 'TINOR' to mark it as special

Since I didn't notice any changes in the PDF visually, and I removed a gigantic binary file, I proceeded with it, even with the new warning. It would be great if we can do something similar to get rid of the TINOR file, and generate it at build time.
I would also like to do the same with the Unifont font, which I haven't yet added because I hate adding gigantic binary files to the repo.

There's also the page issue. Now it seems to reset the page number for every TH.

Have a lovely day!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#1 lore raw
Quoted 11 lines · Alejandro Colomar

Hi Deri,

Since the conversation in groff's bug report was getting off-topic, I'm opening this email thread.

The makefile target was recently renamed from build-book to build-pdf-book (for consistency reasons).

I also reorganized the files to put them inside the build system. Here are now the files most relevant for generating the book:

Quoted 13 lines
	$ find \
		share/mk/configure/build-depends/texlive-fonts-extra/ \
		share/mk/build/fonts/ \
		share/mk/build/pdf/book/ \
		-type f;
	share/mk/configure/build-depends/texlive-fonts-extra/Tinos.pfb.mk
	share/mk/build/fonts/_.mk
	share/mk/build/fonts/TINOR
	share/mk/build/fonts/tinos.mk
	share/mk/build/pdf/book/_.mk
	share/mk/build/pdf/book/prepare.pl
	share/mk/build/pdf/book/front.roff
	share/mk/build/pdf/book/an.tmac

Another thing I want to do, as mentioned in the groff bug, is to remove our an.tmac. Is there any change we can use a minimal definition that we can cat(1) to the system an.tmac? Or maybe instead of cat(1)ing it, tell groff(1) to use our definition in addition to -man.

Quoted 21 lines

I removed the Tinos.pfa file, since now I generate it at build time from the Tinos.pfb file (installed with Debian's texlive-fonts-extra).

Either the reorganization, or the generation of the font results in a new warning:

troff:<standard input>:1649: error: cannot load font 'TINOR' to mark it as special

Since I didn't notice any changes in the PDF visually, and I removed a gigantic binary file, I proceeded with it, even with the new warning. It would be great if we can do something similar to get rid of the TINOR file, and generate it at build time.
I would also like to do the same with the Unifont font, which I haven't yet added because I hate adding gigantic binary files to the repo.

There's also the page issue. Now it seems to reset the page number for every TH.

Have a lovely day!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
#29 lore raw
In reply to Alejandro Colomar
Quoted 2 lines · Alejandro Colomar

There's also the page issue. Now it seems to reset the page number for every TH.

This might be a simple issue. Make sure that you're passing groff (or troff) an option to set the C register to a true value.

groff_man(7):
-rC1 Number output pages consecutively, in strictly increasing
sequence, rather than resetting the page number to 1 (or the value of register P) with each new man document.

Regards,
Branden

#2 lore raw
In reply to Alejandro Colomar
Quoted 5 lines · Alejandro Colomar

Another thing I want to do, as mentioned in the groff bug, is to remove our an.tmac. Is there any change we can use a minimal definition that we can cat(1) to the system an.tmac? Or maybe instead of cat(1)ing it, tell groff(1) to use our definition in addition to -man.

Deri had been using the cover page document to append to man(7) macros definitions, which basically accomplished this.

I've since refactored everything that hyperlinked book generation needed in that respect into groff's "an.tmac" (in Git), leaving the cover page to do only cover page things.

https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in

Regards,
Branden

author maintainer
#3 lore raw

Hi Branden!

Quoted 7 lines · G. Branden Robinson
Quoted 5 lines · Alejandro Colomar

Another thing I want to do, as mentioned in the groff bug, is to remove our an.tmac. Is there any change we can use a minimal definition that we can cat(1) to the system an.tmac? Or maybe instead of cat(1)ing it, tell groff(1) to use our definition in addition to -man.

Quoted 8 lines

Deri had been using the cover page document to append to man(7) macros definitions, which basically accomplished this.

I've since refactored everything that hyperlinked book generation needed in that respect into groff's "an.tmac" (in Git), leaving the cover page to do only cover page things.

https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in

Hmmm. I notice that your cover page has a few things that we have as part of the prepare.pl script:
<https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in#n7>
<https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in#n42>
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/prepare.pl#n86>

Maybe we could do the same, to reduce the work of prepare.pl?

Our front page is also clean from an.tmac stuff. We have the an.tmac fork here:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/an.tmac>
And the front page is:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/front.roff>

However, our an.tmac is not for appending, but for replacing man(7). :( I'd like to get rid of that an.tmac fork. Does your message mean that if I use groff git HEAD to build our book I can just drop the fork and use man(7), and groff(1) will do the right thing?

Also, what does .t mean (in GMPfront.t.in)? I changed the file extension to .roff (so, <front.roff>) in the Linux man-pages, as it's just a roff(7) file.

Have a lovely day!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#30 lore raw
In reply to G. Branden Robinson

Hi Branden,

Quoted 11 lines · G. Branden Robinson
Quoted 2 lines · Alejandro Colomar

There's also the page issue. Now it seems to reset the page number for every TH.

This might be a simple issue. Make sure that you're passing groff (or troff) an option to set the C register to a true value.

groff_man(7):
-rC1 Number output pages consecutively, in strictly increasing
sequence, rather than resetting the page number to 1 (or the value of register P) with each new man document.

Hmmmm. Maybe I should follow v7's tradition and restart the page number at each TH. Let's call it an accidental improvement, and not a regression. :)

Although it would be interesting to learn when/why this changed.

Thanks!
Alex

Quoted 3 lines

Regards,
Branden

Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#31 lore raw
Quoted 15 lines · Alejandro Colomar

Hi Branden,

Quoted 11 lines · G. Branden Robinson
Quoted 2 lines · Alejandro Colomar

There's also the page issue. Now it seems to reset the page number for every TH.

This might be a simple issue. Make sure that you're passing groff (or troff) an option to set the C register to a true value.

groff_man(7):
-rC1 Number output pages consecutively, in strictly increasing
sequence, rather than resetting the page number to 1 (or the value of register P) with each new man document.

Quoted 5 lines

Hmmmm. Maybe I should follow v7's tradition and restart the page number at each TH. Let's call it an accidental improvement, and not a regression. :)

Although it would be interesting to learn when/why this changed.

It seems to have been here:

$ git show 6d87a75a6df0 -- scripts/LinuxManBook/build.sh;
commit 6d87a75a6df0696e780255d865bf65da09f36f01
Author: Alejandro Colomar <[email protected]>
Date:   Fri Dec 1 00:55:11 2023 +0100

scripts/LinuxManBook/: Simplify pipeline

Call the groff(1) pipeline only once. This optimizes around 2 seconds, while also simplifying the code.

This change was originally written by Deri, with some parts written by Brian. I took the script that Deri sent, and split it so that the groff(1) pipeline is called from the shell script, and the Perl script is limited to editing the man(7) pages. This helps me understand the process, since my understanding of Perl is very limited. It also makes this change smaller, so that it's less of a big-bang.

scripts/LinuxManBook/build.sh +3 -15
index a6e578f64..8e373c073 100755
@@ -3,25 +3,13 @@
 # SPDX-License-Identifier: GPL-3.0-or-later
 
 (
-       "$(dirname "$0")"/prepare.pl "$1" \
-       | preconv \
-       | pic \
-       | tbl \
-       | eqn -Tpdf \
-       | troff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 -dpaper=a4 \
-               -M"$(dirname "$0")" -mandoc -manmark -rC1 -rCHECKSTYLE=3 \
-               2>&1 >/dev/null \
-       | LC_ALL=C grep '^\. *ds ';
-
+       cat "$(dirname "$0")"/LMBfront.roff;
+       cat "$(dirname "$0")"/an.tmac;
        "$(dirname "$0")"/prepare.pl "$1";
 ) \
 | preconv \
 | pic \
 | tbl \
 | eqn -Tpdf \
-| (
-       troff -Tpdf -ms <"$(dirname "$0")"/LMBfront.ms;
-       troff -Tpdf -M"$(dirname "$0")" -mandoc -manmark \
-               -F"$(dirname "$0")" -dpaper=a4;
-) \
+| troff -Tpdf -F"$(dirname "$0")" -dpaper=a4 \
 | gropdf -F"$(dirname "$0")" -pa4;
Signature · 1 line
<https://www.alejandro-colomar.es/>
#4 lore raw
In reply to Alejandro Colomar

Hi Alex,

Quoted 7 lines · Alejandro Colomar
Quoted 5 lines · G. Branden Robinson

I've since refactored everything that hyperlinked book generation needed in that respect into groff's "an.tmac" (in Git), leaving the cover page to do only cover page things.

https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in

Quoted 7 lines

Hmmm. I notice that your cover page has a few things that we have as part of the prepare.pl script:
<https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in#n7>
<https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in#n42>
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/prepare.pl#n86>

Maybe we could do the same, to reduce the work of prepare.pl?

I didn't look closely at that complicated Perl script, but it seems likely. Essentially, anything that didn't need to be parameterized (i.e., lines you write out with Perl but don't need to do any Perl variable interpolation in), I would keep in a plain text document.

Quoted 3 lines

Our front page is also clean from an.tmac stuff. We have the an.tmac fork here:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/an.tmac>

Might be worth diffing that with groff Git HEAD.

Quoted 2 lines

And the front page is:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/front.roff>

Yup, that's pretty clean and focused.

Quoted 4 lines

However, our an.tmac is not for appending, but for replacing man(7). :( I'd like to get rid of that an.tmac fork. Does your message mean that if I use groff git HEAD to build our book I can just drop the fork and use man(7), and groff(1) will do the right thing?

I think so, and want to know if it doesn't. Also, fair warning, Deri said he observed a CRAZY bad performance regression when building the Linux man-pages book with groff Git HEAD. If you can reproduce that, then I have some work to do. Let me know.

Quoted 3 lines

Also, what does .t mean (in GMPfront.t.in)? I changed the file extension to .roff (so, <front.roff>) in the Linux man-pages, as it's just a roff(7) file.

It was Deri's choice. Some people have historically used the t suffix to indicate a "troff" file. I don't employ that practice, personally, because it's also popular as a suffix for "test script", and troff documents can also be rendered with nroff.

Personally, I use .roff for *roff documents I intend to be portable between AT&T/DWB troff and GNU troff, and .groff for ones that use GNU extensions.

Quoted 3 lines · Alejandro Colomar

Hmmmm. Maybe I should follow v7's tradition and restart the page number at each TH. Let's call it an accidental improvement, and not a regression. :)

I think it's a matter of taste. This issue came up last month on the groff list. As often happens with me, it turned into an episode of Unix History Detectives. :-|

https://lists.gnu.org/archive/html/groff/2024-03/msg00163.html

Quoted 1 line

Although it would be interesting to learn when/why this changed.

The default has never changed in groff as far as I know, and I'm certain I haven't personally touched it--I'd remember writing the usual 20,000 word essay with 2 dozen citations that usually accompanies my breaks with tradition.

Regards,
Branden

#32 lore raw
In reply to Alejandro Colomar

Hi Alex,

Quoted 13 lines · Alejandro Colomar
Quoted 10 lines · Alejandro Colomar
Quoted 4 lines

groff_man(7):
-rC1 Number output pages consecutively, in strictly increasing
sequence, rather than resetting the page number to 1 (or the value of register P) with each new man document.

Hmmmm. Maybe I should follow v7's tradition and restart the page number at each TH. Let's call it an accidental improvement, and not a regression. :)

Although it would be interesting to learn when/why this changed.

It seems to have been here:

[...]

scripts/LinuxManBook/build.sh line 8

Quoted 8 lines
scripts/LinuxManBook/build.sh +2 -5
-       | troff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 -dpaper=a4 \
-               -M"$(dirname "$0")" -mandoc -manmark -rC1 -rCHECKSTYLE=3 \
-               2>&1 >/dev/null \
-       | LC_ALL=C grep '^\. *ds ';
-
+       cat "$(dirname "$0")"/LMBfront.roff;
+       cat "$(dirname "$0")"/an.tmac;
        "$(dirname "$0")"/prepare.pl "$1";

I don't think there's one right choice here. I _would_ make sure that the PDF page numbering (visible in the PDF viewer's outline pane) matches that used by the document. To do otherwise will frustrate users.

Regards,
Branden

author maintainer
#33 lore raw
In reply to Alejandro Colomar

Hi Branden,

Quoted 6 lines · Alejandro Colomar

The makefile target was recently renamed from build-book to build-pdf-book (for consistency reasons).

I also reorganized the files to put them inside the build system. Here are now the files most relevant for generating the book:

Quoted 13 lines
	$ find \
		share/mk/configure/build-depends/texlive-fonts-extra/ \
		share/mk/build/fonts/ \
		share/mk/build/pdf/book/ \
		-type f;
	share/mk/configure/build-depends/texlive-fonts-extra/Tinos.pfb.mk
	share/mk/build/fonts/_.mk
	share/mk/build/fonts/TINOR
	share/mk/build/fonts/tinos.mk
	share/mk/build/pdf/book/_.mk
	share/mk/build/pdf/book/prepare.pl
	share/mk/build/pdf/book/front.roff
	share/mk/build/pdf/book/an.tmac

Branden, could you list all files in groff.git that are similarly responsible for the generation of your book, so I can compare?

Have a lovely day!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#5 lore raw
In reply to G. Branden Robinson

Hi Branden, Deri,

Quoted 16 lines · G. Branden Robinson

Hi Alex,

Quoted 13 lines · Alejandro Colomar
Quoted 5 lines · G. Branden Robinson

I've since refactored everything that hyperlinked book generation needed in that respect into groff's "an.tmac" (in Git), leaving the cover page to do only cover page things.

https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in

Hmmm. I notice that your cover page has a few things that we have as part of the prepare.pl script:
<https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in#n7>
<https://git.savannah.gnu.org/cgit/groff.git/tree/doc/GMPfront.t.in#n42>
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/prepare.pl#n86>

Quoted 6 lines
Quoted 1 line

Maybe we could do the same, to reduce the work of prepare.pl?

I didn't look closely at that complicated Perl script, but it seems likely. Essentially, anything that didn't need to be parameterized (i.e., lines you write out with Perl but don't need to do any Perl variable interpolation in), I would keep in a plain text document.

I'd like to see how you build your book.

Quoted 5 lines
Quoted 3 lines

Our front page is also clean from an.tmac stuff. We have the an.tmac fork here:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/an.tmac>

Might be worth diffing that with groff Git HEAD.

Attached are diffs against HEAD and against 1.23.0.

Quoted 10 lines
Quoted 2 lines

And the front page is:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/build/pdf/book/front.roff>

Yup, that's pretty clean and focused.

Quoted 4 lines

However, our an.tmac is not for appending, but for replacing man(7). :( I'd like to get rid of that an.tmac fork. Does your message mean that if I use groff git HEAD to build our book I can just drop the fork and use man(7), and groff(1) will do the right thing?

Quoted 4 lines

I think so, and want to know if it doesn't. Also, fair warning, Deri said he observed a CRAZY bad performance regression when building the Linux man-pages book with groff Git HEAD. If you can reproduce that, then I have some work to do. Let me know.

Can't reproduce. I've removed the an.tmac fork, and added -man to troff(1)'s invocation, and get the same times.

$ time make build-pdf-book 2>/dev/null
GROPDF		.tmp/man-pages-6.7-53-g5125d867d.pdf

real 0m13.307s
user 0m16.229s
sys 0m0.481s

$ time make build-pdf-book 2>/dev/null
GROPDF		.tmp/man-pages-6.7-53-g5125d867d-dirty.pdf

real 0m13.564s
user 0m17.060s
sys 0m0.510s

(I've built all the dependencies before hand, so that only the PDF is
built in these invocations.)
(The -dirty one uses -man.)

Quoted 5 lines
Quoted 4 lines

Also, what does .t mean (in GMPfront.t.in)? I changed the file extension to .roff (so, <front.roff>) in the Linux man-pages, as it's just a roff(7) file.

Quoted 8 lines

It was Deri's choice. Some people have historically used the t suffix to indicate a "troff" file. I don't employ that practice, personally, because it's also popular as a suffix for "test script", and troff documents can also be rendered with nroff.

Personally, I use .roff for *roff documents I intend to be portable between AT&T/DWB troff and GNU troff, and .groff for ones that use GNU extensions.

Hmmm. Does the front use GNU features? Should I change the extension?

Quoted 10 lines
Quoted 3 lines · Alejandro Colomar

Hmmmm. Maybe I should follow v7's tradition and restart the page number at each TH. Let's call it an accidental improvement, and not a regression. :)

I think it's a matter of taste. This issue came up last month on the groff list. As often happens with me, it turned into an episode of Unix History Detectives. :-|

https://lists.gnu.org/archive/html/groff/2024-03/msg00163.html

Hmmm. Your obvservation about matching the PDF navigator makes sense. Deri, was the removal of -rC1 on purpose?

Quoted 9 lines
Quoted 1 line

Although it would be interesting to learn when/why this changed.

The default has never changed in groff as far as I know, and I'm certain I haven't personally touched it--I'd remember writing the usual 20,000 word essay with 2 dozen citations that usually accompanies my breaks with tradition.

Regards,
Branden

Have a lovely day!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
home/alx/src/linux/man-pages/man-pages/contrib/share/mk/build/pdf/book/an.tmac renamed from home/alx/src/gnu/groff/1.23.0/tmac/an.tmac +67 -30
@@ -203,9 +203,25 @@
 .  ds an*section9 Kernel Developer's Manual\"
 ..
 .
+.de an*cln
+.  ds \\$1
+.  als an*cln:res \\$1
+.  shift
+.  ds an*cln:res \\$*\"
+.  ds an*cln:char \\*[an*cln:res]
+.  stringdown an*cln:res
+.  substring an*cln:char 0 0
+.  if '\\*[an*cln:char]'\%' .substring an*cln:res 1
+.  rm an*cln:char
+..
+.
 .\" Write a bookmark/anchor/link target $2 at hierarchical depth $1.
 .de an*bookmark
-.  if \\n[an*is-output-pdf] .pdfbookmark \\$1 \\$2
+.  if \\n[an*is-output-pdf] \{\
+.    if (\\n[.$]>2) .an*cln an*page-ref-nm \\$3\"
+.    ie (\\$1=1) .pdfbookmark -T "\\*[an*page-ref-nm]" \\$1 \\$2
+.    el .pdfbookmark \\$1 \\$2
+.  \}
 ..
 .
 .\" Begin man page.
@@ -293,7 +309,11 @@
 .    \" Simulate switch/case in roff.
 .          ie '\\$2'1' .ds an-extra3 \\*[an*section1]\"
 .    el \{.ie '\\$2'2' .ds an-extra3 \\*[an*section2]\"
+.    el \{.ie '\\$2'2type' .ds an-extra3 \\*[an*section2type]\"
 .    el \{.ie '\\$2'3' .ds an-extra3 \\*[an*section3]\"
+.    el \{.ie '\\$2'3const' .ds an-extra3 \\*[an*section3const]\"
+.    el \{.ie '\\$2'3head' .ds an-extra3 \\*[an*section3head]\"
+.    el \{.ie '\\$2'3type' .ds an-extra3 \\*[an*section3type]\"
 .    el \{.ie '\\$2'4' .ds an-extra3 \\*[an*section4]\"
 .    el \{.ie '\\$2'5' .ds an-extra3 \\*[an*section5]\"
 .    el \{.ie '\\$2'6' .ds an-extra3 \\*[an*section6]\"
@@ -301,7 +321,7 @@
 .    el \{.ie '\\$2'8' .ds an-extra3 \\*[an*section8]\"
 .    el \{.ie '\\$2'9' .ds an-extra3 \\*[an*section9]\"
 .    el                .ds an-extra3 \" empty
-.    \}\}\}\}\}\}\}\}
+.    \}\}\}\}\}\}\}\}\}\}\}\}
 .  \}
 .
 .  ds an-extra1 "\\$3\"
@@ -420,7 +440,7 @@
 .  ie \\n[cR] .pl +1v
 .  el         .sp .5i
 .  if !\\n[an*was-TH-bookmark-emitted] \{\
-.    an*bookmark 1 \E*[an*page-ref-string]
+.\" .    an*bookmark 2 \E*[an*page-ref-string]
 .    nr an*was-TH-bookmark-emitted 1
 .  \}
 .  tl '\\*[an-pageref]'\\*[an-extra3]'\\*[an-pageref]'
@@ -458,6 +478,8 @@
 .  \" PDF bookmarks.
 .  ds an*page-ref-string \\*[an*topic](\\*[an*section])\"
 .  ds an-pageref \\*[an*topic-abbv](\\*[an*section])\"
+.  an*cln an*page-ref-bm-nm \\*[an*topic]_\\*[an*section]\"
+.  stringdown an*page-ref-bm-nm
 .  nr an-header-width \\w'\\*[an-pageref]\\*[an-extra3]\\*[an-pageref]'
 .  while (\\n[an-header-width] >= \\n[.lt]) \{\
 .    \" The page topic is too long; trim some bits out of the middle.
@@ -695,8 +717,8 @@
 .  if \\n[.$] \{\
 .    ds an-section-heading \\$*\"
 .    if \\n[CS] .stringup an-section-heading
-.    an*bookmark 2 \E*[an-section-heading]
-.    nop \&\\*[an-section-heading]
+.    an*bookmark 3 "\\*[an-section-heading]"
+\&\\*[an-section-heading]
 .  \}
 .  if \\n[an-remap-I-style-in-headings] .ftr I I
 ..
@@ -721,7 +743,7 @@
 .  if \\n[an-remap-I-style-in-headings] .ftr I \\*[an-heading-family]BI
 .  if \\n[.$] \{\
 .    ds an*subsection-heading \\$*\"
-.    an*bookmark 3 \E*[an*subsection-heading]
+.    an*bookmark 4 "\\*[an*subsection-heading]"
 .    nop \&\\$*
 .  \}
 .  if \\n[an-remap-I-style-in-headings] .ftr I I
@@ -1169,30 +1191,45 @@
 .\" Set a man page cross reference.
 .\" .MR page-topic page-section [trailing-text]
 .de1 MR
-.  if ((\\n[.$] < 2) : (\\n[.$] > 3)) \
-.    an-style-warn .\\$0 expects 2 or 3 arguments, got \\n[.$]
-.  ds an*url man:\\$1(\\$2)\" used everywhere but macOS
-.  if (\\n[an*MR-URL-format] = 2) \
-.    ds an*url x-man-page://\\$2/\\$1\" macOS/Mac OS X since 10.3
-.  if (\\n[an*MR-URL-format] = 3) \
-.    ds an*url man:\\$1.\\$2\" Bwana (Mac OS X)
-.  if (\\n[an*MR-URL-format] = 4) \
-.    ds an*url x-man-doc://\\$2/\\$1\" ManOpen (Mac OS X pre-2005)
-.  nh
-.  if \\n[an*do-hyperlink] \{\
-.    if \\n[an*is-output-html] \
-.      nop \X^html:<a href="\\*[an*url]">^\c
-.    if \\n[an*is-output-terminal] \
-.      nop \X^tty: link \\*[an*url]^\c
-.  \}
-.      nop \&\\*[an-lic]\f[\\*[MF]]\\$1\\*[an-ic]\f[R](\\$2)\c
-.  if \\n[an*do-hyperlink] \{\
-.    if \\n[an*is-output-html] \
-.      nop \X^html:</a>^\c
-.    if \\n[an*is-output-terminal] \
-.      nop \X^tty: link^\c
+.  if ((\\n[.$] < 2) : (\\n[.$] > 4)) \
+.    an-style-warn .\\$0 expects 2 to 4 arguments, got \\n[.$]
+.  ie \\n[an*is-output-pdf] \{\
+.    nh
+.    ds an*title \\\\$4
+.    if '\\\\*[an*title]'' .ds an*title \\\\$1
+.    ie \\n(.$=1 \
+.      I \\$1
+.    el \{\
+.      an*cln an*page-ref-nm \\*[an*title]_\\$2
+.      ie d pdf:look(\\*[an*page-ref-nm]) .pdfhref L -D \\*[an*page-ref-nm] -A "\\$3" -- \fI\\$1\fP(\\$2)
+.      el .IR \\$1 (\\$2)\\$3
+.    \}
+.    hy \\n(mJ
+.  \}
+.  el \{\
+.    ds an*url man:\\$1(\\$2)\" used everywhere but macOS
+.    if (\\n[an*MR-URL-format] = 2) \
+.      ds an*url x-man-page://\\$2/\\$1\" macOS/Mac OS X since 10.3
+.    if (\\n[an*MR-URL-format] = 3) \
+.      ds an*url man:\\$1.\\$2\" Bwana (Mac OS X)
+.    if (\\n[an*MR-URL-format] = 4) \
+.      ds an*url x-man-doc://\\$2/\\$1\" ManOpen (Mac OS X pre-2005)
+.    nh
+.    if \\n[an*do-hyperlink] \{\
+.      if \\n[an*is-output-html] \
+.        nop \X^html:<a href="\\*[an*url]">^\c
+.      if \\n[an*is-output-terminal] \
+.        nop \X^tty: link \\*[an*url]^\c
+.    \}
+.        nop \&\\*[an-lic]\f[\\*[MF]]\\$1\\*[an-ic]\f[R](\\$2)\c
+.    if \\n[an*do-hyperlink] \{\
+.      if \\n[an*is-output-html] \
+.        nop \X^html:</a>^\c
+.      if \\n[an*is-output-terminal] \
+.        nop \X^tty: link^\c
+.    \}
+.    nop \&\\$3
 .  \}
-.  nop \&\\$3
 .  hy \\n[an*hyphenation-mode]
 ..
 .
@@ -1294,7 +1331,7 @@
      : \n[an*is-output-terminal]) \
 .  nr an*can-hyperlink 1
 .
-.ds an*body-family T \" Times
+.ds an*body-family \n[.fam] \" Times
 .ds an*example-family C \" Courier
 .
 .\" Map monospaced fonts to standard styles for groff's nroff devices.
home/alx/src/linux/man-pages/man-pages/contrib/share/mk/build/pdf/book/an.tmac renamed from home/alx/src/gnu/groff/master/tmac/an.tmac +156 -280

848 lines not on this page · raw message

author maintainer
#6 lore raw

Hi Branden,

Quoted 5 lines · Alejandro Colomar
Quoted 5 lines
Quoted 4 lines

However, our an.tmac is not for appending, but for replacing man(7). :( I'd like to get rid of that an.tmac fork. Does your message mean that if I use groff git HEAD to build our book I can just drop the fork and use man(7), and groff(1) will do the right thing?

Quoted 7 lines
Quoted 4 lines

I think so, and want to know if it doesn't. Also, fair warning, Deri said he observed a CRAZY bad performance regression when building the Linux man-pages book with groff Git HEAD. If you can reproduce that, then I have some work to do. Let me know.

Can't reproduce. I've removed the an.tmac fork, and added -man to troff(1)'s invocation, and get the same times.

I forgot to mention that while I can't reproduce the performance regression, I see a regression in the navigation panel. When using groff.git HEAD's an.tmac, the navigation panel doesn't allow collapsing an entire chapter, while the Linux man-pages fork of it does allow. Both PDF books are attached to this message.

Quoted 10 lines
$ time make build-pdf-book 2>/dev/null
GROPDF		.tmp/man-pages-6.7-53-g5125d867d.pdf

real 0m13.307s
user 0m16.229s
sys 0m0.481s

$ time make build-pdf-book 2>/dev/null
GROPDF		.tmp/man-pages-6.7-53-g5125d867d-dirty.pdf
Quoted 7 lines

real 0m13.564s
user 0m17.060s
sys 0m0.510s

(I've built all the dependencies before hand, so that only the PDF is
built in these invocations.)
(The -dirty one uses -man.)

Have a lovely night!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
#7 lore raw

Hi Alex,

Wow, I'm envious. For you, lore let those gigantic attachments through.

Quoted 5 lines · Alejandro Colomar

I forgot to mention that while I can't reproduce the performance regression, I see a regression in the navigation panel. When using groff.git HEAD's an.tmac, the navigation panel doesn't allow collapsing an entire chapter, while the Linux man-pages fork of it does allow. Both PDF books are attached to this message.

I see what you mean.

One bet is that I messed something up here and Deri's first or second hypothesis will be correct.

Here's mine.

You might need to set a register I added in this commit.

commit 5fbc22d022c07f517bc83aa9b8c97ea5536efd18

Author: G. Branden Robinson <[email protected]>
Date:   Sun Mar 3 23:57:38 2024 -0600

[man]: Add an*bookmark-base-level register.

* tmac/an.tmac: Add experimental feature to support increasing the base level of PDF bookmarks. Define register an*bookmark-base-level, initialized to zero.

(PT): Add 1 to it when producing document bookmark.

(SH): Add 2 to it when producing section heading bookmark.

(SS): Add 3 to it when producing subsection heading bookmark.

I don't know what you're using to produce the chapter headings in the navigation panel, but that likely needs to be at level 0 (or 1, depending on the convention the PDF spec uses).

I added the foregoing feature because it was obvious to me that someone might want to incorporate a man page collection into a larger work.

I admit I didn't think of the chapter organization application.

So you'd likely do something like this when building with groff Git HEAD.

'-r an*bookmark-base-level=1'

Let me know if that works out.

The foregoing is not documented because it needs field testing. Now maybe it will get some.

Quoted 10 lines
Quoted 10 lines
$ time make build-pdf-book 2>/dev/null
GROPDF		.tmp/man-pages-6.7-53-g5125d867d.pdf

real 0m13.307s
user 0m16.229s
sys 0m0.481s

$ time make build-pdf-book 2>/dev/null
GROPDF		.tmp/man-pages-6.7-53-g5125d867d-dirty.pdf
Quoted 7 lines
Quoted 7 lines

real 0m13.564s
user 0m17.060s
sys 0m0.510s

(I've built all the dependencies before hand, so that only the PDF is built in these invocations.)
(The -dirty one uses -man.)

This is very good news.

Regards,
Branden

author maintainer
#8 lore raw

Hi Branden,

Quoted 3 lines · G. Branden Robinson

Hi Alex,

Wow, I'm envious. For you, lore let those gigantic attachments through.

They've recently changed the infrastructure; maybe something has changed. I remember the limit was 100k in the past, while my attachments were 8.8M each, so it clearly seems to have been lifted. I didn't really think too much; we probably don't want to abuse that. I'll try to be careful.

Quoted 32 lines
Quoted 5 lines · Alejandro Colomar

I forgot to mention that while I can't reproduce the performance regression, I see a regression in the navigation panel. When using groff.git HEAD's an.tmac, the navigation panel doesn't allow collapsing an entire chapter, while the Linux man-pages fork of it does allow. Both PDF books are attached to this message.

I see what you mean.

One bet is that I messed something up here and Deri's first or second hypothesis will be correct.

Here's mine.

You might need to set a register I added in this commit.

commit 5fbc22d022c07f517bc83aa9b8c97ea5536efd18

Author: G. Branden Robinson <[email protected]>
Date:   Sun Mar 3 23:57:38 2024 -0600

[man]: Add an*bookmark-base-level register.

* tmac/an.tmac: Add experimental feature to support increasing the base level of PDF bookmarks. Define register an*bookmark-base-level, initialized to zero.

(PT): Add 1 to it when producing document bookmark.

(SH): Add 2 to it when producing section heading bookmark.

(SS): Add 3 to it when producing subsection heading bookmark.

Quoted 8 lines

I don't know what you're using to produce the chapter headings in the navigation panel, but that likely needs to be at level 0 (or 1, depending on the convention the PDF spec uses).

I added the foregoing feature because it was obvious to me that someone might want to incorporate a man page collection into a larger work.

I admit I didn't think of the chapter organization application.

If you often open the Linux man-pages book you'll realize why you want it. If you want to navigate to a page in chapter 7, you don't want to scroll down 1000+ bookmarks. You want to close the navigation for the first 6 chapters (and their subchapters), and easily arrive to chapter 7.

Quoted 5 lines

So you'd likely do something like this when building with groff Git HEAD.

'-r an*bookmark-base-level=1'

It doesn't seem to work. I did the following. I don't see a behavior change at all.

share/mk/build/pdf/book/_.mk +0 -0
index 166cd28a6..46ede414a 100644
@@ -31,20 +31,21 @@ _PDF_BOOK := $(_PDFDIR)/$(PDF_BOOK)
 
 
 $(_PDF_BOOK): $(_MANPAGES) $(_TINOS) $(MKBOOK) $(MK) | $$(@D)/
	$(info  $(INFO_)GROPDF          $@)
	$(MKBOOKDIR)/prepare.pl $(_MANDIR) \
	| $(CAT) $(MKBOOKDIR)/front.roff /dev/stdin \
	| $(PRECONV) \
	| $(PIC) \
	| $(TBL) \
	| $(EQN) -Tpdf \
-       | $(TROFF) -man -Tpdf -F$(_FONTSDIR) -dpaper=a4 $(TROFFFLAGS) \
+       | $(TROFF) -man -Tpdf -F$(_FONTSDIR) -dpaper=a4 \
+               '-r an*bookmark-base-level=1' $(TROFFFLAGS) \
	| $(GROPDF) -F$(_FONTSDIR) -pa4 $(GROPDFFLAGS) \
	| $(SPONGE) $@

.PHONY: build-pdf-book
build-pdf-book: $(_PDF_BOOK);

endif # include guard

Quoted 19 lines

Let me know if that works out.

The foregoing is not documented because it needs field testing. Now maybe it will get some.

Quoted 14 lines
Quoted 14 lines
$ time make build-pdf-book 2>/dev/null
GROPDF		.tmp/man-pages-6.7-53-g5125d867d.pdf

real 0m13.307s
user 0m16.229s
sys 0m0.481s

$ time make build-pdf-book 2>/dev/null
GROPDF		.tmp/man-pages-6.7-53-g5125d867d-dirty.pdf

real 0m13.564s
user 0m17.060s
sys 0m0.510s

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

(I've built all the dependencies before hand, so that only the PDF is built in these invocations.)
(The -dirty one uses -man.)

This is very good news.

:-)

BTW, the bookmarks for section headings and subsections don't have a friendly name; they are of the form #pdf:bm6. Maybe you could form a name of the form #intro.1:NOTES:Login, or whatever form makes sense to you, but based on the actual text of the bookmark.

Have a lovely night!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer Applied
#10 lore raw
In reply to a message not in the archive

[CC += linux-man@]

Hi Deri,

Quoted 8 lines · Deri
Quoted 1 line

Maybe we could do the same, to reduce the work of prepare.pl?

Hi Alex,

Feel free to have a go. These are the main differences between groff-man-pages (GM) and your book (LM):-

GM uses -mandoc not -man (by piping custom an.tmac).

I thought of using -mandoc too, for supporting other's pages, possibly written in mdoc(7). It shouldn't hurt.

Quoted 1 line

LM has separate sections so .TH should use bookmark level 2 (not 1).

Hmm.

Quoted 11 lines

(git an.tmac now has:-

.\" Customize this at the command line to, for example, group multiple .\" man pages within a collection or containing document. .nr an*bookmark-base-level 0

so maybe the last stopper from using git head's an.tmac can be circumvented (except of course it won't work - overwritten by zero!!!)).

GM uses .MR to handle intra-page links, LM uses .pdfhref L. As your desperate to use Branden's code rather than mine,

It's not about using Branden's code or yours. It's about not having to effectively maintain a fork of a huge file in the Linux man-pages git repository, of which I understand little.

Quoted 2 lines

I'll attach a patch which drops
an.tmac and uses the HEAD version - you may be disappointed.

I applied a patch earlier today to do this:
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=a5c977a5bd3b7b705f4b91f3b375cc68d7122331>

I know the behavior is worse than with the fork that you contributed, but I've reported the bug to Branden, and I expect he should fix it soon (especially when you have explained the reason and the fix (and the reason why his fix didn't work) in your email).

Quoted 3 lines

I don't understand what your doing with the font, why convert to .pfa, why move it - if you have the font just put texlive path into the download file in .tmp/font/devpdf with TINOSR.

I don't understand it either. That was the reason. :) Since you sent me a .pfa file, I kept having a .pfa file. Nobody told me I could just use a .pfb.

Quoted 2 lines

The an.patch can be applied to groff, to restore your original section hierarchy.

Thanks! Branden, would you mind picking it?

Quoted 2 lines

The shadow.patch can be applied to shadow which allows the book to be built without my custom an.tmac, using the patched version.

I see that your patch does more than mine. It uses pdfmom(1) instead of troff(1), and it also changes prepare.pl. Would you mind explaining why is that done, or why is it necessary? My patch, which is as simple as using -man and droping an.tmac, seems to be working as well as before (except for the section bookmarks). Although I didn't check thoroughly the shadow PDF; I may find more problems there, maybe?

Quoted 37 lines
Quoted 2 lines

Hmmm. Your obvservation about matching the PDF navigator makes sense. Deri, was the removal of -rC1 on purpose?

I don't really know, since you removed it, so I can't answer as to your intention. The original single perl script which did the whole job had it in:-

open(BK,"| ./test-pdfmake -Tpdf -k -pet -M. -mandoc -fTINO -F/usr/share/
groff/site-font -manmark -rC1 -rCHECKSTYLE=3 > LinuxManBook.pdf");

You then deconstructed the script for your own edification, and at one stage this was the result:-

#!/bin/sh
# Copyright 2023, Alejandro Colomar <[email protected]> # SPDX-License-Identifier: GPL-3.0-or-later

(

        "$(dirname "$0")"/prepare_linux_man_book.pl "$1" \
        | preconv \
        | pic \
        | tbl \
        | eqn -Tpdf \
        | troff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 -dpaper=a4 \
                -M"$(dirname "$0")" -mandoc -manmark -rC1 -rCHECKSTYLE=3 \
                2>&1 >/dev/null \
        | LC_ALL=C grep '^\. *ds ';

        "$(dirname "$0")"/prepare_linux_man_book.pl "$1";
) \
| preconv \
| pic \
| tbl \
| eqn -Tpdf \
| (
        troff -Tpdf -ms <"$(dirname "$0")"/LMBfront.ms;
        troff -Tpdf -M"$(dirname "$0")" -mandoc -manmark \
                -F"$(dirname "$0")" -dpaper=a4 ;
Quoted 4 lines

) \
| gropdf -F"$(dirname "$0")" -pa4;

You can see you have chosen to omit the -rC1 from the second run.

Hmmm, my bad. I didn't know that it was necessary to specify it in both runs.

Quoted 5 lines

Then when
you decided a need for speed, I rewrote again a single pass version which did not rely on Branden's .MR code at all. Now you want to use similar code as used for the groff_man_pages book (back to using calls to .MR and using pdfmom --roff to satisfy forward references).

Not really. What I want is to have the script be as simple as possible. The main problem is that I need to maintain it, but I have little knowledge of perl(1) (or of PDF or roff(7), BTW).

Quoted 4 lines
Quoted 2 lines

I removed the Tinos.pfa file, since now I generate it at build time from the Tinos.pfb file (installed with Debian's texlive-fonts-extra).

Completely unnecessary! Gropdf can use .pfb files.

Hmmm. Didn't know. Thanks!

Quoted 7 lines
Quoted 6 lines

Either the reorganization, or the generation of the font results in a new warning:

troff:<standard input>:1649: error: cannot load font 'TINOR' to mark it as special

Quoted 5 lines

Your _FONTSDIR must point to a directory which has a subdirectory called 'devpdf' which holds TINOR and UnifontM and a suitable 'download' file which gives the location of the actual .pf[ab] files (i.e. within texlive - no need to copy it). The difference, with/without, is in the number of glyphs not found messages.

I also need to understand what's that TINOR file, what type of file it is, and how I can get it. You gave me two files: the .pfa, and TINOR. So I can use a .pfb instead of the .pfa; but what about the TINOR file? How can I get it without maintaining a fork of it? Also, how can I get the Unifont files? I don't see any .pfa or .pfb in any unifont packages.

alx@debian:~$ apt-file show -x .*unifont.* | grep -i -e pfa -e pfb
alx@debian:~$ 
Quoted 4 lines

Cheers

Deri

Have a lovely night!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
#11 lore raw
Quoted 11 lines · Alejandro Colomar
Quoted 8 lines
Quoted 2 lines

troff:<standard input>:1649: error: cannot load font 'TINOR' to mark it as special

Your _FONTSDIR must point to a directory which has a subdirectory called 'devpdf' which holds TINOR and UnifontM and a suitable 'download' file which gives the location of the actual .pf[ab] files (i.e. within texlive - no need to copy it). The difference, with/without, is in the number of glyphs not found messages.

I also need to understand what's that TINOR file, what type of file it is, and how I can get it.

This, I can answer. It is a device-independent troff font description file. It is a plain text file in a format documented by Brian Kernighan originally in CSTR #97 in about 1982, then in the 1992 revision of CSTR #54, and of course also in the groff_font(5) man page.

The reason for the font description file is that traditionally digital fonts were (1) restrictively licensed and (2) programs that used fonts often didn't need the fonts themselves, but just descriptions of what glyphs they contained and the dimensions ("metrics") of each glyph. It is a rendering device that uses a digital font. A typesetter (or graphical display system[1]) needs only to know the metrics of the glyphs to that it can position them appropriately relative to each other.

This is why when PDF renderers substitute fonts, the result is often so terribly ugly. The glyphs of the substituted font are placed in positions appropriate to a font that may have different metrics. So they are crowded or spaced out weirdly, the kerning is off, and so on.

Regards,
Branden

[1] Historically in the X Window System there was a transition from "server-side" font rendering to "client-side". I suspect server-side rendering was implemented in the first place to work around the expense of digital font licensing. Someone like Jim Gettys would know for sure.

author maintainer
#12 lore raw

Hi Branden,

Quoted 27 lines · G. Branden Robinson
Quoted 11 lines · Alejandro Colomar
Quoted 8 lines
Quoted 2 lines

troff:<standard input>:1649: error: cannot load font 'TINOR' to mark it as special

Your _FONTSDIR must point to a directory which has a subdirectory called 'devpdf' which holds TINOR and UnifontM and a suitable 'download' file which gives the location of the actual .pf[ab] files (i.e. within texlive - no need to copy it). The difference, with/without, is in the number of glyphs not found messages.

I also need to understand what's that TINOR file, what type of file it is, and how I can get it.

This, I can answer. It is a device-independent troff font description file. It is a plain text file in a format documented by Brian Kernighan originally in CSTR #97 in about 1982, then in the 1992 revision of CSTR #54, and of course also in the groff_font(5) man page.

The reason for the font description file is that traditionally digital fonts were (1) restrictively licensed and (2) programs that used fonts often didn't need the fonts themselves, but just descriptions of what glyphs they contained and the dimensions ("metrics") of each glyph. It is a rendering device that uses a digital font. A typesetter (or graphical display system[1]) needs only to know the metrics of the glyphs to that it can position them appropriately relative to each other.

Quoted 4 lines

This is why when PDF renderers substitute fonts, the result is often so terribly ugly. The glyphs of the substituted font are placed in positions appropriate to a font that may have different metrics. So they are crowded or spaced out weirdly, the kerning is off, and so on.

Thanks. Althoguh this doesn't answer how I can get it in Debian. And now I also wonder if I really need this file. groff(1) is reporting warnings that it's not able to use it, and it all still works. Maybe I don't need it at all?

Have a lovely night!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#15 lore raw
In reply to a message not in the archive

[CC += linux-man]

Hi Branden,

Quoted 9 lines · G. Branden Robinson
Quoted 4 lines · Deri

On Tuesday, 16 April 2024 02:02:28 BST Alejandro Colomar wrote:
Also I rewrote prepare.pl to not use calls to .MR, to make it faster, which is why you notice no slow down in the run since Branden released code to pdf.tmac, which affected the speed of .MR.

I want to keep an eye on this. As soon as I observe/reproduce a major performance hit (with _any_ man page collection), I mean to do something about it.

I'll let you know how bad it is in the Linux man-pages, once I have something stable that I understand.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Also, how can I get
the Unifont files? I don't see any .pfa or .pfb in any unifont packages.

Do a bit of research on Peter Schaffter's "install-font.sh".

I forgot to mention afmtodit(1). The grops(1) and gropdf(1) man pages also contain step-by-step procedures

Some feedback from gropdf(1):

The following is a step‐by‐step font installation guide for gropdf.

• Convert your font to something groff understands. This

The first step is already assuming I already have a font. Too bad. I don't have one. Where's my font?

is a PostScript Type 1 font in PFA or PFB format, to‐ gether with an AFM file. A PFA file begins as follows.

If there any Debian package that provides either a PFA or PFB font for Unifont? I haven't found it. So I don't have a font. Does it mean that this procedure doesn't apply to my case?

%!PS-AdobeFont-1.0:
A PFB file contains this string as well, preceded by some non‐printing bytes. In the following steps, we will con‐ sider the use of CTAN’s BrushScriptX‐Italic font in PFA format.

Quoted 1 line

for supporting "external" fonts.

(sigh) I guess I need to clarify. I don't know what's an "external" font.

Quoted 3 lines

But Peter's script is vastly more convenient for pretty much everyone (except maybe distro package maintainers, who have not, as far as I know, tried to tackle the problem at all).

Why? What does it do better or worse? I find it more convenient to use something that I can apt-get(1) install, and that's not the case here.

Have a lovely night!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#16 lore raw
In reply to a message not in the archive

Hi Deri,

Quoted 3 lines · Deri

I don't understand what your doing with the font, why convert to .pfa, why move it - if you have the font just put texlive path into the download file in .tmp/font/devpdf with TINOSR.

Something is inconsistent here. The file is named TINOR, not TINOSR. Was that a typo? Should I rename it? I've moved it to .../devpdf and added the download file, and it still doesn't work.

<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=d8d06c9c66bf32fb88e860219bd66149e5813948>

Cheers,
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
#17 lore raw
Quoted 2 lines · On Tuesday, 16 April 2024 21:57:41 BST Alejandro Colomar wrote:

I've moved it to .../devpdf and
added the download file, and it still doesn't work.

Hi Alex,

What was not clear when I wrote:-

"Your _FONTSDIR must point to a directory which has a subdirectory called 'devpdf' which holds TINOR and UnifontM and a suitable 'download' file which gives the location of the actual .pf[ab] files (i.e. within texlive - no need to copy it). The difference, with/without, is in the number of glyphs not found messages."

But instead you changed _FONTSDIR to point to devpdf.

The difference in the pages between having working and non-working fonts is seen in the attached example pages (compare with your book). These in fact are using UnifontM. TINOR provides the cyrillic glyphs and greek of the iso_8859 pages if I remember.

You can still see some gaps (which should not happen using UnifontM) they appear to be caused by an issue in one of Branden's commits, see:-

https://savannah.gnu.org/bugs/?65601

Cheers

Deri

author maintainer
#18 lore raw

Hi Deri,

Quoted 7 lines · Deri
Quoted 2 lines · On Tuesday, 16 April 2024 21:57:41 BST Alejandro Colomar wrote:

I've moved it to .../devpdf and
added the download file, and it still doesn't work.

Hi Alex,

What was not clear when I wrote:-

Quoted 7 lines

"Your _FONTSDIR must point to a directory which has a subdirectory called 'devpdf' which holds TINOR and UnifontM and a suitable 'download' file which gives the location of the actual .pf[ab] files (i.e. within texlive - no need to copy it). The difference, with/without, is in the number of glyphs not found messages."

But instead you changed _FONTSDIR to point to devpdf.

Sorry, I misread. Fixed:
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib>

Now I get some new warnings. :)

Quoted 9 lines

The difference in the pages between having working and non-working fonts is seen in the attached example pages (compare with your book). These in fact are using UnifontM. TINOR provides the cyrillic glyphs and greek of the iso_8859 pages if I remember.

You can still see some gaps (which should not happen using UnifontM) they appear to be caused by an issue in one of Branden's commits, see:-

https://savannah.gnu.org/bugs/?65601

Thanks!

Have a lovely day!
Alex

Quoted 7 lines

Cheers

Deri

Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#19 lore raw
Quoted 16 lines · Alejandro Colomar

Hi Deri,

Quoted 13 lines · Deri
Quoted 2 lines · On Tuesday, 16 April 2024 21:57:41 BST Alejandro Colomar wrote:

I've moved it to .../devpdf and
added the download file, and it still doesn't work.

Hi Alex,

What was not clear when I wrote:-

"Your _FONTSDIR must point to a directory which has a subdirectory called 'devpdf' which holds TINOR and UnifontM and a suitable 'download' file which gives the location of the actual .pf[ab] files (i.e. within texlive - no need to copy it). The difference, with/without, is in the number of glyphs not found messages."

Quoted 6 lines
Quoted 1 line

But instead you changed _FONTSDIR to point to devpdf.

Sorry, I misread. Fixed:
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib>

Now I get some new warnings. :)

(I guess that I'll need to regenerate TINOR too.)

Quoted 28 lines
Quoted 10 lines

The difference in the pages between having working and non-working fonts is seen in the attached example pages (compare with your book). These in fact are using UnifontM. TINOR provides the cyrillic glyphs and greek of the iso_8859 pages if I remember.

You can still see some gaps (which should not happen using UnifontM) they appear to be caused by an issue in one of Branden's commits, see:-

https://savannah.gnu.org/bugs/?65601

Thanks!

Have a lovely day!
Alex

Quoted 7 lines

Cheers

Deri

Signature · 1 line
<https://www.alejandro-colomar.es/>
Signature · 1 line
<https://www.alejandro-colomar.es/>
#20 lore raw
Quoted 2 lines · On Wednesday, 17 April 2024 10:56:00 BST Alejandro Colomar wrote:
Quoted 1 line · Alejandro Colomar

Hi Deri,

Hi Alex,

[...]

Quoted 1 line
Quoted 1 line

Now I get some new warnings. :)

Is it a secret?

Quoted 1 line

(I guess that I'll need to regenerate TINOR too.)

Its not a good idea when you are guessing.

Cheers

Deri

author maintainer
#21 lore raw

Hi Deri,

Quoted 4 lines · Deri

[...]

Quoted 1 line
Quoted 1 line

Now I get some new warnings. :)

Is it a secret?

No, but they contain binary. Here's an example:

gropdf:zic.8: warning: Don't understand 'dup 0 11 -| �����B4fD�" |'

Cheers,
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
#22 lore raw
Quoted 6 lines · On Wednesday, 17 April 2024 11:33:58 BST Alejandro Colomar wrote:

No, but they contain binary. Here's an example:

gropdf:zic.8: warning: Don't understand 'dup 0 11 -| �����B4fD�" |'

Cheers,
Alex

Aah, this comes from the new font subsetting code in gropdf. I have not seen a font quite like this before, most fonts used with groff have been converted from a .ttf/.otf by running it through fontforge.If you are interested in the gory details look at the git log for the fix just committed to the groff git.

Cheers

Deri

author maintainer
#23 lore raw

Hi Deri,

Quoted 9 lines · Deri
Quoted 3 lines · On Wednesday, 17 April 2024 11:33:58 BST Alejandro Colomar wrote:

No, but they contain binary. Here's an example:

gropdf:zic.8: warning: Don't understand 'dup 0 11 -| �����B4fD�" |'

Aah, this comes from the new font subsetting code in gropdf. I have not seen a font quite like this before, most fonts used with groff have been converted from a .ttf/.otf by running it through fontforge.If you are interested in the gory details look at the git log for the fix just committed to the groff git.

Thanks! However, I can still see that warning. I've installed groff from git HEAD:

	$ git describe 
	1.23.0-1149-g5589bcd18
	$ git log -1 | head
	commit 5589bcd18776c6d236c53226a0ee30506180e6b6
	Author: Deri James <[email protected]>
	Date:   Wed Apr 17 19:25:03 2024 +0100

Improve font parsing.

The usual (for fontforge converted ttf fonts) is to use the RD, ND and NP operators within charstring definitions, however these are just named in the private subrs dictionary so could be assigned any name.

And here's the warning in the man-pages' contrib branch:

	$ make clean
	RM -rf		.tmp
	$ groff --version | head -n1
	GNU groff version 1.23.0.1149-5589
	$ make build-pdf-book -j24 >/dev/null 2>&1
	$ rm .tmp/man-pages-6.7-63-ga4f3afd28.pdf 
	$ make build-pdf-book
	GROPDF		.tmp/man-pages-6.7-63-ga4f3afd28.pdf
	troff:fanotify_init.2:322: warning [page 192, 4.2i]: cannot adjust line
	troff:membarrier.2:272: warning [page 475, 3.0i]: cannot adjust line
	statx.2:240: warning: table wider than line length minus indentation
	troff:syscall.2:171: warning: cannot select font 'CW'
	troff:syscall.2:301: warning: cannot select font 'CW'
	...
	gropdf:zic.8: warning: Don't understand 'dup 0 11 -| �����B4fD�" |'

Have a lovely night!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
#24 lore raw
Quoted 33 lines · On Wednesday, 17 April 2024 21:48:04 BST Alejandro Colomar wrote:

Hi Deri,

Quoted 10 lines · Deri
Quoted 3 lines · On Wednesday, 17 April 2024 11:33:58 BST Alejandro Colomar wrote:

No, but they contain binary. Here's an example:

gropdf:zic.8: warning: Don't understand 'dup 0 11 -| �����B4fD�" |'

Aah, this comes from the new font subsetting code in gropdf. I have not seen a font quite like this before, most fonts used with groff have been converted from a .ttf/.otf by running it through fontforge.If you are interested in the gory details look at the git log for the fix just committed to the groff git.

Thanks! However, I can still see that warning. I've installed groff from git HEAD:

	$ git describe
	1.23.0-1149-g5589bcd18
	$ git log -1 | head
	commit 5589bcd18776c6d236c53226a0ee30506180e6b6
	Author: Deri James <[email protected]>
	Date:   Wed Apr 17 19:25:03 2024 +0100

Improve font parsing.

The usual (for fontforge converted ttf fonts) is to use the RD, ND and NP operators within charstring definitions, however these are just named in the private subrs dictionary so could be assigned any name.

And here's the warning in the man-pages' contrib branch:

Quoted 9 lines
	$ make clean
	RM -rf		.tmp
	$ groff --version | head -n1
	GNU groff version 1.23.0.1149-5589
	$ make build-pdf-book -j24 >/dev/null 2>&1
	$ rm .tmp/man-pages-6.7-63-ga4f3afd28.pdf
	$ make build-pdf-book
	GROPDF		.tmp/man-pages-6.7-63-ga4f3afd28.pdf
	troff:fanotify_init.2:322: warning [page 192, 4.2i]: cannot adjust 

line

Quoted 10 lines

troff:membarrier.2:272: warning [page 475, 3.0i]: cannot adjust line statx.2:240: warning: table wider than line length minus indentation troff:syscall.2:171: warning: cannot select font 'CW' troff:syscall.2:301: warning: cannot select font 'CW'
...
gropdf:zic.8: warning: Don't understand 'dup 0 11 -| �����B4fD�" |'

Have a lovely night!
Alex

Hi Alex,

While testing I used a document just using the debian TinosR font, no problem. Issue occurs when both types of font are used in one document. I have now pushed the fix to groff. Please try again.

Cheers

Deri

author maintainer
#27 lore raw
In reply to a message not in the archive

Hi Deri,

Quoted 14 lines · Deri
share/mk/build/pdf/book/prepare.pl +1 -1
index e23f149c6..bc922bd88 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl -wd
 #
 #	BuildLinuxMan.pl		: Build Linux manpages book
 #	Deri James (& Brian Inglis)	: 15 Dec 2022
@@ -49,16 +49,16 @@ my $dir2=$dir;
 $dir2=~tr[.][_];
 my %files;
 my %aliases;

share/mk/build/pdf/book/prepare.pl my $dir2=$dir; · line 59

Quoted 10 lines
share/mk/build/pdf/book/prepare.pl +2 -2
-my %target;
+my %revalias;
 
 foreach my $al (`find "$dir"/man*/ -type f \\
 		| grep "\\.[[:digit:]]\\([[:alpha:]][[:alnum:]]*\\)\\?\\>\$" \\
 		| xargs grep '^\\.so' /dev/null;`)
 {
 	#$al=~tr[.][_];
-	$al=~m/^$dir\/man\d[a-z]*\/(.*):\.\s*so\s*man\d[a-z]*\/(.*)/o;
+	$al=~m/^$dir\/man\d[a-z]*\/(.*):\.\s*so\s*man\d[a-z]*\/(.*?)\.(.*)/o;

Your annotation said:

	-	$al=~m/^$dir\/man\d[a-z]*\/(.*):\.\s*so\s*man\d[a-z]*\/(.*)/o;
	+	$al=~m/^$dir\/man\d[a-z]*\/(.*):\.\s*so\s*man\d[a-z]*\/(.*?)\.(.*)/o;
	Example:-
	./man2/rt_sigaction.2:.so man2/sigaction.2
	==============
	========= =
	$1
	$2
	$3
	Capture the file name extension in $3.

But the regex is wrong, I think. Consider this part of the regex:

	(.*?)\.(.*)

For a page like gai.conf.5, the section would be 'conf.5'. The '?' is spurious, I think.

Quoted 48 lines
share/mk/build/pdf/book/prepare.pl +11 -4
-	$aliases{$1}=$2;
+	$aliases{$1}="$2($3)";
 }
 
 while (my ($k,$v)=each %aliases)
@@ -68,13 +68,18 @@ while (my ($k,$v)=each %aliases)
 	}
 }
 
+while (my ($k,$v)=each %aliases)
+{
+	push(@{$revalias{$v}},$k);
+}
+
 foreach my $fn (`find "$dir"/man*/ -type f \\
 		| grep "\\.[[:digit:]]\\([[:alpha:]][[:alnum:]]*\\)\\?\\>\$";`)
 {
 	$fn=~s/\n//;
 
 	my ($nm,$sec)=GetNmSec($fn,qr/\.\d[a-z]*/);
-	$files{"${nm}.$sec"}=[$fn,(exists($aliases{"${nm}.$sec"}))?$aliases{"${nm}.$sec"}:"${nm}.$sec"];
+	$files{"${nm}.$sec"}=[$fn,(exists($aliases{"${nm}.$sec"}))?$aliases{"${nm}.$sec"}:"${nm}($sec)"];
 }
 
 my $Section='';
@@ -97,7 +102,7 @@ sub BuildPage
 	my $fn=$files{$bkmark}->[0];
 	my ($nm,$sec,$srt)=GetNmSec($bkmark,qr/\.[\da-z]+/);
 
-	my $title= "$nm\\($sec\\)";
+	my $title= "$nm($sec)";
 
 	print ".\\\" >>>>>> $nm($sec) <<<<<<\n.lf 0 $bkmark\n";
 
@@ -112,8 +117,10 @@ sub BuildPage
 		$Section=$sec;
 	}
 
-	if (exists($aliases{$bkmark})) {
+	if (exists($aliases{$bkmark}))
+	{
 		print ".eo\n.device ps:exec [/Dest /$aliases{$bkmark} /Title ($title) /Level 2 /OUT pdfmark\n.ec\n.fl\n";
+# 		print ".pdfbookmark 2 $nm($sec)";
 		return;
 	}
 

share/mk/build/pdf/book/prepare.pl sub BuildPage · line 147

Quoted 5 lines
share/mk/build/pdf/book/prepare.pl +1 -1
@@ -137,7 +144,7 @@ sub BuildPage
 
 			s/\\-/-/g if /^\.[BM]R\s+/;
 
-			if (m/^\.BR\s+([-\w\\.]+)\s+\((.+?)\)(.*)/ or m/^\.MR\s+([-\w\\.]+)\s+(\w+)\s+(.*)/ or m/^\\fB([-\w\\.]+)\\fR\((.+?)\)(.*)$/) {
+			if (m/^\.BR\s+([-\w\\.]+)\s+\(([\d\w]+?)\)(.*)/ or m/^\.MR\s+([-\w\\.]+)\s+(\w+)\s+(.*)/ or m/^\\fB([-\w\\.]+)\\fR\((.+?)\)(.*)$/) {

This regex might have similar issues (although they aren't being introduced now). And there might be others too.

BTW, your annotation was:

Not completely sure if this change is necessary, just nervous about (.+?) as a pattern.

Agree; but there are more (.+?) in the same regex.

Have a lovely night!
Alex

Quoted 62 lines
share/mk/build/pdf/book/prepare.pl +17 -21
 				my $bkmark="$1";
 				my $sec=$2;
 				my $after=$3;
@@ -145,12 +152,7 @@ sub BuildPage
 				my $dest=$bkmark;
 				$dest=~s/\\-/-/g;
 
-				if (exists($files{"${bkmark}.$sec"})) {
-					my $dest=$files{"${bkmark}.$sec"}->[1];
-					$_=".pdfhref L -D \"$dest\" -A \"$after\" -- \\fI$bkmark\\fP($sec)";
-				} else {
-					$_=".IR $bkmark ($sec)\\c\n$after";
-				}
+				$_=".MR \"$bkmark\" $sec $after";
 			}
 
 			s/^\.BI \\fB/.BI /;
@@ -175,16 +177,20 @@ sub BuildPage
 				s/\n\n/\n/g;
 			}
 
-			s/\\&\././ if m/^.TH /;
-
-			if (m/^\.TH\s+"?([-\w\\.]+)"?\s+"?(\w+)"?/) {
-
-				print "$_\n";
-
-				# Add a level two bookmark. We don't set it in the TH macro since the name passed
-				# may be different from the filename, i.e. file = unimplemented.2, TH = UNIMPLEMENTED 2
-
-				print ".pdfbookmark -T $bkmark 2 $nm($sec)\n";
+# 			s/\\&\././ if m/^.TH /;
+#
+ 			if (m/^\.TH\s+"?([-\w\\.]+)"?\s+"?(\w+)"?(.*)/)
+ 			{
+				print ".TH \"$nm\" \"$2\" $3\n";
+
+				if (exists($revalias{"$nm($sec)"}))
+				{
+					foreach my $dest (@{$revalias{"$nm($sec)"}})
+					{
+						my ($nm,$sec,$srt)=GetNmSec($dest,qr/\.[\da-z]+/);
+						print ".pdfhref M -D $nm($sec)\n";
+					}
+				}
 
 				next;
 			}
@@ -199,11 +205,8 @@ sub doMR
 	my $nm=shift;
 	my $sec=shift;
 
-	if (exists($files{"${nm}.$sec"})) {
-		return("\n.pdfhref L -D \"$files{\"${nm}.$sec\"}->[1]\" -A \"\\c\" -- \\fI$nm\\fP($sec)\n");
-	} else {
-		return("\\fI$nm\\fP($sec)");
-	}
+	return "\n.MR $nm $sec";
+
 }
 
 sub GetNmSec
Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#28 lore raw
In reply to a message not in the archive

Hi Branden,

After applying Deri's patches, I can see the turtle.

real 2m20.018s
user 2m34.825s
sys 0m0.571s

Before that patch, it's

real 0m14.576s
user 0m18.171s
sys 0m0.464s

That means groff(1) is being ~9x slower.

Have a lovely night!
Alex

Quoted 182 lines · Deri
tmac/an.tmac +3 -2
index d9e8232f8..46934fd62 100644
@@ -212,7 +212,7 @@
 .
 .\" Customize this at the command line to, for example, group multiple
 .\" man pages within a collection or containing document.
-.nr an*bookmark-base-level 0
+.nr an*bookmark-base-level \n[an*bookmark-base-level]+0
 .
 .\" Write a bookmark/anchor/link target $2 at hierarchical depth $1.
 .de an*bookmark
@@ -230,7 +230,8 @@
 .ds an*bookmark*utf8 \" empty
 .
 .de an*bookmark*pdf
-.  ie (\\$1 = 1) \
+.nr an:lev \\n[an*bookmark-base-level]+1
+.  ie (\\$1 = \\n[an:lev]) \
 .    pdfbookmark -T "\\$2" \\$1 \\$2
 .  el \
 .    pdfbookmark \\$1 \\$2
share/mk/build/pdf/book/_.mk +2 -2
index 3395e67e9..9f1cdc520 100644
@@ -33,12 +33,12 @@ _PDF_BOOK := $(_PDFDIR)/$(PDF_BOOK)
 $(_PDF_BOOK): $(_MANPAGES) $(_TINOS) $(MKBOOK) $(MK) | $$(@D)/
 	$(info	$(INFO_)GROPDF		$@)
 	$(MKBOOKDIR)/prepare.pl $(_MANDIR) \
-	| $(CAT) $(MKBOOKDIR)/front.roff $(MKBOOKDIR)/an.tmac /dev/stdin \
+	| $(CAT) $(MKBOOKDIR)/front.roff /dev/stdin \
 	| $(PRECONV) \
 	| $(PIC) \
 	| $(TBL) \
 	| $(EQN) -Tpdf \
-	| $(TROFF) -Tpdf -F$(_FONTSDIR) -dpaper=a4 $(TROFFFLAGS) \
+	| pdfmom --roff -F$(_FONTSDIR) -man -r an*bookmark-base-level=1 -dpaper=a4 $(TROFFFLAGS) -Z \
 	| $(GROPDF) -F$(_FONTSDIR) -pa4 $(GROPDFFLAGS) \
 	| $(SPONGE) $@
 
share/mk/build/pdf/book/prepare.pl +32 -29
index e23f149c6..bc922bd88 100755
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl -wd
 #
 #	BuildLinuxMan.pl		: Build Linux manpages book
 #	Deri James (& Brian Inglis)	: 15 Dec 2022
@@ -49,16 +49,16 @@ my $dir2=$dir;
 $dir2=~tr[.][_];
 my %files;
 my %aliases;
-my %target;
+my %revalias;
 
 foreach my $al (`find "$dir"/man*/ -type f \\
 		| grep "\\.[[:digit:]]\\([[:alpha:]][[:alnum:]]*\\)\\?\\>\$" \\
 		| xargs grep '^\\.so' /dev/null;`)
 {
 	#$al=~tr[.][_];
-	$al=~m/^$dir\/man\d[a-z]*\/(.*):\.\s*so\s*man\d[a-z]*\/(.*)/o;
+	$al=~m/^$dir\/man\d[a-z]*\/(.*):\.\s*so\s*man\d[a-z]*\/(.*?)\.(.*)/o;
 
-	$aliases{$1}=$2;
+	$aliases{$1}="$2($3)";
 }
 
 while (my ($k,$v)=each %aliases)
@@ -68,13 +68,18 @@ while (my ($k,$v)=each %aliases)
 	}
 }
 
+while (my ($k,$v)=each %aliases)
+{
+	push(@{$revalias{$v}},$k);
+}
+
 foreach my $fn (`find "$dir"/man*/ -type f \\
 		| grep "\\.[[:digit:]]\\([[:alpha:]][[:alnum:]]*\\)\\?\\>\$";`)
 {
 	$fn=~s/\n//;
 
 	my ($nm,$sec)=GetNmSec($fn,qr/\.\d[a-z]*/);
-	$files{"${nm}.$sec"}=[$fn,(exists($aliases{"${nm}.$sec"}))?$aliases{"${nm}.$sec"}:"${nm}.$sec"];
+	$files{"${nm}.$sec"}=[$fn,(exists($aliases{"${nm}.$sec"}))?$aliases{"${nm}.$sec"}:"${nm}($sec)"];
 }
 
 my $Section='';
@@ -97,7 +102,7 @@ sub BuildPage
 	my $fn=$files{$bkmark}->[0];
 	my ($nm,$sec,$srt)=GetNmSec($bkmark,qr/\.[\da-z]+/);
 
-	my $title= "$nm\\($sec\\)";
+	my $title= "$nm($sec)";
 
 	print ".\\\" >>>>>> $nm($sec) <<<<<<\n.lf 0 $bkmark\n";
 
@@ -112,8 +117,10 @@ sub BuildPage
 		$Section=$sec;
 	}
 
-	if (exists($aliases{$bkmark})) {
+	if (exists($aliases{$bkmark}))
+	{
 		print ".eo\n.device ps:exec [/Dest /$aliases{$bkmark} /Title ($title) /Level 2 /OUT pdfmark\n.ec\n.fl\n";
+# 		print ".pdfbookmark 2 $nm($sec)";
 		return;
 	}
 
@@ -137,7 +144,7 @@ sub BuildPage
 
 			s/\\-/-/g if /^\.[BM]R\s+/;
 
-			if (m/^\.BR\s+([-\w\\.]+)\s+\((.+?)\)(.*)/ or m/^\.MR\s+([-\w\\.]+)\s+(\w+)\s+(.*)/ or m/^\\fB([-\w\\.]+)\\fR\((.+?)\)(.*)$/) {
+			if (m/^\.BR\s+([-\w\\.]+)\s+\(([\d\w]+?)\)(.*)/ or m/^\.MR\s+([-\w\\.]+)\s+(\w+)\s+(.*)/ or m/^\\fB([-\w\\.]+)\\fR\((.+?)\)(.*)$/) {
 				my $bkmark="$1";
 				my $sec=$2;
 				my $after=$3;
@@ -145,12 +152,7 @@ sub BuildPage
 				my $dest=$bkmark;
 				$dest=~s/\\-/-/g;
 
-				if (exists($files{"${bkmark}.$sec"})) {
-					my $dest=$files{"${bkmark}.$sec"}->[1];
-					$_=".pdfhref L -D \"$dest\" -A \"$after\" -- \\fI$bkmark\\fP($sec)";
-				} else {
-					$_=".IR $bkmark ($sec)\\c\n$after";
-				}
+				$_=".MR \"$bkmark\" $sec $after";
 			}
 
 			s/^\.BI \\fB/.BI /;
@@ -175,16 +177,20 @@ sub BuildPage
 				s/\n\n/\n/g;
 			}
 
-			s/\\&\././ if m/^.TH /;
-
-			if (m/^\.TH\s+"?([-\w\\.]+)"?\s+"?(\w+)"?/) {
-
-				print "$_\n";
-
-				# Add a level two bookmark. We don't set it in the TH macro since the name passed
-				# may be different from the filename, i.e. file = unimplemented.2, TH = UNIMPLEMENTED 2
-
-				print ".pdfbookmark -T $bkmark 2 $nm($sec)\n";
+# 			s/\\&\././ if m/^.TH /;
+#
+ 			if (m/^\.TH\s+"?([-\w\\.]+)"?\s+"?(\w+)"?(.*)/)
+ 			{
+				print ".TH \"$nm\" \"$2\" $3\n";
+
+				if (exists($revalias{"$nm($sec)"}))
+				{
+					foreach my $dest (@{$revalias{"$nm($sec)"}})
+					{
+						my ($nm,$sec,$srt)=GetNmSec($dest,qr/\.[\da-z]+/);
+						print ".pdfhref M -D $nm($sec)\n";
+					}
+				}
 
 				next;
 			}
@@ -199,11 +205,8 @@ sub doMR
 	my $nm=shift;
 	my $sec=shift;
 
-	if (exists($files{"${nm}.$sec"})) {
-		return("\n.pdfhref L -D \"$files{\"${nm}.$sec\"}->[1]\" -A \"\\c\" -- \\fI$nm\\fP($sec)\n");
-	} else {
-		return("\\fI$nm\\fP($sec)");
-	}
+	return "\n.MR $nm $sec";
+
 }
 
 sub GetNmSec
Signature · 1 line
<https://www.alejandro-colomar.es/>
author maintainer
#25 lore raw
In reply to Deri
Quoted 1 line · Deri

Hi Alex,

Hi Deri,

Quoted 3 lines

While testing I used a document just using the debian TinosR font, no problem. Issue occurs when both types of font are used in one document. I have now pushed the fix to groff. Please try again.

Thanks! It works now. How can I use Debian's TinosR font? Where is it?

Have a lovely night!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
#26 lore raw
Quoted 5 lines · On Thursday, 18 April 2024 02:09:59 BST Alejandro Colomar wrote:
Quoted 1 line · Deri

Hi Alex,

Hi Deri,

Quoted 8 lines
Quoted 3 lines

While testing I used a document just using the debian TinosR font, no problem. Issue occurs when both types of font are used in one document. I have now pushed the fix to groff. Please try again.

Thanks! It works now. How can I use Debian's TinosR font? Where is it?

Have a lovely night!
Alex

Hi Alex,

I was referring to the debian package texlive-extra-fonts (or something similar) which contains the Tinos fonts in .pfb format. Google's font download site only offers the font as a .ttf which I installed using the install- fonts.sh script you have been told about, which uses fontforge and afmtodit to create the Tinos.pfb and TINOR files, and installs them in a suitable place for groff to use.

Cheers

Deri