[Tex/LaTex] Table caption align top-right

captionshorizontal alignmenttables

How I can align caption for table like this?

enter image description here

Current code:

\begin{table}[h]
  \caption{}
  \centering
    \begin{tabular}{|l|r|r|l|}
        \hline
        № & X     & Y     & Время выполнения м:сс \\ \hline
        1 & 15000 & 16000 & 0:57                  \\ \hline
        2 & 16000 & 17000 & 0:19                  \\ \hline
        3 & 17000 & 18000 & 0:10                  \\ \hline
        4 & 18000 & 19000 & 0:03                  \\ \hline
        5 & 19000 & 20000 & 0:02                  \\ \hline
        6 & 20000 & 21000 & 0:01                  \\ \hline
        7 & 60000 & 61000 & 0:01                  \\ \hline
    \end{tabular}
\end{table}

Best Answer

The requirement for traditional \caption right/left justification implies that the table be boxed. You can do this with ctable and caption:

enter image description here

\documentclass{article}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{caption}% http://ctan.org/pkg/caption
\captionsetup[table]{justification=raggedleft,singlelinecheck=off}
\begin{document}
\ctable
  [caption={Some caption}]% <options>
  {|l|r|r|l|}% <column spec>
  {}% <footnotes>
  {% <table>
    \hline
    No & X     & Y     & Hours:Minutes \\ \hline
    1 & 15000 & 16000 & 0:57                  \\ \hline
    2 & 16000 & 17000 & 0:19                  \\ \hline
    3 & 17000 & 18000 & 0:10                  \\ \hline
    4 & 18000 & 19000 & 0:03                  \\ \hline
    5 & 19000 & 20000 & 0:02                  \\ \hline
    6 & 20000 & 21000 & 0:01                  \\ \hline
    7 & 60000 & 61000 & 0:01                  \\ \hline
  }
\end{document}