Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want type Farsi (this language is right-to-left) in several columns. How do I start the contents from the first column to the right?

share|improve this question
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do. –  Stephan Lehmke Nov 28 '12 at 7:07
    
So you basically want a version of multicol Package ordering the columns right-to-left? –  Stephan Lehmke Nov 28 '12 at 7:09

3 Answers 3

If I understand your question correctly, you are saying that you use bidi package together with multicol package and the order of contents produced by \tableofcontents is wrong. Here is an example showing the problem:

\documentclass{article}
\usepackage{multicol}
\usepackage{bidi}
\setRTL
\begin{document}
\tableofcontents
\begin{multicols}{2}
\section{First}
\columnbreak
\section{Second}
\end{multicols}
\end{document}

As you can see in the PDF output, columns are ordered RTL; however the order in the table of contents is obviously wrong. This is a known bug. This happens because the delay of the \write without \immediate writes the entry at page shipout time, when the page number is known.

With twocolumn option, this problem does not happen (I should state that the problem existed in earlier versions of bidi package) because bidi fools TeX and so the order of contents is right; try:

\documentclass[twocolumn]{article}
\usepackage{bidi}
\setRTL
\begin{document}
\tableofcontents
\section{First}
\newpage
\section{Second}
\end{document}

I could fix this but unfortunately that is not likely to happen since bidi is already in its final version (version 12) and no more development will be done. I am also not sure about a workaround that could possibly fix this.

share|improve this answer
    
How do you mean, 'final' version? Will there be no more development of its API/semantics, ever? –  einpoklum Nov 29 '12 at 6:07
    
Without donations to the project, there will be no more development of its API/semantics, ever. –  Vafa Khalighi Nov 29 '12 at 10:27
    
Where's the donations page? Were you counting on large donors or individual users? –  einpoklum Nov 29 '12 at 13:28
    
@einpoklum: There is no donation page. Both large donors and individual users are welcome. If you are interested, then you can send me an email: Vafa.Khalighi@student.uts.edu.au –  Vafa Khalighi Nov 29 '12 at 22:54
1  
With a multicol version 1.8a or above the bug can be easily corrected, see my answer. Of course this only helps for the general audience when 1.8 is on CTAN and not only in the SVN, but I hope this will happen soon. –  Frank Mittelbach Aug 30 '13 at 17:17

If I understood you correctly, try the following code:

\documentclass[twocolumn]{article}
\usepackage{ptext} 
\usepackage{xepersian}
\begin{document}
\section{بخش اول}
\ptext[1-3]
\section{بخش دوم}
\ptext[1-3]
\end{document}

The output is: enter image description here

share|improve this answer
    
Additionally, for more examples and information, you can refer to the ParsiLatex website. –  Vahid Damanafshan Nov 28 '12 at 7:30

For two-column mode throughout the document a good approach is given in a different answer (unless you also require balancing).

For more than 2 columns or when balancing of column data is needed the answer should be to use the multicol package. However, as demonstrated by Vafa Khalighi this results in an incorrect ordering of toc entries.

The reason for this is some incorrect patching of multicol done in the file multicol-xetex-bidi.def. The an attempt is made to reverse the columns from the default

 hbox ( vbox-col-1 rule vbox-col-2 rule ... rule vbox-col-n )

To

 hbox ( vbox-col-n rule vbox-col-n-1 rule ... rule vbox-col-1 )

As logical as this seems it is wrong, because in that case TeX sees vbox-col-n first when it does as \shipout and this any \write from the last column first and thus that will be the order they show up in the ToC.

So the correct way to implement this is more complicated: we needed to make take see vbox-col-1 even though it is at the right edge of the page. So abstractly the code for this does

 hbox ( hskip to right margin
        hskip - columnwidth
        vbox-col-1 
        hskip - columnwidth
        hskip - columnsep            % or even a little more magic for rules
        hskip - columnwidth 
        vbox-col-2  ...  vbox-col-n )

some time ago I implemented support for RL typesetting and made exactly the same error :-( and that version is still out on CTAN.

A version with correct RL support is v1.8a or higher which currently can be obtained from the SVN sources (you still then have to unpack it by running tools.ins, so it is not that convenient). I hope to change that in the near future as I'm curently making a few other updates to the source.

With that version in place the file multicol-xetex-bidi.def can be drastically shortened to just contain the following line:

\RLmulticolcolumns

which unconditionally reverses the multicol columns (but nothing else). Or one keeps the file completely empty and instead uses that command like \setRTL in the document.

And perhaps one also want's to move the footnoterule to the right (which bidi doesn't seem to do, but xepersiandoes so this should be used with care):

\renewcommand \footnoterule{%
    \kern-3pt\hbox to\textwidth{\hskip .6\textwidth\hrulefill }%
    \kern2.6pt}

With the above changes to undo the patches by bidi (and a new version of multicol) we then get desired output.

The xepersian package used in the answer by Vahid Damanafshan internally also uses the bidi package so would suffer too from the incorrect patch for multicols. But with the suggested change above, we get really nice output (not that I speak the language, but at least I'm able to identify the numbers in the ToC and they come out correctly; and sorry for the footnote being by its own, just wanted to have one to see what happens):

\documentclass{article}

\usepackage{multicol}

\usepackage{ptext}
\usepackage{xepersian}

\begin{document}
\tableofcontents
\begin{multicols}{3}
  \section{بخش اول}
  \ptext[1-2]\footnote{\ptext[3]}
  \section{بخش اول}
  \ptext[4]
\end{multicols}
\end{document}

And as a result we get:

enter image description here

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.