On Mon, 8 Apr 2002, Randy Kramer wrote:

> > Michael Holt wrote:
> > > I do have
> > > another question; I've read books that say they've were written using vi
> > > and I started wondering if you could actually apply fonts and control size
> > > of fonts as well as italics, bold, etc.  Is that possible?  Does vi have
> > > something built in that will allow you to format a document?
>
> AFAIK (and like J. Craig Woods said) there is nothing built into vi to
> let you do those kind of things.  I can imagine that someone who writes
> a book in vi uses one of two approaches (or a combination of the two):
>

Not built in, true, but I do almost all my documentation in vi/TeX. One
nice thing about vi is that you can filter sections of text through
external programs, or read directly from the stdout of any program. This
allows me to format a section of text by doing (trivial example):

 :10,50! fmt

For TeX code I've created a bunch of little helper scripts to do things
like plug in an image or format columns. E.g.:


    #/bin/sh
        # epsinsert
    GEOMETRY=`grep -A1 "% Image geometry" $1|tail -1`
    # echo $GEOMETRY
    WIDTH=`echo $GEOMETRY|cut -d' ' -f1`
    HEIGHT=`echo $GEOMETRY|cut -d' ' -f2`

    echo \\begin\{figure\}[label]
    echo \\centering
    echo \\includegraphics[height=${HEIGHT}pt,width=${WIDTH}pt]{$1}
    echo \\caption\{ CAPTION \}
    echo \\label\{label\}
    echo \\end\{figure\}

This can be called with:
  :r! epsinsert images/somefile.eps


>    * Use vi to write the book in plain ASCII text, then move the plain
> ASCII text to another application to apply fancy formatting.  (I often
> found this a useful approach even in a word processor, at least until I
> learned to use styles effectively.  Content is the most important thing,
> after you get the content right, then do the formatting, hopefully to
> enhance the meaning and readability of the document.)
>
>    * Use vi to write the book in plain ASCII but add tags (manually or
> semi-automatically using macros or whatever) to support a markup
> language like DocBook, LinuxDoc, HTML, LaTeX, or whatever.  You know the
> tags I mean, things like:

Apache has a TeX plugin that allows you to server TeX documents over
HTML. I've been experimenting with it to show equations and it seems
promising.
>
> To me, this is not a fun approach.
>
> Randy Kramer
>
>


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to