[Tex/LaTex] Two Captions for the table

captionstables

I got tables working based on MWE. It was provided by @Yiannis Lazarides How to create new table environment
How can I create two captions one on the top and one on the bottom.

\documentclass{article}
\makeatletter
\usepackage[figurename=Figure.,
                  justification=RaggedRight, 
                  labelfont={bf, footnotesize}, 
                  textfont={footnotesize},position=top]{caption}
\begin{document}
\listoftables
\def\starttable#1{%
  \renewcommand{\arraystretch}{1.1}%
  \minipage{0.45\textwidth}
      \captionof{table}{#1}
      \tabular{|c|c|c|c|}
      \hline
      Text-1  & Text-2 & Text-3 & Text-4 \\
      \hline
}
\def\stoptable{%
   \hline\endtabular
   \endminipage\hspace{10pt}}
\def\R #1|#2|#3|#4{ #1&#2&#3&#4}

\newpage
\begin{table}[h]
\centering
\starttable{First table caption}
 \R test|test|test|test\\
 \R test|test|test|test\\
 \R test|test|test|test\\
\stoptable
%
\starttable{This is the second caption}
 \R test|test|test|test\\
 \R test|test|test|test\\
 \R test|test|test|test\\
\stoptable
\end{table}
\end{document}

Best Answer

Using

\def\stoptable#1{%
   \hline\endtabular\par\vspace{\abovecaptionskip}%
   {\footnotesize #1}%
   \endminipage}

allows you to add

\stoptable{<caption>}

and receive a caption below the table:

enter image description here

\documentclass{article}
\usepackage[figurename=Figure.,
                  justification=RaggedRight, 
                  labelfont={bf, footnotesize}, 
                  textfont={footnotesize},position=top]{caption}
\begin{document}
\listoftables
\def\starttable#1{%
  \renewcommand{\arraystretch}{1.1}%
  \minipage{0.45\textwidth}
      \centering
      \captionof{table}{#1}
      \tabular{|c|c|c|c|}
      \hline
      Text-1  & Text-2 & Text-3 & Text-4 \\
      \hline
}
\def\stoptable#1{%
   \hline\endtabular\par\vspace{\abovecaptionskip}%
   {\footnotesize #1}%
   \endminipage}
\def\R #1|#2|#3|#4{ #1&#2&#3&#4}

\newpage
\begin{table}[h]
\centering
\starttable{First table top caption}
 \R test|test|test|test\\
 \R test|test|test|test\\
 \R test|test|test|test\\
\stoptable{First table bottom caption}
\hspace{10pt}%
\starttable{Second table top caption}
 \R test|test|test|test\\
 \R test|test|test|test\\
 \R test|test|test|test\\
\stoptable{Second table bottom caption}
\end{table}
\end{document}
Related Question