Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a bunch of CLI-only computers (I have not bothered to set up a GUI yet). I'm comfortable enough in the CLI to not NEED a GUI for most things. However, as a student, turning in Plain-Text documents really doesn't cut it.

Is there a way to edit Rich Text Format (.rtf) files from a CLI without popping into a GUI? I'd just need justification (Right, Left, Center), bolding, italics, and a bit of fonts (Sometimes I need to pad my Times New Roman font to a full 13 points to reach a page limit).

Heck, it could all be done manually in HTML, with a web-browser engine, and saving to the interesting .rtf font symbols instead of HTML tags.

Anybody know a way for me to do this?

share|improve this question

5 Answers 5

up vote 5 down vote accepted

I presume you want to hand-in a nicely formatted document, and the use of RTF your proposed solution. There are actually much better ways to format documents on a Unix system. The traditional way, which is likely to be available on your system out of the box, is to use troff (nowadays ditroff or its GNU equivalent groff). This allows you to markup the text using commands like \fBbold\fP and \fIitalics\fP. This is the system used for formatting manual pages. To convert the markup into PDF, install Ghostscript, and use a sequence like the following.

groff -Tps mydocument.ms >mydocument.ps
ps2pdf mydocument.ps mydocument.pdf

However, if you want to learn a system that you can build-on, I suggest to learn LaTeX. This has a more intuitive markup language (e.g. you write \section{My Section Title}) as well as thousands of add-on packages and fonts. Most Mathematics and Physics papers are written in it. In this case, the command you would use to convert your document into PDF would be something like.

pdflatex mydocument.tex
share|improve this answer
    
This solution will probably work, as Latex. Will report back once I have tried it while finishing up The Help. –  T.C. Feb 7 '13 at 15:46
1  
Just as an update, I have learned LaTeX (slight learning curve), and BibTex (Steeper, but better documented with google), and am loving both. RTF submissions are now a thing of the past! Even on my Mac, I edit using SSH into the linux boxes with LaTeX installed. –  T.C. Mar 19 '13 at 14:42
    
I'm glad you found the truth! You can also install LaTeX on your Mac. It runs fine. –  Diomidis Spinellis Mar 20 '13 at 19:02

I don't believe there is, your question is similar to this:

http://stackoverflow.com/questions/3778213/using-vim-to-edit-microsoft-word-files

If you could use LaTeX, then converting them to rtf shouldn't be too difficult.

It would help to explain why you're trying to edit rtf files; the solution is probably going to look something like:

  1. scp (or ftp or samba or what not) transfer the file to your local machine

  2. Edit file locally

  3. Upload finished file

Alternatively, installing X11 (and possibly vnc) on one of those machines would seem the way to go. Another option would be to convert them to html with Open Office (which I believe can do batch jobs from command line), edit them, and then convert them back. But the end result is the same; I've never seen or heard of a cli editor that can reasonably edit *.rtf files directly (short of editing the very large files themselves.)

share|improve this answer
    
Editing some markup designed for human consumption (be it troff, (La)TeX, docbook) is definitely preferrable to RTF. –  vonbrand Feb 7 '13 at 3:21
    
I'd just like to point out that most of the stuff you see in a RTF file (The first thousand+ lines generated by Microsoft Word) is 38kB of crud formatting that is unnecessary. Most editors work without that. Really, RTF is a very lightweight markup language, best known for being useable on every Mac, Windows Box, and (I suppose) not natively on Linux. –  T.C. Feb 7 '13 at 12:31
    
Oh, and I need to edit RTF files (probably) because that way I can use the stupid school computers to print my work. I hate printers. But I think the PDF options mentioned should work. –  T.C. Feb 7 '13 at 12:33

pandoc can convert a variety of markup texts into a wide variety of formats, including RTF.

Pandoc is a Haskell library for converting from one markup format to
another, and a command-line tool that uses this library. It can read
markdown and (subsets of) Textile, reStructuredText, HTML, LaTeX, MediaWiki
markup, and DocBook XML; and it can write plain text, markdown,
reStructuredText, XHTML, HTML 5, LaTeX (including beamer slide shows),
ConTeXt, RTF, DocBook XML, OpenDocument XML, ODT, Word docx, GNU Texinfo,
MediaWiki markup, EPUB (v2 or v3), FictionBook2, Textile, groff man pages,
Emacs Org-Mode, AsciiDoc, and Slidy, Slideous, DZSlides, or S5 HTML slide
shows. It can also produce PDF output on systems where LaTeX is installed.
share|improve this answer
    
Definitely a tool I will add to my computer! Long term, however, I have been convinced to try Latex more. Need the RTF capability, though, so thanks. –  T.C. Feb 7 '13 at 15:48
1  
Haskell, unforunately, isn't yet available on the Raspberry Pi. However, I have added it to my other CLI machines because it is still useful over SSH and SCP. –  T.C. Feb 7 '13 at 22:09

While I too think Pandoc (Reed Kraft-Murphy's answer) might be perfect here, I'd like to point out that there's also WordGrinder, a little more WYSIWYG-like:

WordGrinder screenshot

It features HTML import and export as well as LaTeX and Troff export.

share|improve this answer
    
Will be working on this for sure in some cases.... Some teachers just can't take the hint "Yes, it has strange characters, and no, you can't tell what it is just by reading over my shoulder, but trust me, it will be pretty when it is printed." Oh, and didn't you know that the command line is for idiots who don't actually want to do anything productive? My teachers all know it! Thanks! –  T.C. Feb 7 '13 at 15:50
    
I can't get it to install on either my Pi or my other boxes, even the Ubuntu Server box. Shame. –  T.C. Feb 8 '13 at 0:27

If your needs are modest, consider one of the lightweight markup formats. The most popular are Markdown (what Stack Overflow / Stack Exchange uses, too) and reStructured Text.

I have only seen Markdown to HTML converters, but it should be easy to take it from there. RST has TeX conversion, too.

For what it's worth, I did my Master's Thesis in RST, but it was painful in places, and I ended up doing the final layout / pagination in OpenOffice. I also tried a HTML to PDF converter but it had issues with Unicode, and I wanted more control over the end result than straight machine conversion.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.