Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need a simple markup that would allow me to include chunks of code and images, and be able to produce .doc (or .rtf) and .pdf documents. A bit (or maybe a lot) like the StackExchange markup, but with conversion to PDF and Word documents. I am producing a lot of documentation for the statistical analyses I am doing, and this documentation is then passed on to scientists who work predominantly with Word. Requirements:

  • basic markup (document structure, bold, italic)
  • chunks of code or preformatted text (syntax highlighting a plus)
  • including external images in the viewer
  • export to PDF and Word DOC/DOCX/RTF (HTML a plus)

I am considering writing a few LaTeX based Perl scripts for myself, but maybe there is software like that already out there?

share|improve this question
    
I think like you say LaTeX scripts which you write yourself is probably the best choice. That way you have complete control over the formatting etc... –  lordqwerty Oct 25 '12 at 9:05
    
I don't really care about formatting, I'd prefer a solution that I do not have to work on myself :-) But thanks. –  January Oct 25 '12 at 9:05

2 Answers 2

up vote 4 down vote accepted

You might want to look at rst (ReStructuredText). This is a markup language much used for python documentation. There are many tools that can work with rst and convert it into many formats.

One tool is sphinx which can convert to html, latex->pdf, rtf, and man pages.

But there is e.g. also the docutils package, which has tools to convert the rst file into many formats:

  • rst2html
  • rst2xml
  • rst2latex
  • rst2odt
  • rst2s5
  • rst2man

You are most probably interested in rst2latex, which can then be compiled to pdf. Or you can use this software to do this in a single step: rst2pdf.

And you might want to use rst2odt, which produces the libreoffice/openoffice version of a word document which can then be converted by these to doc format.

share|improve this answer
    
Ha, you've beaten me by 3 minutes :) –  Sergey Oct 25 '12 at 9:59
    
Perfect. Thanks! –  January Oct 25 '12 at 10:15

Sphinx is a tool initially used to create documentation for Python programming language. It is written in Python and has a lot of Python-specific features, but generally can be used to create any kind of "narrative" documentation with (optionally) table of contents, cross-references, search, syntax highlighting for code blocks and many other useful features.

It uses reStructuredText as input format, which is quite similar to Stack Exchange markup, only has more features.

Sphinx can generate one long HTML document, a whole "website" containing many pages or a PDF "book". I'm not sure about .doc format but I think you can just open HTML in MS Word and save it as .doc

share|improve this answer
    
...or, even better, use (libreoffice|soffice) headless mode to convert it to Word. The goal is to minimise the confusion of the end users at the same time maximizing the automatisation of the tasks at hand. –  January Oct 25 '12 at 10:36

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.