0

I am new in latex. I have created a table. However, it is not what I expected.

enter image description here

I expected it to be centered and well separated such as the following (this table is constructed in MS Word),

enter image description here

\begin{table}[htb] % <--- "here", "top", "bottom"
\centering
    \setcellgapes{2pt}
    \makegapedcells
\caption{Sample result of N. UzZaman and Mumit’s Bangla soundex table}
    \begin{tabularx}{\linewidth}{@{} lcc @{}}
    \toprule
    \toprule
\makecell[lb]{Input}
            & \makecell[b]{Encoded}
                                & \makecell[b]{Suggestion}\\
    \midrule
\textbengali{খুমাড়}  & kumar        & \textbengali{কুমার}\\
\textbengali{পাসান}  & pasan        & \textbengali{পাষাণ}\\
    \bottomrule
    \bottomrule
    \end{tabularx}
  \label{table3}
\end{table}

Since the document size is huge, I am unable to post the whole code here. I have added the following packages I used.

\usepackage{xcolor}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{array}
\usepackage{float}
\usepackage{graphicx}  
\usepackage[utf8]{inputenc}
\usepackage{polyglossia}
\usepackage{fontspec}
\setmainlanguage{english}
\setotherlanguage{bengali}
\newfontfamily\bengalifont[Script=Bengali]{Vrinda}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{makecell, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{amsmath}
  • 2
    You should not post the whole document, you should not post the long list of used packages also. You should post a minimal code only, with related packages and commands, which is called an MWE. – user156344 Mar 25 at 14:39
  • 1
    For future posts please try to use accurate tags for your question. I notice that many of your questions (indeed all six) were initially tagged with biblatex, bibtex even though they had nothing to do with bibliographies in general and biblatex and BibTeX specifically. You don't have to add a lot of tags to your question, but please try to find ones that accurately describes what your question is about and avoid misusing tags that have nothing to do with the question as such. – moewe Mar 25 at 14:45
  • @JouleV Thanks for your suggestion. – Nahid Hossain Shihab Mar 25 at 14:48
  • @moewe Please suggest me some tags I can use for latex problems. I thought biblatex bibtex are just another names of latex – Nahid Hossain Shihab Mar 25 at 14:48
  • 1
    BTW: You can find out more about tags by clicking on them and then going to the info tab. For tables you find tex.stackexchange.com/tags/tables/info, for biblatex tex.stackexchange.com/tags/biblatex/info. When you tag your question there are usually little explanatory texts that tell you what each suggested tag is about: Read that before you decide whether or not to include the tag. Using the right tags increases the chance of having the right people look at your question. – moewe Mar 25 at 14:56
1

test the following:

\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs, makecell, tabularx}
    \setcellgapes{2pt}
    \makegapedcells
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}

\usepackage[skip=1ex]{caption}

\begin{document}
\begin{table}[htb]
\caption{Sample result of N. UzZaman and Mumit’s Bangla soundex table}
    \begin{tabularx}{\linewidth}{LCC}
    \toprule
\makecell[lb]{Input}
        & \makecell[b]{Encoded}
                    & \makecell[b]{Suggestion}\\
    \midrule
some bengali text %\textbengali{খুমাড়}
    & kumar         & some bengali text \\  %\textbengali{কুমার}\\
some bengali text %\textbengali{পাসান}
    & pasan         & some bengali text \\  %\textbengali{পাষাণ}\\
    \bottomrule
    \end{tabularx}
  \label{table3}
\end{table}

\begin{table}[htb]
\centering
\caption{Sample result of N. UzZaman and Mumit’s Bangla soundex table}
    \begin{tabular}{lcc}
    \toprule
\makecell[lb]{Input}
        & \makecell[b]{Encoded}
                    & \makecell[b]{Suggestion}\\
    \midrule
some bengali text %\textbengali{খুমাড়}
    & kumar         & some bengali text \\  %\textbengali{কুমার}\\
some bengali text %\textbengali{পাসান}
    & pasan         & some bengali text \\  %\textbengali{পাষাণ}\\
    \bottomrule
    \end{tabular}
  \label{table3}
\end{table}

\end{document}

it gives:

enter image description here

as mentioned in comments below your question, in tabularx should be at least one colum of type X or derived from X as is used in above code (L, C).

off-topic: see if the following links is helpful to you:

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.