gropdf : missing colour when used with HDTBL macros
File examples in https://list.gnu.org/archive/html/groff/2023-12/msg00013.html with subject "Groff hdtbl tables disappear near the footer". /usr/bin/groff -Tpdf -ms -mhdtbl hdtbl-issue.ms > hdtbl-issue.pdf Output does not have a "coloured" header "Professional Experience" (but black on white background) as the PostScript output file. -.-. /usr/bin/groff -Tpdf --version: GNU groff version 1.23.0 Copyright (C) 2022 Free Software Foundation, Inc. [...] called subprograms: GNU troff (groff) version 1.23.0 GNU gropdf (groff) version 1.23.0
Re: gropdf : missing colour when used with HDTBL macros
On Thursday, 14 December 2023 22:35:26 GMT Bjarni Ingi Gislason wrote: > File examples in > > https://list.gnu.org/archive/html/groff/2023-12/msg00013.html > > with subject "Groff hdtbl tables disappear near the footer". > > /usr/bin/groff -Tpdf -ms -mhdtbl hdtbl-issue.ms > hdtbl-issue.pdf > > Output does not have a "coloured" header "Professional > Experience" (but black on white background) as the PostScript > output file. > > -.-. > > /usr/bin/groff -Tpdf --version: > > GNU groff version 1.23.0 > Copyright (C) 2022 Free Software Foundation, Inc. > [...] > called subprograms: > > GNU troff (groff) version 1.23.0 > GNU gropdf (groff) version 1.23.0 Hi Bjarni, If you look in hdtbl-issue-macros.ms you will see:- .ds ACCENT "\X'ps: exec .1 .3 .6 setrgbcolor' .ds GREY "\X'ps: exec .7 .7 .7 setrgbcolor' .ds DGREY "\X'ps: exec .3 .3 .3 setrgbcolor' .ds RED "\X'ps: exec 1 0 0 setrgbcolor' .ds BLUE "\X'ps: exec 0 0 1 setrgbcolor' .ds BLACK "\X'ps: exec 0 0 0 setrgbcolor' .ds WHITE "\X'ps: exec 1 1 1 setrgbcolor' .defcolor textcolor rgb #353535 .defcolor linecolor rgb #a1a1a1 The first 7 lines are defined as postscript commands which are not parsed by gropdf. Its man page documents the particular \X'ps: ..." which are understood. The last two colours use normal groff colour definitions. I'm not too sure why most of the colours are done as postscript commands, but this sort of postscript used to be the only way to get colours from groff, before Werner added the colour commands, so it may be old code. Cheers Deri
Re: Is there a Groff showcase?
> Almost all my exams (being a science teacher) are created using Groff. That sounds really interesting. If it isn't confidential, I'd love to see a copy of your exam paper to see how it was made and how you create two versions in the same document. Kind regards, Mike
Re: Is there a Groff showcase?
On Fri, Dec 15, 2023 at 01:28:56AM +, Mike wrote: > > Almost all my exams (being a science teacher) are created using > Groff. > > That sounds really interesting. If it isn't confidential, I'd love to > see a copy of your exam paper to see how it was made and how you create > two versions in the same document. I can give you the source to the commercial license for a product we did. I actually got the lawyers at Fenwick & West to work on this in the troff source. Once they got what I was doing they were ecstatic, they clearly saw the value in one document generating multiple documents. Their comment was "Word wishes it could do this". Here's the intro at the top of the -ms doc: .ig ** README FIRST ** Notes for people unfamiliar with this file format: Line breaks are very important, if you work on this work on it with an editor that does hard line breaks, don't use soft (automatic) line breaks. Comments may be entered with a leading .\" or in a block delimited with a starting ".ig" (for ignore) and an ending ".." on a line by itself. Markup requests are present in the document, they are the funky looking things which start a line with a period like ".HH". Since the section numbers are automatically generate with the .HH macro we manually inserted .\" [1] above each .HH so you could see which section you are in, i.e., [1] above the first one, [2] above the next, and so on. Makes it slightly easier to go from the formatted text to the source. This document is actually several documents. It conditionally produces output based on the EULA variable which is currently set to one of 0 (Academic), 1 (Basic), 2 (Pro), or 3 (Enterprise). We'll likely shift that up when we fold the Free license into this one. You can do conditional exclusion or inclusion of the text based on the EULA variable like so (indented for clarity, it may not be indented in real use): .if \n[EULA]=1 \{\ I am the basic license agreement .\} .if \n[EULA]<=1 \{\ I am either the basic or the academic license agreement .\} .if \n[EULA]>1 \{\ I am either the pro or the enterprise license .\} You can do a conditional on two different EULAs like so: .if ((\n[EULA]=2) : (\n[EULA]=4)) \{\ I am either EULA2 or EULA4 .\} You negate an expression with "!" .if !\n[EULA]=4 \{\ All eulas except 4. .\} You can do if/else in this oh-so-obvious way: .ie \n[EULA]=4 text for EULA4 .el text for all other cases And finally, the \{ stuff is not needed if you are doing a short line. .if \n[EULA]=4 Use this text for EULA4. Given that we have two classes of licenses being generated here, EULA and MLA, we are evolving a bit. EULA 0..3 are EULAs, 4 is Intel, 5 is Cisco. But for each EULA we define a string, EULA, and for each MLA we define a string, MLA. We don't use the contents of the string, just the fact that it exists. We also define INTEL for Intel and CISCO for Cisco. This lets me do MLA specific stuff that is not Intel or Cisco specific like so .if dMLA and we can do INTEL specific stuff like so .if dINTEL Etc. Notes to reviewers/lawyers/whatever are typically done with "XXX" markups in comments, search for those for hints on places which need work. Thank you for putting up with this weird format, it helps us. .. .if !rEULA .ab No EULA defined .if \n[EULA]=0 \{\ . ds type Academic End User . ds TYPE ACADEMIC END USER . ds EULA Academic .\} .if \n[EULA]=1 \{\ . ds type Essentials End User .ds TYPE ESSENTIALS END USER . ds EULA Essentials .\} .if \n[EULA]=2 \{\ . ds type Premier End User . ds TYPE PREMIER END USER . ds EULA Premier .\} .if \n[EULA]=3 \{\ . ds type Enterprise End User . ds TYPE ENTERPRISE END USER . ds EULA Enterprise .\} .if \n[EULA]=4 \{\ . ds type / Intel Master . ds TYPE / INTEL MASTER . ds MLA Intel . ds INTEL true .\} .if \n[EULA]=5 \{\ . ds type / Cisco Master . ds TYPE / CISCO MASTER . ds MLA Cisco . ds CISCO true .\}
Re: Is there a Groff showcase?
On 15/12/23 12:44, Larry McVoy wrote: Here's the intro at the top of the -ms doc: It may be worth noting that you do not need to use the ms macro package or any macro package at all (apart from the built-in macros, of course). I usually create a defined string (.ds) or number register (.nr) somewhere very close to the top of the input file. Then, before the substantive document starts you use Larry's idea to list the various parameters. .ds Answers marker ... .ie '\^[Answers]'marker' \{\ . etc etc etc . \} . el \{\ .etc etc etc .\} [you can nest conditionals till the cows come home and you don't need double backslashes] Also defined strings (.ds) is very powerful and worth reading the man/info pahes. ... .\" Start of substantive document. ... [provide your alternatives based on the value of "\*[Answers]"] you may have to use ".nop" if you need indenting to save your sanity. you can use loops as well. My 2 cents to an interesting discussion. Robert Thorsby
Re: Is there a Groff showcase?
Typo \^[Answers] should be \*[Answers] There may be more. Rotten debilitating medical condition is to blame. Robt On 15/12/23 13:33, Robert Thorsby wrote: .ds Answers marker ... .ie '\^[Answers]'marker' \{\ . etc etc etc
Re: Is there a Groff showcase?
Agreed, I plugged -ms because after trying other stuff, I came back to -ms. Haven't tried mom, I'm retired, but I hear good things. But your point that this is pure troff is spot on. No macro package required. On Fri, Dec 15, 2023 at 01:33:42PM +1100, Robert Thorsby wrote: > On 15/12/23 12:44, Larry McVoy wrote: > >Here's the intro at the top of the -ms doc: > > > > It may be worth noting that you do not need to use the ms macro package or > any macro package at all (apart from the built-in macros, of course). > > I usually create a defined string (.ds) or number register (.nr) somewhere > very close to the top of the input file. Then, before the substantive > document starts you use Larry's idea to list the various parameters. > > .ds Answers marker > ... > .ie '\^[Answers]'marker' \{\ > . etc etc etc > . \} > . el \{\ > .etc etc etc > .\} > [you can nest conditionals till the cows come home and you don't need double > backslashes] > Also defined strings (.ds) is very powerful and worth reading the man/info > pahes. > ... > .\" Start of substantive document. > ... > [provide your alternatives based on the value of "\*[Answers]"] > you may have to use ".nop" if you need indenting to save your sanity. > you can use loops as well. > > My 2 cents to an interesting discussion. > > Robert Thorsby -- --- Larry McVoy Retired to fishing http://www.mcvoy.com/lm/boat
Re: Is there a Groff showcase?
On Thu, 14 Dec 2023, Larry McVoy wrote: Agreed, I plugged -ms because after trying other stuff, I came back to -ms. Haven't tried mom, I'm retired, but I hear good things. But your point that this is pure troff is spot on. No macro package required. There are times when I prefer to use other tools like simple Python to do some of the harder work such as creating alternate/multiple documents from some master depending on the scenario. A lot of the documentation for Documenters Workbench 3.3, the most recent version of groff and friends from Plan 9, is available. The documentation is written in itself. - Damian
Re: Is there a Groff showcase?
On 15/12/23 14:14, Damian McGuckin wrote: There are times when I prefer to use other tools like simple Python to do some of the harder work such as creating alternate/multiple documents from some master depending on the scenario. A lot of the documentation for Documenters Workbench 3.3, the most recent version of groff and friends from Plan 9, is available. The documentation is written in itself. Of course, you are correct. What a lot of newcomers don't realize (and everyone else sometimes forgets) is that a [gt]roff input file is a simple text file. If the input file is written in a civilized fashion it can be torn apart by whatever text parsing tool you care to use. Sorry Damian, I couldn't resist the epilogue. Robert A computing laddie from Dundee Once wrote a program in P... . But it ran quicker in ed, And much better in sed, So he rewrote the damned thing in C.