Welcome to the most active Linux Forum on the web.
Go Back > Blogs > mowestusa
User Name


Rate this Entry

Plain Text & CLI Printing & SciTE

Posted 02-07-2007 at 11:11 AM by mowestusa

I'm going to cover a few different topics at once under this entry.

First, I have fallen in love with "plain text" as my default file format. I'm not a programer, but I am a writer. In fact, a large portion of my job does not involve computers at all. Although I could live without a computer, I use it as a tool to get all of the writing done which is demanded of me each day. "Plain Text" allows me to get the job done no matter what computer I use. "Plain Text" works great on in CLI (Command Line Interface, think of DOS if you are reading this as a Windows user). If I have a Linux box without a working graphical Window Manager, I can still write. If I want to log in remotely by ssh to one of my boxes, I can simply write on that remote box using just the CLI and CLI editors. "Plain Text" is cross platform. I can open a plain text document in Linux, in Windows, and on my PocketPC. If you need to make it look really fancy there are lots of options. I can easily import plain text into Scribus (DTP program that is opensource), Word, OpenOffice, or Abiword. I can also convert plain text into HTML, LaTeX, or Asciidoc (a linux text processing program) by adding the appropriate markup in a text editor. I'm always find more ways to do cool things with simple plain text. You can't beat the small file sizes either.

In Linux you have at your finger tips in the CLI access to incredibly powerful programs that can deal with plain text. There are CLI tools to edit plain text like vim, emacs, or nano. There are CLI tools that deal with LaTeX and Asciidoc marked up text, and viewers of the resulting files as well. There are CLI tools to do spell checking like ispell. I did have issues with printing plain text documents from the CLI.

There are options for printing plain text from the CLI, but they have issues. Lpr is one way to do it. However, lpr had two issues I couldn't figure out how to fix. When I used lpr with my printer it ignored the physical size of the paper, and failed to use appropriate margins for the paper. It printed from the left edge to the right edge spilling over on both sides. It also falled to leave a resonable top margin or bottom margin. This made printout unreadable. An often suggested program for this purpose is a2ps. A2ps fixes a lot of my issues, and offers tons of options. You can get beautifully formated text with nice looking headers, printing landscape or portrait, and column boarders as well. A2ps failed two wrap lines on words. Instead it would wrap lines on column, which means you might have a word that is cut off at odd places, wherever the 66th or 80th column of monospaced text might be. This made a2ps basically useless to me as a writter, because I did not want my printout to have words chopped in half or 1/3 or by one character at the end of lines. After a post to my LUG's (Linux User Group) mailing list, I had the answer. It was suggested that I use enscript.

Enscript answered all of my issues. With the following command, I had a beautiful printout on letter size paper, word wrapped, and in Courier 10 point font.
enscript --word-wrap --media=letter $filename
Enscript has tons of options to beautify the plain text printout, but just the above example is a great start for me. I can change the font, paper orientation, and header options as well to spruce up the printout.

Enscript also soloved an issue in SciTE under linux. SciTE under Linux does not have printing as a native function. It uses an exterior program to print under Linux using a2ps by default. By making a change to the file I can now use enscript in SciTE giving it the capability of printing out beautiful documents.

I know "Plain Text" is rather old school these days when we have OpenOffice and other GUI wordprocessors. Hopefully, this blog entry will offer another option for writers who want the ultimate in portability. No need to go out and get that latest Vista laptop. You could make an old Pentium 133 fly with "Plain Text" as your document format of choice.
Posted in Uncategorized
Views 2080 Comments 0
« Prev     Main     Next »


All times are GMT -5. The time now is 12:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration