5

I would like to write a research paper using restructuredtext, is it possible to have the two-column style inherent to this kind of document? I looked at the specifications but apart using a table which will be a real pain I haven't been able to find an alternative.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
attwad
  • 935
  • 8
  • 21

5 Answers5

7

You can output 2-column in any of the formats docutils outputs.

If what you want is a 2-column ReST source then it's much harder.

Since there are no pages, it may not even make sense (imagine if the columns are 5000 lines long ;-), so I will assume you mean in the output, be it HTML, PDF or whatever.

For PDF, using rst2pdf, it's trivial, you only need to use the -s twocolumn option.

For HTML, it's a CSS thing, and I am sure google can help you.

Roberto Alsina
  • 782
  • 4
  • 8
  • Thank you so much! Of course I didn't want to split my rest source this makes no sense to me ^^ I finally wrote my paper using latex, but next time thanks to you I'll give ReST a try :) – attwad Sep 02 '09 at 00:40
  • Another options might have been to try https://NoTex.ch: It has build in support for two column PDFs, but instead of *rst2pdf* it uses *Sphinx* (in combination with the LaTex `\twocolumn` command). – hsk81 Aug 06 '13 at 10:09
4

If you wan't two column latex from reST you can get it with:

rst2latex --documentoptions=twocolumn source.rst
Matti Pastell
  • 9,135
  • 3
  • 37
  • 44
4

It is possible with rst2pdf but your layout has to be kept within PageBreak. In otherwords you cannot have 1 column layout and 2 column layout on one page.

.. raw:: pdf 

      PageBreak twoColumn 

some text in two columns 


.. raw:: pdf 

      PageBreak oneColumn 

some text in one column
zzart
  • 11,207
  • 5
  • 52
  • 47
3

I haven't found a way to do so with ReST. You really should consider LaTeX for your research paper, especially for citations (BibTex), if you want to write it in plain text. You can easily switch between one and two columns:

% remove "twocolumn" for a single column
\documentclass[twocolumn]{article}
\begin{document}
Text here...
\end{document}

See Wikibooks for a good reference.

jmdeldin
  • 5,354
  • 1
  • 28
  • 21
  • yes... seems there is no way in ReST, the only paper styles that I found using ReST were single columned. Guess I'll have to learn Latex ;) – attwad Aug 12 '09 at 06:00
  • Good luck! LaTeX is aggravating at times, but it's still better than Word. Also, be sure to use a Makefile (or Rakefile if you're into that) for your paper - it'll make compiling a lot easier. – jmdeldin Aug 13 '09 at 22:35
0

using sphinx

$ python3 -m venv ~/venv ; . ~/venv/bin/activate                                                          
$ pip install sphinx
$ sphinx-quickstart    # answer default to all questions                               
$ tree                                                
.                                                                                                   
├── _build                                                                                          
├── conf.py                                                                                         
├── index.rst                                                                                       
├── Makefile                                                                                        
├── rapport.rst                                                                                     
├── README.rst                                                                                      
├── requirements.txt                                                                                
├── _static                                                                                             
                                                             

To have laxtex A4, article with control on margins and 2 columns: add this to conf.py:

    # -- Options for LaTeX output --------------------------------                                    
    latex_elements = {                                                                                
      'papersize': 'a4paper',  # 'letterpaper' or 'a4paper'                                           
      'pointsize': '10pt',     # font size (default is 10pt)                                          
      'sphinxsetup': 'hmargin={1.5cm,1.5cm}, vmargin={2cm,2cm}',                                      
      'classoptions': ',twocolumn',    # to have two columns                                          
      }                                                                                               
    latex_theme = 'howto'  # 'manual' to make a book, 'howto' to make an article                      
    latex_logo = 'src/images/spqr_300px.png'                                                          

Crate some rst files::

    $ mkdir -p src                                                                                    
    $ touch src/antiquite.rst src/biographie.rst src/moderne.rst                                      

Then we need to define the main TOC table of content in the main index.rst file, this TOC file will refer to rst files to include in the document::

    $ cat index.rst                                                                                   
    Exposé                                                                                    
    ===============                                                                                   
                                                                                                      
    .. toctree::                                                                                      
       :maxdepth: 3                                                                                   
       :caption: Table des Matieres:                                                                  
                                                                                                      
       /src/antiquite.rst                                                                             
       /src/biographie.rst                                                                            
       /src/moderne.rst                                                                               
    $                                                                                                 

From the folder where Makefile is, call::

  • $ make html to create html and point Firefox to _build/html/index.html
  • $ make pdflatex to create pdf and point evince to _build/latex/*.pdf

you got a two column article in pdflatex !

user3313834
  • 7,327
  • 12
  • 56
  • 99