1

Blank space in column 1 should be shared with other columns

As you can see in the image, I want the blank space of column 1 to be shared with other columns so the table looks more neat and best for readers.

\setcolsep does not solve this issue.

UPDATE: Fixed the code:

\documentclass{article}
\usepackage{float}
\usepackage{array}
\usepackage{tabularx}
\usepackage{xepersian}
\begin{document}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\begin{tabularx}{\textwidth}{| X | X | X |}
\hline
ویژگی & TCP & UDP\\\hline
نوع ارتباط & بر اساس اتصال & بدون برقراری اتصال (ممکن است هر مقدار اطلاعات فرستاده شود و آن پایان ارتباط باشد)\\
مزیت & ارتباط قابل اطمینان & سرعت بالا\\
استفاده پروتکل های دیگر & \lr{HTTP}\footnote{\lr{Hypertext Transfer Protocol}}, \lr{HTTPS}\footnote{\lr{Hypertext Transfer Protocol Secure}}, \lr{FTP}\footnote{\lr{File Transfer Protocol}}, \lr{Telnet} & \lr{DNS}\footnote{\lr{Domain Name System}}, \lr{DHCP}\footnote{\lr{Dynamic Host Configuration Protocol}}, \lr{VOIP}\footnote{\lr{Voice over Internet Protocol}}\\
نظم ارسال & طبق نظم مشخص شده & بدون نظم\\
سایز هدر & \lr{20 Bytes} & \lr{8 Bytes}\\
خطایابی & بله & بله\\
بازیابی & بله (پس از خطایابی، اطلاعاتی که اشتباه انتقال یافته اند دوباره منتقل می شوند) & خیر\\
\hline
\end{tabularx}
\end{document}
  • Have you tried making the third column r instead of X? – TeXnician Dec 29 '17 at 7:39
  • @TeXnician I don't want to because I'm using \renewcommand{\tabularxcolumn}[1]{m{#1}} Added that to code – Shayan Dec 29 '17 at 7:42
  • 1
    Please make your document compilable to help us help you. As it is one cannot copy, paste and compile. – TeXnician Dec 29 '17 at 7:43
  • @TeXnician I think I added all packages needed, What's not compiling? You need to install the XePersian Package from TeX Live Manager first. – Shayan Dec 29 '17 at 7:45
  • 1
    Copy your above code and try to run it with xelatex and you'll see what a compilable document means. – user2478 Dec 29 '17 at 7:46
1

Try something like

\begin{tabularx}{\textwidth}{
   | >{\hsize=1.1\hsize}X 
   | >{\hsize=1.1\hsize}X 
   | >{\hsize=0.8\hsize}X |}
 [...]

the \hsize should be added 3X

  • Nope still getting that blank space prntscr.com/htp4bv prolly because tables are so complicated in LaTeX, maybe I should try Longtable? – Shayan Dec 29 '17 at 7:54
  • What does > in >{\hsize=1.1\hsize}X do though? – Shayan Dec 29 '17 at 11:55
  • your answer worked, problem was, for different paper sizes the result is going to be different (That's what I hate) so I was looking for a way for LaTeX to automatically use the blank space for other columns, well tbh that's too much to ask, even MS Word doesn't do that, so it's only possible to set it manually thanks {| >{\hsize=0.6\hsize}X | >{\hsize=1\hsize}X | X |} worked – Shayan Dec 29 '17 at 12:04
  • in fact the above sizes were generating the table as if there's a new column, so for other readers {| >{\hsize=0.7\hsize}X | >{\hsize=1.15\hsize}X | >{\hsize=1.15\hsize}X |} worked the best, the numbers of \hsize should add up to 3 (since there are three columns) – Shayan Dec 29 '17 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.