# Creating a LaTeX Table from a Microsoft Word Document

I have this multi page word document file which is consisted of a table with two columns. the left column is an English word in front of which in the left column the Persian translation is provided. I want to include this table in my latex document without using of converters. Is there anyway?(maybe by using datatool!) So far what i could find in the web is as follow:

\documentclass{article}
\begin{filecontents*}{table.csv}
English ,فارسی
Euclidean geometry, هندسۀ اقلیدسی
Hippocrates, بقراط
Poetica,بوطیقا
Plato, افلاطون
Al-Hazem, ابن رشد
\end{filecontents*}
\usepackage{xepersian}
\settextfont{Tahoma}
\usepackage{csvsimple}
\begin{document}
\csvautotabular{table.csv}
\end{document}


THe folowing image is the XeLaTex output:

this way it's easier but I still have to copy one by one into my csv file the contents of each column. now, if that direct inclusion of a word table into latex was possible I would like to know about it. If not there are three minor questions concerning the above code:

1. As you see the Persian and English must swap their positions. Persian in the left and English in the right position.

2. How can I add another column to include in it an automatic produced number for each row?

3. How can I add my data in csv file, for each line only one Persian and one English entry but make LaTeX produce a four column table so that the space used for the entire table will be reduced in half?

Sorry, I didn't know what I could do about the font.

P.S. I changed the font to Tahoma.

• What do you mean in your point 3 exactly? I'm not sure I understand why you need 2 extra columns to reduce space. – Alenanno Dec 26 '15 at 15:13
• I don't want to write English ,فارسی,English ,فارسی in the first row and subsequently write four words in every line to have 4 columns. In this above form[the attached image] half of the page remains empty. You can assume that I want latex to make 2 tables in each page from the data file with a consistent numbering. I mean for example if the first table finishes with 20 the next table begin with 21 and the table on the next page begin with 41 and so on. – nima Dec 26 '15 at 15:40
• Is this what you're looking for? I mean, is the column order how you want it? – Alenanno Dec 26 '15 at 16:06
• i.imgur.com/aOZu4bQ.png and about the column order yes that's it. – nima Dec 26 '15 at 16:34
• Yes I understood the double column, but you should add more content if possible :D using the format word, word to your question. – Alenanno Dec 26 '15 at 16:36

As it turns out, using a table that spans across pages and is also enclosed in the multicol environment is almost impossible.

I managed to do everything, except making the table span two columns in the same page. However, this last part has been implemented from this David Carlisle's answer.

By the way, I have changed the Persian font (the one I used is free), but you're free to replace yours.

## Code

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{longtable,csvsimple,booktabs}
\usepackage{fontspec} % for the Latin alphabet
\usepackage{multicol}
\usepackage{array}
\usepackage{xepersian}
\settextfont{Nazanin} % font for Persian
\setmainfont[Script=Arabic]{Times New Roman} % Latin Alphabet

\begin{filecontents*}{xtable.csv}
English, Persian
Euclidean geometry, هندسۀ اقلیدسی
Hippocrates, بقراط
Poetica,بوطیقا
Plato, افلاطون
Al-Hazem, ابن رشد
...
more content here
\end{filecontents*}

\newsavebox\ltmcbox

\begin{document}
\begin{multicols}{2}
\setbox\ltmcbox\vbox{
\makeatletter\col@number\@ne
longtable=rl>{\beginR}l,
& \bfseries English & \bfseries فارسی \\
\bottomrule\endfoot,
late after line=\\]%
{xtable.csv}{English=\English, Persian=\Persian}%
{\thecsvrow & \English & \Persian}
\unskip
\unpenalty
\unpenalty}

\unvbox\ltmcbox
\end{multicols}
\end{document}

• You must change \setmainfont{Times New Roman} with \setmainfont[Script=Arabic]{Times New Roman}. – Salim Bou Dec 26 '15 at 18:01
• @salimbou What is the script option for? – Alenanno Dec 26 '15 at 18:03
• Thank you very much. It's fantastic. I just want to know how is it possible to have the head row in the second part of the table? – nima Dec 26 '15 at 18:42
• @Alenanno Persian or Arabic letters are connected , option Script=Arabic is defined to link letters. – Salim Bou Dec 26 '15 at 18:58
• Note here the persian text is reversed you can fix this with longtable=rl>{\beginR}l and do not forget to add array package. – Salim Bou Dec 26 '15 at 19:15