I have created two table side by side with minipage. the tables appear perfectly except the label and caption for the right table show up as that of left table. On the other hand, the caption and label for right table vanish.
Here's the code:
\documentclass[12pt,a4paper,landscape]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{float}
\restylefloat{table}
\begin{document}
\begin{table}[H]
\setlength\tabcolsep{0pt}
\begin{minipage}{0.475\textwidth}
\begin{tabular}{1\textwidth}{@{\extracolsep{\fill}} l {8}{c}}
\toprule
Original Class & \multicolumn{8}{c}{Class Predicted} \
\cmidrule{2-9}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \
\midrule
1 & 17 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
2 & 0 & 14 & 0 & 0 & 0 & 0 & 0 & 0 \
3 & 0 & 0 & 17 & 0 & 0 & 0 & 0 & 0 \
4 & 0 & 0 & 0 & 17 & 0 & 0 & 0 & 0 \
5 & 0 & 0 & 0 & 0 & 15 & 0 & 0 & 0 \
6 & 0 & 0 & 0 & 0 & 1 & 11 & 0 & 0 \
7 & 0 & 0 & 0 & 0 & 0 & 0 & 13 & 0 \
8 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 15 \
\bottomrule
\end{tabular}
\caption{Confusion Matrix}
\label{tab:Table 1}
\end{minipage}
\hfill
\begin{minipage}{0.475\textwidth}
\begin{tabular}{1\textwidth}{@{\extracolsep{\fill}} l {8}{c}}
\toprule
& \multicolumn{8}{c}{Class} \
\cmidrule{2-9}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \
\midrule
TPR & 1 & 1 & 1 & 1 & 1 & 0.917 & 1 & 1 \
TNR & 1 & 1 & 1 & 1 & 0.99 & 1 & 1 & 1 \
FPR & 0 & 0 & 0 & 0 & 0.0095 & 0 & 0 & 0 \
FNR & 0 & 0 & 0 & 0 & 0 & 0.083 & 0 & 0 \
\bottomrule
\end{tabular}
\caption{Evaluation Metrics}
\label{tab:Table 2}
\end{minipage}
\end{table}
\end{document}
Output:
Edit
I used the answer written by Mico here.
Edit 2
I have used [ht!] for one table and the table was misplaced (Output attached). So I'm still using [H] which gives me desired output.



\labelas it confusers people reading the source if\ref{tab:Table 2}produces "Table 4" or whatever the number is in the final document. – David Carlisle Sep 27 '20 at 10:20\restylefloat{table}– David Carlisle Sep 27 '20 at 10:28\captionwork as @Marijn described, the\captionis not used where it appears in the source but positioned according to the float style. If you want that generally but need special formatting here then that is probably possible I'd need to check the package but just removing that line gives the output you intended – David Carlisle Sep 27 '20 at 10:30\restylefloat{table}. – Mico Sep 27 '20 at 10:51\usepackage[paper=portrait,pagesize]{typearea}directly contradicts the document class optionlandscape. Please settle the portrait versus landscape orientation issue. – Mico Sep 27 '20 at 10:57https://stackoverflow.com/questions/1673942/latex-table-positioning
– Debbie Sep 27 '20 at 11:20\restylefloatis somehow needed in order to specify[H]be removed entirely. – Mico Sep 27 '20 at 11:55\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}, do consider writing\usepackage[margin=2cm]{geometry}. Much more succinct, isn't it? – Mico Sep 27 '20 at 12:09