2

I want to create a table of two columns with fixed width, like in the following image: enter image description here

I used this code:

\begin{tabular}{c c}
\setlength\arraycolsep{10pt}

AVG & The average weight of a document is calculated as the sum of weights W(t,c) of its terms dithe document.  \\
STD & The standard deviation of the weighted as    of the snus the av\\
MIN & The minimum weight of a document is the l)  in the document.  \\
MAX & The  weight of a  term weight W(t,c) found  \\
PROB & The overall weight of a docuvided by the total number the docu \\
PROP & The between the number of vocabulary terms of the docume
\end{tabular}

But the problem is, there are no borders !, also the text is overlapped with the second column of the document !!

1
  • 2
    Welcome to TeX.SE. Please don't post such fragments only -- provide the minimal compilable document that has this issue. Most likely, you need the tabularx package and its tabularx environment, in conjunction with the array package
    – user31729
    Commented Feb 11, 2018 at 21:36

1 Answer 1

2

Use this:

\documentclass[twocolumn]{article}

\usepackage{tabularx, ragged2e, caption, lipsum}
\setlength{\extrarowheight}{2pt}

\begin{document}

\lipsum[1]
\begin{table}[!htb]
\caption{my caption} \label{some-label}% for cross references
\begin{tabularx}{\linewidth}{|l|>{\arraybackslash\RaggedRight}X|}
\hline
    AVG & The average weight of a document is calculated as the sum of weights W(t,c) of its terms dithe document. \\
    \hline
    STD & The standard deviation of the weighted as of the snus the av\\
    \hline
    MIN & The minimum weight of a document is the l) in the document. \\
    \hline
    MAX & The weight of a term weight W(t,c) found \\
    \hline
    PROB & The overall weight of a docuvided by the total number the docu \\
    \hline
    PROP & The between the number of vocabulary terms of the document\\
    \hline
    \end{tabularx}
\end{table}

\end{document} 

enter image description here

9
  • it gives me an error: ! Missing number, treated as zero.<to be read again>| ...larx}{|l|>{\arraybackslash\RaggedRight}X|}
    – Minions
    Commented Feb 11, 2018 at 21:48
  • Sorry, I forgot to specify the table width. See the updated code.
    – Bernard
    Commented Feb 11, 2018 at 21:50
  • I tried to add the caption but it not works !, it shows this:! LaTeX Error: \caption outside float.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \end{tabularx}
    – Minions
    Commented Feb 11, 2018 at 21:56
  • That is normal: captions work with floats. See the updated code.
    – Bernard
    Commented Feb 11, 2018 at 22:01
  • 1
    Could you post what you've typed (full minimal code reproducing the problem)?
    – Bernard
    Commented Feb 11, 2018 at 22:17

You must log in to answer this question.

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