I want to reverse (flip horizontal) all columns in some tables like this:

‎$p$ & $q$ & $p\vee q$ \\ \hline‎
‎$T$ & $T$ &T\\‎
‎$T$ & $F$ &T\\‎
‎$F$ & $T$ &T\\‎
‎$F$ & $F$ &F‎  

I wrote these tables in Persian Xe-TeX and this language is a right to left writing language, and these tables appear reverse in output, so I used \lr command but the tables broke down and went out from centering also. I don't want to rewrite them. How can I fix it?

  • Please clarify what you mean by "reverse (flip horizontal)". E.g., do you want to invert the ordering of the columns?
    – Mico
    Commented Jun 30, 2016 at 18:49
  • @Mico I want to the first column appears in the last position and second goes to column-1 and so on, then the last column will be the first of new table.
    – Nosrati
    Commented Jun 30, 2016 at 19:16
  • I think your best best is to use an editor that lets you select rectangular blocks and cut and paste them as you see fit.
    – Mico
    Commented Jun 30, 2016 at 19:47

1 Answer 1



If we want reversed order, an exemplary solution for three columns may be as follows:




$p$ & $q$ & $p\vee q$ \\ \hline
$T$ & $T$ &T\\
$T$ & $F$ &T\\
$F$ & $T$ &T\\
$F$ & $F$ &F  

Reversed order

\def\1#1&#2&#3\\{#3 &#2 &#1 \\}

\1$p$ & $q$ & $p\vee q$ \\ \hline
\1$T$ & $T$ &T\\
\1$T$ & $F$ &T\\
\1$F$ & $T$ &T\\
\1$F$ & $F$ &F\\ %this one added - PS  


enter image description here

  • Thanks, but what should I do with these mirrored characters?
    – Nosrati
    Commented Jun 30, 2016 at 19:25
  • @S.Nosrati There are at least 3 possible interpetations of your request. This one is the simplest one to obtain. But after some clarifying a different combination of reversing the order and entries in columns is possible. Commented Jun 30, 2016 at 19:33
  • It's great. This works for moving every arbitrary column without rewrite it. OK. Thanks a lot.
    – Nosrati
    Commented Jun 30, 2016 at 20:33
  • Another question that can we delete an arbitrary column in this flapping! process? For example the original table has 10 columns and with this definition they reduce to 8 columns?
    – Nosrati
    Commented Jun 30, 2016 at 20:40
  • @S.Nosrati Yes, it is possible. However rather precise formulation of the problem would help. In particular, reducing from 9 to 7 columns is easier than from 10 to 8. BTW: I think, that removing the first part of my answer is a good move, but if for some reasons you want it to stay, it will stay. Commented Jun 30, 2016 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .