Fedora Linux Support Community & Resources Center
  #1  
Old 21st March 2012, 12:29 AM
sea Online
"Shells" (of a sub world)
 
Join Date: May 2011
Location: Confoederatio Helvetica (Swissh)
Age: 34
Posts: 3,598
linuxfirefox
Manpage, is it really that simple?

Heyas

After reading a few page about creating man pages, i tried to callup the plain text file with man.
It worked, actual looked even better then after modifications with nroff or groff.

Pages i've read:
http://www.linuxhowtos.org/System/creatingman.htm
http://www.fnal.gov/docs/products/up.../manpages.html
http://anaturb.net/create_man_p.htm

A first try looks like: /tmp/tstman
Code:
.TH rmtf 1 "2012 March 21" "Version 0.5.0" "sea Script Collection"
.SH NAME
rmtf

.SH SYNOPSIS
rmtf [PATH]

.SH DESCRIPTION
ReMove Temp Files recursivly, either from current directory, or in the PATH provided.

.SH AUTHOR
Name:   Simon A. Erat
.br
Email:  erat.simon@gmail.com
And shows up properly when called with:
Code:
man /tmp/tstman
I understand the step after, gzip'ing but i 'sort' that part to be old school,where one needed those extra bits saved on the 720kb floppy


This confused me, as i wonder why would one actualy need to pipe or parse them through nroff or groff?
Is this step really required?
__________________
Laptop: Toshiba satellite p50-a-11 CPU: Intel i7 8*2400 MHz GPU: GeForce GT 745M RAM: 8192 MB Distro: Fedora (Rawhide) DE: Awesome
Guide: Windows 8+ & Fedora 20+ Dualboot
Repo (sea-devel) :: Text User Interface (TUI), Video Handler Script (VHS), efi-helper, grub2-circled-nasa-themes, Essentials (blame, p, rmtf, rnd, siggen, screenshot...), (BETA) Dev-Scripts, (BETA) Fedora Account Scripts (FAS)

Last edited by sea; 21st March 2012 at 01:36 AM.
Reply With Quote
  #2  
Old 21st March 2012, 02:38 AM
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 5,708
linuxfedorafirefox
Re: Manpage, is it really that simple?

Piping to groff is only necessary if you want some other format for the manpage, typically PostScript which can be converted to PDF. For example, this will give you a PDF version of the grep manpage:
Code:
man -t grep | ps2pdf - grep.pdf
Some developers make PDF versions of their manpages because they're lazy and don't want to write a full user manual , plus it's an easy way of writing documentation that can be downloaded and viewed by anyone without needing to be on a Linux/UNIX machine, and it looks good when printed.
__________________
OS: Fedora 20 x86_64 | Machine: HP Pavilion a6130n | CPU: AMD 64 X2 Dual-Core 5000+ 2.6GHz | RAM: 5GB PC5300 DDR2 | Disk: 400GB SATA | Video: ATI Radeon HD 4350 512MB | Sound: Realtek ALC888S | Ethernet: Realtek RTL8201N
Reply With Quote
  #3  
Old 21st March 2012, 02:47 AM
sea Online
"Shells" (of a sub world)
 
Join Date: May 2011
Location: Confoederatio Helvetica (Swissh)
Age: 34
Posts: 3,598
linuxfirefox
Re: Manpage, is it really that simple?

Word.

Right at this moment, i have to write like, dont know... 30 to 50 pages... and as i understand you, its NOT required to be properly displayed with MAN.
But it might be, if/when i want to provide something like a pdf.
__________________
Laptop: Toshiba satellite p50-a-11 CPU: Intel i7 8*2400 MHz GPU: GeForce GT 745M RAM: 8192 MB Distro: Fedora (Rawhide) DE: Awesome
Guide: Windows 8+ & Fedora 20+ Dualboot
Repo (sea-devel) :: Text User Interface (TUI), Video Handler Script (VHS), efi-helper, grub2-circled-nasa-themes, Essentials (blame, p, rmtf, rnd, siggen, screenshot...), (BETA) Dev-Scripts, (BETA) Fedora Account Scripts (FAS)
Reply With Quote
  #4  
Old 21st March 2012, 10:54 PM
Alberth5674764 Offline
Registered User
 
Join Date: Nov 2011
Posts: 35
linuxfirefox
Re: Manpage, is it really that simple?

Except Word is pretty much useless as cross-platform documentation format.
I tend to use LaTeX, but you may want to use some open office program instead.
Reply With Quote
  #5  
Old 21st March 2012, 11:29 PM
Gareth Jones Offline
Official Gnome 3 Sales Rep. (and Adminstrator)
 
Join Date: Jul 2011
Location: Birmingham, UK
Age: 32
Posts: 2,771
linuxfirefox
Re: Manpage, is it really that simple?



Alberth5674764, I believe sea was saying work as in http://www.urbandictionary.com/define.php?term=word.

As much as he should say "latex" instead, I think people would look at him funny...
Reply With Quote
  #6  
Old 22nd March 2012, 09:06 PM
Alberth5674764 Offline
Registered User
 
Join Date: Nov 2011
Posts: 35
linuxfirefox
Re: Manpage, is it really that simple?

rofl

You learn something new every day!
Thanks for explaining
Reply With Quote
  #7  
Old 22nd March 2012, 09:59 PM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,876
linuxfirefox
Re: Manpage, is it really that simple?

Man pages really are simple.

Formatting/tagging is done with "." in the first column, what follows is the directive.

Early in the nroff/troff history, there were other options for processing text - tbl (translated tables into troff commands), pic (translated plots/diagrams into troff), eqn (equations), refer (cross references) and toc (table of contents). Others existed for esoteric formating (chemical formula and more). The output of each of these "preprocessors" would be the input, with the macros for that particular processor translated into macros/troff directives for following interpretation.

The macros provided (the .name stuff) is translated into troff (typesetting runoff). nroff is the same as troff, but it generates simple ascii control codes as defined by the TERM environment variable.

There is/was an indexer available for handling large documents.

The "man" command was a simple script that piped the various formatters in order, and passed them to the troff/nroff formatter for handling the "man" macros.

Remember, when this started process memory was limited to 64K bytes... so complex operations would be broken down giving each process a relatively simple thing to do. The way tbl worked was to translate tbl macros into the underlying format. Anything tbl didn't recognize was passed without change - assuming something later would translate it. I seem to remember the order was eqn, pic, tbl, refer, toc, troff. This allows equations to be embeded in diagrams, diagrams embeded in tables, and tables in the final macro processing. The printed output still had to be put in the right order if all were processed in one step (the table of contents would be last so that it could show the cross reference index page).

Breaking the problem up allowed for very elaborate documents to be created, and optimization by dropping passes that didn't apply.
Reply With Quote
  #8  
Old 23rd March 2012, 06:22 AM
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 5,708
linuxfedorafirefox
Re: Manpage, is it really that simple?

Quote:
Originally Posted by jpollard View Post
Early in the nroff/troff history, there were other options for processing text - tbl (translated tables into troff commands), pic (translated plots/diagrams into troff), eqn (equations), refer (cross references) and toc (table of contents).
And don't forget grap, which lets you create graphs of functions. There's a free version here. The mm and ms macros also made typesetting easier.

You can do some cool typesetting with groff, which comes by default with every Linux system and is pretty small (unlike more complicated systems, like LaTeX, which is a huge program). For example, if you save this code in a text file called mathquiz.roff:
Code:
.PH ""
.EQ
delim $$
.EN
.ce 1
\s+3\fBMath Quiz\fP  \(rh \fIShow all work!\fP \(lh\s0
.LB 3 0 0 1
.LI
Calculate the following:
.LB 3 0 0 2 a)
.LI
$int sub 0 sup a sqrt{( x + pi ) sup 3} ~ dx$ for $a ~>=~ 0$
.sp 10
.LI
$sum from {n = 1} to {inf} {3 over {10 sup n}}$
.LE
.sp 8
.LI
Find the area of the intersection of the four circles below:
.PS
for i = 0 to 1 do {
   for j = 0 to 1 do {circle radius 1 at i,j}
}
line from 0,0 to 1,0 "5" below
line from 1,0 to 1,1 " 5" ljust
line from 1,1 to 0,1 "5" above
line from 0,1 to 0,0 "5 " rjust
.PE
.LE
then run this command:
Code:
groff -p -e -mm mathquiz.roff | ps2pdf - mathquiz.pdf
You should get a PDF file with math symbols and a drawing. That command uses the pic and eqn preprocessors with the mm macro. The default output is PostScript, so ps2pdf converts it to PDF.
If you prefer a Helvetica font:
Code:
groff -f H -p -e -mm mathquiz.roff | ps2pdf - mathquiz.pdf
There's a free book on troff co-written by Tim O'Reilly himself, which can still be used for groff, available here. And if you want a text editor with syntax highlighting for *roff files, you can use nroff-mode in Emacs (Alt-x nroff-mode).

Edit: Here's what the PDF output of the above code looks like:
Attached Thumbnails
Click image for larger version

Name:	mathquiz.png
Views:	61
Size:	32.5 KB
ID:	22886  
__________________
OS: Fedora 20 x86_64 | Machine: HP Pavilion a6130n | CPU: AMD 64 X2 Dual-Core 5000+ 2.6GHz | RAM: 5GB PC5300 DDR2 | Disk: 400GB SATA | Video: ATI Radeon HD 4350 512MB | Sound: Realtek ALC888S | Ethernet: Realtek RTL8201N

Last edited by RupertPupkin; 23rd March 2012 at 08:42 PM. Reason: Added screenshot of PDF
Reply With Quote
Reply

Tags
manpage, simple

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple help :) loverdo Programming & Packaging 3 23rd January 2012 07:09 PM
[SOLVED] dracut manpage wrong chrismurphy Using Fedora 5 14th December 2011 09:45 PM
How can I see libc-manpage? bangwall Installation, Upgrades and Live Media 1 24th April 2011 01:01 PM
xtreme Linux newbie needin simple answers for simple questions. MegaManZZ Using Fedora 5 4th October 2007 06:24 PM
manpage info for crontab lsatenstein Using Fedora 3 13th June 2007 07:34 PM


Current GMT-time: 17:53 (Friday, 21-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
San Remo Instagram Photos - Bracknell Photos on Instagram - Manhumirim Photos