1

I am using the command multicols as it is the best option for me. However, I have to introduce a table and I want to addd a caption. If I use the enviroment table it does not work, the table disappear.

Bernard
  • 271,350
pdr99
  • 11
  • 4
    Welcome to tex.sx. We need more information in order to be able to answer your question. Please add a small, compilable example, starting with \documentclass and ending with \end{document} that produces the problem described. Then that gives a potential helper something to experiment with, without having to guess. – barbara beeton Nov 13 '20 at 20:04
  • 2
    When trying to place a table environment inside of a multicols environment, you should receive a warning such as " Floats and marginpars not allowed inside multicols environment!.". The multicol documentation also explicitly states ". LATEX’s float mechanism, however, is partly disabled in this implementation. At the moment only page-widefloats (i.e., star-forms) can be used within the scope of the environment". – leandriis Nov 13 '20 at 20:07
  • 1
    As an alternative, you can try the \captionof command from the caption package and replace the table environment with the center environment, provided you want to horizontally center your table within its column. – leandriis Nov 13 '20 at 20:09
  • @pdr99 please see if the answer suits the requirement – js bibra Nov 14 '20 at 08:57

1 Answers1

1

enter image description here

Two methods

-- with the makebox and minipage with tabular environment and caption

-- with the tabular and captionof environment since multicols does not accept normal caption

with inputs from --

How to put captions below tables residing in multiple columns

and

tables side-by-side using minipage

\documentclass[]{article}
\usepackage{multicol}
\usepackage{caption}
\usepackage{blindtext}

\begin{document}

\begin{table}
    \centering
    \makebox[0pt][c]{\parbox{0.9\textwidth}{%
            \begin{minipage}[b]{0.45\textwidth}
                \centering
                \begin{tabular}{ | c | c|c|c| }
                    \hline
                    i & 1 & 2 & 3\\
                    \hline
                    $V$ & 10 & 8 & 12\\
                    \hline
                \end{tabular}        
                \caption{xxx}
                \label{tab:first}
            \end{minipage}
            \hfill
            \begin{minipage}[b]{0.45\textwidth}
                \centering
                \begin{tabular}{ |c|c|c|c| }
                    \hline
                    i & 1 & 2 & 3\\
                    \hline
                    $N_2$ & 1 & 0 & 1\\
                    \hline
                \end{tabular}
                \caption{xxxx}
                \label{tab:second}
            \end{minipage}
    }}
\end{table}

\begin{multicols}{2}
    \blindtext[1]\\ 
    { 
     \begin{center}
         \begin{tabular}{ |c|c|c|c| }
           \hline
           i & 1 & 2 & 3\\
           \hline
           $N_2$ & 1 & 0 & 1\\
           \hline
           \end{tabular}
           \captionof{table}{Lets see}\label{pinki}
            \end{center}
              }  
             \blindtext[2]
             \end{multicols}
            \end{document}

js bibra
  • 21,280