Hot answers tagged

13

Yes, troff is Turing-complete. It supports arbitrary recursion and conditional branching, which is sufficient. It also has registers and various other ways to store data, which gives you another path in again. Turing completeness doesn't imply that highly complex programs are practical - just that they're theoretically possible, somehow, at some level of ...


12

ESR's The Art of Unix Programming claims it is: We'll examine troff in more detail in Chapter 18; for now, it's sufficient to note that it is a good example of an imperative minilanguage that borders on being a full-fledged interpreter (it has conditionals and recursion but not loops; it is accidentally Turing-complete). ("Accidentally" as ...


9

Man pages historically have been written in the troff/nroff markup language, although there are alternatives now such as DocBook. Troff, which is meant for preparing output to a phototypesetter (or to files in formats such as PostScript or PDF), will automatically change the ` and ' characters in the input into curved quotation marks, ‘ and ’. (See the ...


9

Many GNU projects, including GCC, license their documentation under the GNU Free Documentation License. There is a long-standing dispute between the Free Software Foundation and the Debian project, which considers the GFDL to be non-free, mostly because it can forbid some sections of the documentation from being modified. For this reason, the GCC ...


8

Start the list with .RS, end with .RE. Start list items with .IP followed by term. Enclose the term in double quotes if contains multiple words. Put the description text in the next line after the list item start. Is nestable, so the description may contain further lists. Use \fB..\fP for bolding the term instead of .B. (Same for underline – use \fI..\fP ...


7

The "first form" is a... feature of groff. If your "nroff" is not a wrapper for groff, you will see only the second form. The feature is referred to in the manual page for grotty (groff driver for typewriter-like devices): By default, grotty emits SGR escape sequences (from ISO 6429, also called ANSI color escapes) to change text attributes (bold,...


7

You should add the non-free and contrib repositories to your sources list and run apt-get update afterwards. Now you can install the gcc-doc package which contains the man-pages with: apt-get install gcc-doc The problem is that the gcc documentation is released under the GNU Free Documentation License which is considered non-free by Debian.


6

These quotation marks are often used because they look nice, similar to the quotation marks in printed books (which are different at the beginning and end of the quoted passage). These quotation marks may also have been added by your local troff configuration (or, could be removed by it!). The actual file may not contain these characters literally. You ...


5

You might peek at how the fish shell builds its completions from the man pages in particular how __fish_complete_man works. An easier option assuming groff might be to emit HTML and then use one of the multitude of HTML parsers out there to get what you want: $ groff -T html -mdoc xpquery.1 | xpquery -p HTML '//p[b="xpquery"][2]' - <p style="margin-left:...


4

The .RE restores the default indentation level, not the current .TP indentation level. All you need to do is save and restore the actual indent in play when .RS is called. The fix below assumes you will not nest SAMPLEs inside SAMPLEs: .de SAMPLE .br .nr saveIN \\n(.i \" double the backslash when defining a macro .RS .nf .nh .. .de ESAMPLE .hy .fi .RE ....


4

You need to tell groff which macros you want to use. In this case, you want groff -ge -me -mwww grnexmpl.me > out.ps If you want to see the picture of the circuit diagram, you'll also need grnexample.g present in the directory. I found this by running grog to guess the macros, and then added the www macro, since I could see there was HTML in the source ...


3

There are a number of 2-character macros that let you format their arguments in two different fonts, alternating between them. In your case, you'd use the .IR macro. R means Roman, the default font. The default is .IR /etc/audit/audit.key .


3

Most Linuxes nowadays come with the GNU version of Troff. On my Linux Mint system the groff-base package was already installed, but to generate PDF, via the gropdf output utility, requires you to install the groff package as well. On Solaris, you might need to install this from source, but the manual is rather sparse on this subject. The sources can be ...


3

The problem is with misunderstanding what the character codes actually do. If you look at the Ossanna and Kernighan's Troff user's manual, you'll see - \| 1/6 em narrow space character (zero width in nroff) So it is not actually alternating the fonts by itself, it only introduces thin spaces. The font alternation is happening because of spaces in the ...


3

Groff supports a CW (constant width) font, and you can select it with .ft CW or \f(CW. To turn off filling, use a display, .DS - .DE, or a .nf - .fi pair. .TL Two boxes, two ways .LP ASCII drawing .DS C .ft CW +-------------------------+ +-----------------+ | | | | | Hello ...


2

Man pages are roff formatted text files, which unfortunately is one of the most irritating to parse formatting languages around right now. You may have some luck pulling out what you want by looking through the documentation for whatever roff implementation your system uses (it will almost always be one of nroff, troff, or groff). The format itself is ...


2

The date is set in the source code for the man page -bash-4.2$ man -w man /usr/share/man/man1/man.1.gz -bash-4.2$ zcat $(man -w man) | fgrep 2012 .TH MAN 1 "2012-09-17" "2.6.3" "Manual pager utils" -bash-4.2$ Not portably, as OpenBSD for example instead places the date in .Dd $ man -w man /usr/share/man/man1/man.1 /usr/share/man/man7/man.7 $ grep 2017 $(...


2

The following convoluted way works: groff -Kutf8 -Tdvi -mec -ms test.ms > test.dvi dvipdfm -cz 9 test.dvi open test.pdf Via the [Groff] latin2 polish special characters thread on lists.gnu.org.


2

The backticks in the bash man page are explicitly given in the troff source, not the result of some macro, so are hard to change. However, the special single backticks are quoted \`, so you could apply your sed to the source troff instead using this difference. Instead you can add a troff command to translate the backtick into some other character. The ...


2

It might not be a pleasant option, but you can use w3m as the browser for man's HTML output: BROWSER=w3m man -H bash It renders ``…'' using Unicode quotes (as does Google Chrome, but for some reason, lynx doesn't). FreeBSD's manpage repository tells me CentOS 7's man does support -H.


2

How to update the man page in man page mode while editing the roff source: ;;;; MAN / man (defvar *curr-man* "~/mansv/ls.1") (defun edman () "edit the current work-in-progress man page" (interactive) (find-file *curr-man*) ) (defun upman () ; edit: better version of this function below "update the current work-in-progress man page" (interactive) ...


1

It is very slow because there is very few people involved and none of us is getting any younger. I'm probably one of the youngest official contributors to the project and I have not participated actively in maybe 12 years. Rather than ask, it would be great if you do the legal paperwork with the FSF to become a contributor and roll up your sleeves. We'll ...


1

You can use the alternative method of setting italics/underline mode: \fI. Then \fP to return to previous font: So you would have \fI/etc/audit/audit.key\fP.


Only top voted, non community-wiki answers of a minimum length are eligible